# Sync actions to audio in a rhythm game

**URL:** <https://qa.fmod.com/t/sync-actions-to-audio-in-a-rhythm-game/22135>\
**Category:** Unity\
**Tags:** unity\
**Created:** [September 28, 2024, 8:32am UTC](https://qa.fmod.com/t/sync-actions-to-audio-in-a-rhythm-game/22135 "2024-09-28T08:32:42Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![li\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/li_fmod/32/6577_2.png) [@li\_fmod](https://qa.fmod.com/u/li_fmod)\
**Post date:** [October 2, 2024, 5:17am UTC](https://qa.fmod.com/t/sync-actions-to-audio-in-a-rhythm-game/22135/2 "2024-10-02T05:17:14Z")

</div>

Hi,

Thank you for sharing the information.

> [@Sapryx](#):
>
> but it doesn’t match the position of the beat somehow, it’s always slightly offset. And what’s even stranger is that the offset is always different.

Could I please grab more info? What version of FMOD Unity integration are you using? How large is the offset that you are observing between the beat and the user input timeline position?

Due to the asynchronous nature of Studio, there’s usually a very slight difference in timing between most commands being called via the API, and being executed by Studio.

Studio also has a default update period of 20ms, which means that the timeline position will update every 20ms instead of constantly. Both of these can contribute to the beat position being slightly offset from the time retrieved from `getTimelinePosition`.

For more information, you could also have a look at a similar post here:

> [@Rythm game and latency](https://qa.fmod.com/t/rythm-game-and-latency/20973):
>
> Hello everyone! Part of an upcoming project will include a rythm mini-game. My approach so far was to simply play a music event in FMOD, and in parallel inside of Unity trigger pre-determined rythms. It is mostly okay, but as you might expect there is a bit of latency between the two systems that are completely independent, and it gets worse with frame drops. I did see we could edit the DSP Buffer Size to diminsh latency, but the documentation seems to say it shouldn’t be used, and since this m…

Hope this helps, let me know if you have any questions.

---

_[View the full topic](https://qa.fmod.com/t/sync-actions-to-audio-in-a-rhythm-game/22135)._
