Problems reliably fetching dsp clock for an EventInstance for beat matching


We are working on a beat matching game using FMOD and Unity. We’ve tried different methods of reliably figuring out the beats of the song but we haven’t found a perfect solution yet, and we’re wondering if you have some tips or pointers that can help us.Our idea is that as long as we can get the correct DSP clock for when the first beat happens, then we can calculate the rest of the beats by the diff of the DSP clock.So far we’ve mainly tried:

We check the DSP clock each frame update using FMOD.Studio.EventInstance…getDSPClock().None of these seem accurate enough for us, we have a feeling that there is some delay/offset from the DSP clock value we get and the actual time of the beat in the song. Is there anything we might be missing?

Using the built-in beat callbacks do not help us since these happen “too late”. Our music is of fixed BPM so calculating the time between each beat is trivial, our issue is that the dsp clock values seem to be inconsistent between runs. Essentially there seems to be some delay, however small, from starting an instance to when the audio is heard - which is why we want to read the dsp clock to get the timing for the beat.

Any help or pointers appreciated.

We are using FMOD 2.003 and Unity 2019.4.

Usually this is caused by sample data loading and can be avoided by creating, and loading, Events ahead of time.

You can also adjust the Studio update period which is 20ms by default.