Well, I just “played” with the data off the data stream. I was able to get a pair of waveform displays by using bytes 2 and 4 of a 4 byte block. Based on your description I’m probably just truncating the upper bytes of info Now I imagine this only works for a stereo bitstream, as a mono bitstream wouldn’t have 4 bytes but rather 2 bytes per block.
So it looks like the frequencies are derived from the values in the bitstream and not directly encoded?
Here’s the code that sets up the line. It looks to be based off the loaded sound file.
AudioFormat sourceFormat = m_audioInputStream.getFormat();
trace(1, getClass().getName(), "Source format : ", sourceFormat.toString());
AudioFormat targetFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, sourceFormat.getSampleRate(), 16, sourceFormat.getChannels(), sourceFormat.getChannels() * 2, sourceFormat.getSampleRate(), false);
trace(1, getClass().getName(), "Target format: " + targetFormat);
m_audioInputStream = AudioSystem.getAudioInputStream(targetFormat, m_audioInputStream);
AudioFormat audioFormat = m_audioInputStream.getFormat();
trace(1, getClass().getName(), "Create Line : ", audioFormat.toString());
DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat, AudioSystem.NOT_SPECIFIED);
m_line = (SourceDataLine) AudioSystem.getLine(info);