Jump to content
  • Advertisement
Sign in to follow this  
Storyyeller

variable speed sound playback

This topic is 3007 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 have making a 2d game in C++ with SDL ands SDL_Mixer for audio. It is completely deterministic, and designs to operate at a fixed framerate, but if the computer is lagging, then it obviously has to go into slow motion. The problem is that this causes the audio to get out of sync from everything else. The game is supposed to be able to run properly without knowing anything about its framerate, but that is obviously impossible with audio. What can I do? Do I need to custom mix together all of my music and sounds? Are there any libraries I can use for this?

Share this post


Link to post
Share on other sites
Advertisement
The problem does not lie in your audio implementation, it lies in your game.

You need to make it handle variable frame rates. You usually do this by passing a timestep into your update functions.

If you don't fix your game, then not only will the audio be out of sync, but your game will also play differently on different systems.

You *can* adapt your audio to fit by using time stretching techniques, but you will find that a LOT harder than fixing your game. Take a look (google) at FFTs (Fast Fourrier Transforms) to see what you would be up against.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!