With openal, sound get cut off before end

hi, i have a strange behaviour when playing sounds in panda: most of my sounds are not played to the end, they get cut off.
The sound files that are cut off are edited with audacity and then exported (wav and mp3), whereas those that came directly from our recording studio are playing fine (i don’t know which software they use).

when i use a SoundInterval, the interval keeps going for the original length of the file, it just mutes at some point (near the end).

anyone else had this issue?

/thomas

Are you sure the sound files themselves are good? When you play them in other software, do they sound correct?

We’ve had troubles with variable-bit-rate mp3 files before. Try exporting your mp3’s in constant-bit-rate format, does that help? Never had a problem with a wav file before, though.

David

when i open those wav files in another software, they play fine. i also have tried to compress them to mp3 (with constant bitrate) - but the problem persists.

i guess i have to look a bit deeper into my code and see if i’m doing something terribly wrong…

/thomas

Have you tried changing the sampling rate? I remember once exposing a bug in OpenAL under OSX when trying to play 22KHz Oggs. (The libvobris wrapper code was making some assumptions about proper up-sampling.)

the sampling rate of all my sound files is 44.1KHz
can you play ogg files with openal?

i forgot to add: the problem occurs only with openal, when switching to fmod, the sounds all play fine (but i have to use openal).

/thomas

NOTE: you cant ship mp3 files with your game unless you pay like $7K USD for license.

Yeah, as long as you link in all of the vorbis stuff, including the OpenAL wrappers.

I haven’t built OpenAL from scratch in ages, though. I haven’t yet started work with sound in my game, so no idea how OpenAL behaves these days. I only remember real problems cropping up with OpenAL when porting my past games from Windows to OSX. There were slight differences in how the library behaved between OSes.

Have you checked to see what kind of encoding format your WAV files are using? Try saving them as pure standard PCM instead of using any of the compression schemes. This would demonstrate if the problem is with the actual sound-playing, or with the decoding parts.

Although you really don’t want to ship mp3 files with your game if you don’t want some angry lawyers with pitchforks at your doorstep, this is indeed a bug which I’ve seen before - a workaround is to change the sampling rate.

Please report this bug to the panda3d bugtracker at launchpad so I can move it upstream to ffmpeg.

i did a bit more testing on this and found out that it has to do with the length (or more precise the uncompressed size) of the sound files.
i switched on debug output for audio and noticed that the shorter soundfiles got loaded completely before they where played, whereas the longer files where streamed. the problem here could be that the size threshold at which sounds are streamed may be too high, or put another way, the buffer for short sounds may be too small.
all sounds between ~5 - 8 seconds (44.1KHz, 16Bit, Mono) are cut off at the end and they are not streamed, all longer sounds play fine and from the debug output i could see that they are streamed.

so the question is, how can i change the size threshold for buffered sounds or increase the buffer size?

/thomas

I am having the same issue on Ubuntu Jaunty. I haven’t tried it on Windows, yet. I’ve registered on Launchpad and if there’s any information I can submit to the bug report that thbusch added, please let me know.

A fix for this has been committed to cvs (at the time of writing this the last release is 1.7.0)

(Damn there were more threads with this issue than I thought, sorry for all the necro’ing)