/** * Main method * * @param args * command-line args (not used) * @throws InterruptedException */ public static void main(final String[] args) throws InterruptedException { // Construct a new audio waveform visualisation final AudioSpectrogram aw = new AudioSpectrogram(440, 600); aw.showWindow("Spectrogram"); // Start a sound grabber that will grab from your default microphone final JavaSoundAudioGrabber jsag = new JavaSoundAudioGrabber(new AudioFormat(16, 44.1, 1)); new Thread(jsag).start(); // Wait until the grabber has started (sometimes it takes a while) while (jsag.isStopped()) Thread.sleep(50); // Then send each of the frames to the visualisation SampleChunk sc = null; while ((sc = jsag.nextSampleChunk()) != null) aw.setData(sc); } }