Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'd like to slowdown music playback, say at half speed. I'm currently using SDLmixer. I assume I'd need to tell SDL that I have a 44KHz music and want to stream it at 22KHz, but when I pass in 22Khz it seems it re-samples my audio and plays at normal speed.

Does anyone know how to do that, or any lib that supports it? I'm looking for free libs that allow me a commercial license (so no FMOD)

Thanks in advance.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The approach chosen would depend on whether you want to retain pitch or not, but I'd probably go for a third party library with an acceptable license like SoundTouch (LGPL v2.1) to apply a tempo adjustment to your input signal.

That'd allow you to have a bit more choice in the exact tempo you want instead of "double" or "half". It also seems like it is capable of doing both tempo and pitch adjustments independently if you want to play around with pitch as well.

share|improve this answer
    
Soundtouch is the best opensource lib I know of that does this. For closed source (and costs money) you can go to Z-Plane, Izotope, and Dsp dimension. If you really want it to play at half speed and don't mind the change in pitch, you just need to resample. Secretrabitcode, or libsamplerate, is available both open source and commercial. You can also use code from SoX (soundExchange) I believe. –  Bjorn Roche Aug 23 '12 at 1:51
    
Well, I don't mind changing the pitch. I tried to resample it but it didn't work. (Resampling audio with Audicity from 44KHz to 22KHz gives me the sample playback speed as well as passing 22KHz in SDL_LoadMMus()) I'll definitely try that SoundTouch lib. Thanks! –  felipedrl Aug 23 '12 at 13:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.