GetTimelinePosition accuracy for rhythm game

Kia ora,

I’m trying to make a rhythm game in Unity using FMOD and I’m having trouble getting accurate timeline position info. At the moment I just have a simple system where when the player clicks it will log how many milliseconds early or late you were from the beat.

The number I’m getting back with getTimelinePosition() seems to consistently be ~150ms higher than expected, which isn’t ideal. Is there anything I might be doing wrong or some way I can get more accurate timing information?

// In the music manager class
public int GetTimelinePosition()
        musicInstance.getTimelinePosition(out int position);
        return position;

// In the player class
private void FirePressed(InputAction.CallbackContext obj)


Due to the nature of the FMOD system, i.e. commands are queued up and executed asynchronously when the system is updated, there will always be a slight difference between the expected and actual timeline position; however, this is normally pretty negligible and nowhere near 150ms.

The more likely cause is that the asset you’re playing in your music event is set to “Stream”, which means that instead of loading the entire asset into memory and then playing it, the asset is loaded piecemeal on-demand, which incurs extra latency. If the asset is set to stream, disable that and see whether that fixes the issue.

If the asset isn’t set to stream, could I get you to provide your Unity, FMOD Studio, and FMOD for Unity version numbers, and upload your FMOD Studio project to the uploads tab of your FMOD Profile so I can try to reproduce the issue?

On the topic of more accurate timing information, you may wish to look into using timeline callbacks - they allow you to define code yourself that is called by the FMOD System upon reaching certain points in the event timeline, such as markers or beats, which is typically good for rhythm games. If that sounds like something that would be useful, our Unity docs have a basic timeline callbacks example script that I would recommend taking a look at.