This discussion is archived
1 Reply Latest reply: Feb 11, 2011 2:30 PM by 810604 RSS

Java not working properly with 24 or 32 bits

805365 Newbie
Currently Being Moderated
Hello:

My app works with either 16, 24 or 32 bits. It generates several audio signals and you can either play them or save them as *.wav. It works properly with 16 bits but if I choose 24 or 32 bits it writes the wavs well but when playing writing to SourceDataLine it does weird things:

- It gives less level to the right channel at 0dbFs Stereo sine
- Writing zeros to one of the two channels don't mute that channel.

I have two sound cards and i have tried with different Mixers and different sound cards but didn't solve anything. And searching the web i found this:

http://stackoverflow.com/questions/3024622/java-playback-of-24-bit-audio-is-incorrect

which is exactly what happens to me. I only use java sound api but need to solve this.

Any help?

Thanks once again.
  • 1. Re: Java not working properly with 24 or 32 bits
    810604 Newbie
    Currently Being Moderated
    Whilst the JavaSound API provides for greater than 16 bits (and sample rates above 48k for that matter) I've not had any luck with finding a Java Runtime that supports anything besides 16 bit and 44.1k or 48k (under OS X you even struggle to get anything besides 44.1k). If you are on Windows it would be worth looking at Martin Roth's JAsioHost (https://github.com/mhroth/jasiohost) which allows you to access soundcards via their ASIO drivers and write to them using float sample data.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points