Using frame look ahead to beat latency

hello,

we’re making a rhythm heavy game. a beat queue has been built in so actions that the player makes will queue in to the beat queue and fire on 4ths, 8ths, 16ths, etc. very fun!

there is inherent latency with our process because fmod is telling unity the bpm and when each bar/beat occurs to keep it in time and when a reactive action happens, we go through this process:

beat happens -> react in unity -> start one shot -> couple ms latency that is noticeable -> one shot plays

with time heavy stuff, this is important. our current workaround is setting in unity the event to look ahead by 5 frames. after the process it near enough hits it on time.

my questions are: is there a better way around this? is there a way to reduce the latency? would reducing the dsp buffer size help? (that’s a last resort though)

any thoughts and help would be greatly appreciated.

cheers!
thomas

Hi Thomas,

I don’t know if this can help, because I’m not FMOD expert, but we are making a rhythm game and we found the same problem.

What we do is to prepare events beforehand and pause/play them to avoid latency. First, create a pool of events, then prepare first one, play and pause it in the same frame. When the game event is “triggered”, just unpause it and prepare the next one (play and pause). That way, the sound is played “immediately”.

Hope it helps!
Pere

2 Likes

To reduce the time it takes for an Event to start there a few things you can do:

2 Likes

Nice one, Pere!

i’ll give that a test run over the next couple of days :slight_smile:

cheers
thomas

thanks cameron!

i’ll fiddle around with these things and test.

cheers
thomas

Are you still having this problem? I’ve tried all the methods described above, and I still have significant latency in fmod events that isn’t present in unity’s audiosource sounds.

hey! sorry for the slow response. we’ve stuck with “frame lookahead” to solve it in the end. getting the event to look ahead by 5 frames was good enough for us. i substituted the sfx noise for a kick and substituted the music for a metronome to fine tune it.

best of luck!