2
\$\begingroup\$

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.

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ 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. \$\endgroup\$ Aug 23, 2012 at 1:51
  • \$\begingroup\$ 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! \$\endgroup\$ Aug 23, 2012 at 13:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .