# 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:** 4

<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 9, 2024, 11:22pm UTC](https://qa.fmod.com/t/sync-actions-to-audio-in-a-rhythm-game/22135/4 "2024-10-09T23:22:42Z")

</div>

Thank you for sharing the code and additional information.

> [@Sapryx](#):
>
> I have a BeatTracker script that updates the current position of the song every frame and calls an event when nessesary.

The use of Unity’s `Update()` function is frame-rate dependent, which means it might be introducing a tiny delay and the exact timing can vary between frames.

Instead of relying on Unity’s `Update()` function to check the beat every frame, you could consider using [Timeline callbacks](https://www.fmod.com/docs/2.03/unity/examples-timeline-callbacks.html) to sync the beats more precisely. These callbacks are tied directly to the FMOD DSP clock, so you can use them to handle downbeat events with more accuracy.

---

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