Audio plays too fast!


I’m really new to SDL development and audio programming in general, so
please excuse my inexperience!

I have a mono 16khz audio source and I setup SDL with the exact same
settings, but the audio is playing so fast.

What would cause SDL to play the audio too fast?

Thank you!

  • chris

Hello !

Did you try loopwave that
comes with SDL to play your wave ?

Another interesting infos would be :

What OS ?
What SDL version ?
What Compiler ?


What would cause SDL to play the audio too fast?

Likely culprits:

  1. You are playing back in stereo but feeding it mono data, so it’s
    playing out of two channels at twice the speed of one.
  2. You couldn’t get the audio device to open at 16k, and are feeding it
    at the wrong sample rate.
  3. You’re doing everything right, but SDL is converting between 16k and
    some non-power-of-two sample rate incorrectly (it only handles
    doubling/halving the rate, like 11k -> 22k -> 44k, not 16k -> 44k, for
    example). This is a known SDL bug.