/** * Main method * * @param args * ignored */ public static void main(String[] args) { // The data: final double[] data1 = new double[] { -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; // The chart generator final BarVisualisation bv = new BarVisualisation(1000, 400); // set the data bv.setData(data1); // show the result bv.showWindow("Data"); } }
/** * Shows a basic bar visualisation. * * @param args * The bar visualisation. */ public static void main(final String[] args) { final int nPoints = 10; final double[] data = new double[nPoints]; for (int i = 0; i < nPoints; i++) data[i] = nPoints * (Math.random() * 2 - 1); final BarVisualisation bv = new BarVisualisation(1000, 600); bv.setDrawValues(true); bv.setData(data); bv.setTransformer(new LabelTransformer() { @Override public String transform(final double value) { return String.format("%2.2f", value); } }); bv.showWindow("Bar Visualisation Demo"); } }
/** * Main method * @param args Command-line args (unused) * @throws MalformedURLException Will not be thrown */ public static void main( final String[] args ) throws MalformedURLException { // Open a URL to the sine wave sweep. If you have downloaded // this file you should use a new File(<filename>) here. final XuggleAudio xa = new XuggleAudio( new URL( "http://www.audiocheck.net/download.php?" + "filename=Audio/audiocheck.net_sweep20-20klin.wav" ) ); // Create the Fourier transform processor chained to the audio decoder final MFCC mfcc = new MFCC( xa ); // Create a visualisation to show our FFT and open the window now final BarVisualisation bv = new BarVisualisation( 400, 200 ); bv.showWindow( "MFCCs" ); // Loop through the sample chunks from the audio capture thread // sending each one through the feature extractor and displaying // the results in the visualisation. while( mfcc.nextSampleChunk() != null ) { final double[][] mfccs = mfcc.getLastCalculatedFeatureWithoutFirst(); bv.setData( mfccs[0] ); } } }
bv.showWindow("FFTs"); bv.getAxesRenderer().setDrawYTicks(false);
bv.setMaxValue( 1E12 ); bv.setAutoScale( false ); bv.showWindow( "FFTs" );
bv.showWindow( "MFCCs" );
bv.setAxisLocation( 100 ); bv.setMaxValue( 0.0001 ); bv.showWindow( "SpectralFlux" );
bv.setDrawValues(true); bv.fixAxis( 250 ); bv.showWindow("MFCCs");
bv.setDrawValues(true); bv.fixAxis( 250 ); bv.showWindow("MFCCs");
bv.showWindow( "FFT" );
bv.showWindow( "FFT" );