Sound behaviour with 2 channel sounds

Hoi,



i'm facing a strange behaviour here when playing ogg files with two channels.



If it is a music file, it won't be played at all. If it is a sound file, it only will be played every second time the sound is fired. The debug don't tell me something interesting, everything seems to be okay.



To exclude some weird testing stuff i have used the ogg files with the jme.test.audio package.

If you use the music code, nothing will be played with a 2 channel ogg.



I have used an audio ogg file with two channels with the HelloIntersection code to test everything on command, and if i use the two channel audio the sound will only be played every second time. If i use the one channel file, everything seems to work.



Is there something known about that problem?

I guess that using stereo-files won't make sense if jME calculates the sound-positions, but otherwise it should be possible to hear something everytime the sound is played…


  • Maurice

I looked into this a bit and this is what I found:



3D audio - positional sounds only work if you use mono sounds. If you use a stereo file, then (according to this OLD thread) it will just be played from both channels at a consistent volume, with position having no effect on it.



In the LWJGL OpenAL forum there was a suggestion that if a person wants to play a stereo file and change the volume of either channel, the sound file should be split into several files and each should be a separate mono source… allowing more precise control. This stereo-mono thing is in OpenAL and cannot be changed.



However this does not explain why you should only hear stuff every second time it is played. As I looked into jMe source I was unfortunately not able to make out what could be causing you the problems. Certainly jME detects if you are playing a mono or Stereo file and tries to act differently according to that information. The only thing that popped into my eye was this:


                if (getStream().getDepth() == 8) {
                    format = (mono ? AL10.AL_FORMAT_MONO8
                            : AL10.AL_FORMAT_STEREO8);
                } else if (getStream().getDepth() == 16) {
                    format = (mono ? AL10.AL_FORMAT_MONO16
                            : AL10.AL_FORMAT_STEREO16);
                }



Now.. my knowledge of audio stuff is fairly limited.. but could it be that the bit depth of the audio file you are playing is neither 8 nor 16? In any case its worth trying to play different audio files.. also some of lower quality...

Besides that.. I am fairly lost. The last person to modify the filed that have anything to do with OpenAL stereo, was Irrisor, so perhaps he can chime some light on this....


Well, i thought it could be possible that the sound is played normally but is alternating  to the left and right channel, so that i can hear just one channel for some weird reasons (Audio settings are okay).

I have not looked quite a lot at the code or the files, but i HAVE done some conversion with the files. I will check that 8 / 16 bit issue and see what i will find out about that.

My first guess is that the overall quality has no effect, it seems to be the channel setting.

- Maurice