Java playback of 24 bit audio is incorrect

Posted by Paul Hampson on Stack Overflow See other posts from Stack Overflow or by Paul Hampson
Published on 2010-06-11T16:50:15Z Indexed on 2010/06/11 16:52 UTC
Read the original article Hit count: 357

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about audio