SDL_mixer sound is choppy & buffer sizes

I am having problems with SDL_mixer as I probably guess a lot of other
people do as well. Here is what I have:

Mix_OpenAudio(44100, AUDIO_S16SYS, 1, 4096);

This opens a mono channel with 4096 bytes of buffer size. If I use
anything below 4096, the sound immediatelly gets choppy (jitter?) for
lack of a better word, and it’s unusable. With 4096 bytes the sound
plays fine, but the latency is way too high (almost half a second).

I guess this is one of the most asked questions here on the mailing
list, but I couldn’t search the mailing list archives because there’s no
function for it, and I didn’t find anything useful on google either. So
how does one remedy this?

Thanks!

Best regards
David Karlgren–
www.terrorpunksyndicate.org
www.myspace.com/terrorpunksyndicate

We had same problem with directsound.
Still didn’t fixed - using waveout audio driver - it working but have
terrible latency up to 0.5s =(

Alex

2005/12/13, David K :>

I am having problems with SDL_mixer as I probably guess a lot of other
people do as well. Here is what I have:

Mix_OpenAudio(44100, AUDIO_S16SYS, 1, 4096);

This opens a mono channel with 4096 bytes of buffer size. If I use
anything below 4096, the sound immediatelly gets choppy (jitter?) for
lack of a better word, and it’s unusable. With 4096 bytes the sound
plays fine, but the latency is way too high (almost half a second).

I guess this is one of the most asked questions here on the mailing
list, but I couldn’t search the mailing list archives because there’s no
function for it, and I didn’t find anything useful on google either. So
how does one remedy this?

Thanks!

Best regards
David Karlgren


www.terrorpunksyndicate.org
www.myspace.com/terrorpunksyndicate


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Is there really no solution to this??

David K wrote:> I am having problems with SDL_mixer as I probably guess a lot of other

people do as well. Here is what I have:

Mix_OpenAudio(44100, AUDIO_S16SYS, 1, 4096);

This opens a mono channel with 4096 bytes of buffer size. If I use
anything below 4096, the sound immediatelly gets choppy (jitter?)
for lack of a better word, and it’s unusable. With 4096 bytes the
sound plays fine, but the latency is way too high (almost half a second).

I guess this is one of the most asked questions here on the mailing
list, but I couldn’t search the mailing list archives because there’s
no function for it, and I didn’t find anything useful on google
either. So how does one remedy this?

Thanks!

Best regards
David Karlgren

www.myspace.com/terrorpunksyndicate

try fmod or OpenALOn 12/17/05, David K wrote:

Is there really no solution to this??

David K wrote:

I am having problems with SDL_mixer as I probably guess a lot of other
people do as well. Here is what I have:

Mix_OpenAudio(44100, AUDIO_S16SYS, 1, 4096);

This opens a mono channel with 4096 bytes of buffer size. If I use
anything below 4096, the sound immediatelly gets choppy (jitter?)
for lack of a better word, and it’s unusable. With 4096 bytes the
sound plays fine, but the latency is way too high (almost half a
second).

I guess this is one of the most asked questions here on the mailing
list, but I couldn’t search the mailing list archives because there’s
no function for it, and I didn’t find anything useful on google
either. So how does one remedy this?

Thanks!

Best regards
David Karlgren


www.terrorpunksyndicate.org
www.myspace.com/terrorpunksyndicate


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Olof Bjarnason wrote:

try fmod or OpenAL

Thanks!

I’m using fmod now instead and it works like a charm. I can’t believe
SDL_mixer was this flawed??

Best regards
David Karlgren

David K wrote:

I’m using fmod now instead and it works like a charm. I can’t believe
SDL_mixer was this flawed??

wait some time and you will find fmods flaws as well. :slight_smile:

David K wrote:

Is there really no solution to this??

If you’re using ALSA on a Linux box, the driver defaults seem to be way
too high for real-time audio (but probably fine for the cute little
dings that KDE and Gnome make)

Adding something like this to ~/.asoundrc may help:

period_size 1024
buffer_size 4096

(feel free to adjust those values.)

This seemed to help the SDL audio code in Quake 3 with ALSA.

–ryan.