I need to display a graph of a sound file - i.e. a wave form as displayed by audio editors such as Audacity.
How should I go about this? Is there anything in the Java Sound API that can help me?
I need to display a graph of a sound file - i.e. a wave form as displayed by audio editors such as Audacity.
How should I go about this? Is there anything in the Java Sound API that can help me?
In Java Sound API poke around AudioSystem.getAudioInputStream which will return AudioInputStream which shows you how to open audio files form within Java. It is good enough to read .wav files, but not quite so for mp3s.
It lets you read bytes one by one directly. Also getAudioFormat will return object that has sample rate, bit/sample, etc. After reading your waveform you can draw it in your favorite way on the screen (Swing, AWT, png file on the web, etc.).
In the end I found code to do exactly what I wanted in Chapter 10 of the book Swing Hacks.