Jump to content
  • Advertisement
Sign in to follow this  
linuxwolf

Live re-sampling playback speed changes using SDL mixer?

This topic is 1339 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working on a game which has ability to slow down time. All of the graphics/animations are simulated in slow motion during this feature. However the sound is still playing at its normal speed. I would like all audio to play 2x slower but I am using the SDL mixer API and can't find an appropriate API for this purpose.

 

Can anyone please suggest a hack or workaround so I don't have to re-write my sound code on a different API? I would like to achieve this effect using SDL mixer. Thanks.

Edited by linuxwolf

Share this post


Link to post
Share on other sites
Advertisement

I don't know anything about SDL - can you supply the sampling frequency anywhere for SDL for the individual tracks playback? If so just reduce the playback sampling frequency by the amount you want the soundclip slowed - ie if your sampling frequency is 44.1k and you want the speed to be 2/3 of normal, set sampling frequency for that clip to 2/3 * 44.1 kHz for playback.

Share this post


Link to post
Share on other sites

I managed to get this done using the effect API in SDL mixer - but it was a hack. If there are non-hack solutions to this, I'm all ears.

Share this post


Link to post
Share on other sites

Adding silence to the end of every audio file loaded just so SDL doesn't stop playing the sound before it has finished playing through at half its normal rate.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!