views:

22

answers:

1

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?

A: 

I'm having the same problem with sound presentation for an Audiometric test. I'm attempting to present isolated right and left tones. The buffer is correct prior to being sent to line.write(...), such that the first three bytes (of a 6-byte, or 24-bit stereo) of the frame are zero for the non-presenting side. When I isolate the left side, the tone presents fine through only the left headphone. However when I isolate the right side, the tone presents through both headphones. This is not the case in other 24-bit presentation medium (such as Matlab), where I can isolate both right and left side. That leads me to believe it's a bug in Java's Sound API.

Did you have any luck with a work-around on this? Thanks!

Adam
Nope, I gave up in the end :( Fortunately for what we are doing we were able to take a different approach.It seems that Java doesn't handle the 24bit samples correctly. If you run a ramp through it over full range (i.e. increasing by +1 each time) you see it is doing something very odd to the values. Basically Java isn't a good vehicle for this type of stuff sadly - 16 bit works ok though.I have been told that PortAudio (the same interface that audacity uses) is quite handy, though i am not saure if it has a java interface.
Paul Hampson