WAVE playback bad

Ryan C. Gordon icculus at clutteredmind.org
Wed Oct 3 21:09:21 EDT 2001

> I have a wave file that is not playing properly for me using
> SDL_sounds's playsound. It sounds as if it was played at double speed
> or so (i.e. shorter than with other players, and higher pitch).

Hhm. The problem is twofold.

First, playsound forces a sample rate of 44100. Second, this particular
WAVE file plays at a sample rate of 22255, which isn't a multiple of
44100, so SDL refuses to do the conversion.

Which is annoying.

The solution in this case is for playsound to not force the sample rate to
an arbitrary number, but instead create the Sound_Sample object first, and
then call SDL_OpenAudio() with those numbers. SDL_OpenAudio is recalled
for each file listed on the command line. (This is in CVS.)

Note this only helps if the sound device can actually DO a frequency of
22255, otherwise, SDL will try to convert with...uh, the same problems.

We REALLY need to fix the damned audio converter.


More information about the sdlsound mailing list