Hi,
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:
- Saving the DSP clock at the first beat timeline callback as described here: https://fmod.com/resources/documentation-unity?version=2.0&page=examples-timeline-callbacks.html
- Saving the DSP clock at the time of calling FMOD.Studio.EventInstance.start().
- Saving the DSP clock on the frame when FMOD.Studio.EventInstance.getTimelinePosition() returns a position greater than 0.
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.