Java playback of 24 bit audio is incorrect
- by Paul Hampson
I am using the javax sound API to implement a simple console playback program based on http://www.jsresources.org/examples/AudioPlayer.html.
Having tested it using a 24 bit ramp file (each sample is the last sample plus 1 over the full 24 bit range) it is evident that something odd is happening during playback. The recorded output is not the contents of the file (I have a digital loopback to verify this).
It seems to be misinterpreting the samples in some way that causes the left channel to look like it is having some gain applied to it and the right channel looks like it is being attenuated.
I have looked into whether the PAN and BALANCE controls need setting but these aren't available and I have checked the windows xp sound system settings. Any other form of playback of this ramp file is fine.
If I do the same test with a 16bit file it performs correctly with no corruption of the stream.
So does anyone have any idea why the Java Sound API is modifying my audio stream?