Jump to content
  • Advertisement
Sign in to follow this  

FMod, synchronizing sound exactly

This topic is 4829 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

Is there a way to get a no-latency exact playing time of an mp3 stream in FMod? I am trying to get an exact rhythm for my game, like in many music games these days (for example, Dance Dance Revolution or Taiko Drum Master). I have the BPM correctly, the only problem is trying to adjust the offset correctly, so that the game isn't a bit early or late each beat. I've gotten the exact offset of the mp3 with goldwave, so that shouldn't be a problem either. FMod is playing the song with the FSOUND_MPEGACCURATE flag set. I've tried both FSOUND_Stream_GetTime() and FSOUND_Stream_SetTime(). SetTime seems to have quite a big latency, so my attempts at trying to adjust the stream's position using the game's own timer have failed. GetTime seems to work better, and my attempt at adjusting the game's timer using Stream_GetTime is quite smooth, but it is about 100 milliseconds early. Has anyone tried to synch music using fmod? Is this a problem with my sound card, fmod, or just my code?

Share this post


Link to post
Share on other sites
Advertisement
If you're going to need exact time, I'd recommend against using a stream. It would be better to load all information about the sound file before using it so that you have total control over the way the file is played and where is it playing.

Share this post


Link to post
Share on other sites
Wouldn't it be better to use a sequencer instead? MIDI or MOD would work well here, and it would be even easier to change the tempo. You'll never get it "exact" (even high-end professional audio cards have a certain amount of latency), but you can get it so no one will ever tell the difference.

Share this post


Link to post
Share on other sites
Thanks for the replies. I'll try loading the track to memory first, though it would seem odd that GetTime() is affected by that.

Midis and mods would be good, but I want the user to be able to use her own music, and mp3's are quite a de facto standard. Fmod's documentation seems to claim that GetTime is latency-adjusted, so that it automatically calculates the result to match what I hear. I guess that's just impossible to do perfectly.

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!