Syncing oneshot events perfectly on beat

Hi,

I have a piece of music, which has a constant bpm. I can calculate the interval between beats by dividing 60 seconds / bpm. By reading the dsp clock I can then, presumably, through code, know eaxactly when a beat occurs. I want to trigger one shot events that play exactly on these beats, however I am experiencing inconsistencies - sometimes the events are on beat, sometimes a bit early or late.

My oneshot events are created up front, I then call start() on them when I hit a beat.

Is there a more reliable method to sync these events being played? I was going to try setdelay , but this seems to be on a channel and not an event - I don’t understand why.

I tried a timeline beat callback - triggering events from this has the same issue, the timing is not reliable.

Another path has been to experiment with schedule-delay - I think this improves my situation somewhat but since I don’t know if my oneshot events will have latency before playing, it feels a bit shaky.
instance.setProperty(FMOD.Studio.EVENT_PROPERTY.SCHEDULE_DELAY, someValue);

So I guess my question is, what approach should I be taking here to achieve sample accurate playback of my oneshots?

Thanks

1 Like