Welcome! Log In Create A New Profile


SDL_mixer plays music at a wrong sample rate

Posted by josebagar 
SDL_mixer plays music at a wrong sample rate
April 08, 2010 11:16PM
Hi all!

First of all, let me introduce myself. I'm currently porting BennuGD (Bennu Game Development) to the Wii. BennuGD is an open source game programming language with a focus on simplicity and based on SDL.
You can see some sample BennuGD projects with source here, here or here.

The thing is doing quite wel, but I'm experiencing some trouble with SDL_mixer.
Right now I start the mixer with a sampling frequency of 32KHz. When I play songs encoded at 32KHz they play fine, but when songs are stored with a different frequency, they play wrong. I mean that no frequency resampling is done, so the songs play slower or faster than they should. I've tested this behaviour is present at least with OGG music.

I would like to know if this is the expected behaviour for SDL_mixer in the Wii or if I'm doing something wrong, as the same code works fine both in Linux and Windows.

The code that handles the sound playback is here, for the reference.

Thanks a lot for your time in answering my question, and sorry if it has aready been answered somewhere else.
Re: SDL_mixer plays music at a wrong sample rate
April 09, 2010 12:01AM
I don't think it's expected, but it is known to be the way the SDL Wii port works. If you want, you can try to fix the problem. But even still, it's better to have the files sampled to the proper (ie: supported) frequency beforehand rather than making the Wii do it. The Wii only natively supports 32 and 48, that's why resampling is required - regardless of if it's in advance or on the fly.
Re: SDL_mixer plays music at a wrong sample rate
April 09, 2010 01:31AM
Thank you very much for your quick response and for the great job you've done with the SDL. Without it, my port would have been inviable.

I don't think I have the required knowledge to solve this limitation, so I've written a couple of small scripts that use VLC to resample the sounds to 32KHz and recode them in OGG. I'll leave the links here in case they're useful to someone.

Linux/BASH version
Windows/BATCH version
Sorry, only registered users may post in this forum.

Click here to login