# Using frame look ahead to beat latency

**URL:** <https://qa.fmod.com/t/using-frame-look-ahead-to-beat-latency/14808>\
**Category:** FMOD Studio\
**Created:** [June 25, 2019, 2:42pm UTC](https://qa.fmod.com/t/using-frame-look-ahead-to-beat-latency/14808 "2019-06-25T14:42:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThomasHoey](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@ThomasHoey](https://qa.fmod.com/u/ThomasHoey)\
**Post date:** [June 25, 2019, 2:42pm UTC](https://qa.fmod.com/t/using-frame-look-ahead-to-beat-latency/14808/1 "2019-06-25T14:42:20Z")

</div>

hello,

we’re making a rhythm heavy game. a beat queue has been built in so actions that the player makes will queue in to the beat queue and fire on 4ths, 8ths, 16ths, etc. very fun!

there is inherent latency with our process because fmod is telling unity the bpm and when each bar/beat occurs to keep it in time and when a reactive action happens, we go through this process:

beat happens -\> react in unity -\> start one shot -\> couple ms latency that is noticeable -\> one shot plays

with time heavy stuff, this is important. our current workaround is setting in unity the event to look ahead by 5 frames. after the process it near enough hits it on time.

my questions are: is there a better way around this? is there a way to reduce the latency? would reducing the dsp buffer size help? (that’s a last resort though)

any thoughts and help would be greatly appreciated.

cheers!  
thomas

---

<div class="post-metadata">

**Author:** ![Pericuelo](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@Pericuelo](https://qa.fmod.com/u/Pericuelo)\
**Post date:** [June 26, 2019, 9:25am UTC](https://qa.fmod.com/t/using-frame-look-ahead-to-beat-latency/14808/2 "2019-06-26T09:25:10Z")

</div>

Hi Thomas,

I don’t know if this can help, because I’m not FMOD expert, but we are making a rhythm game and we found the same problem.

What we do is to prepare events beforehand and pause/play them to avoid latency. First, create a pool of events, then prepare first one, play and pause it in the same frame. When the game event is “triggered”, just unpause it and prepare the next one (play and pause). That way, the sound is played “immediately”.

Hope it helps!  
Pere

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [June 30, 2019, 11:25pm UTC](https://qa.fmod.com/t/using-frame-look-ahead-to-beat-latency/14808/3 "2019-06-30T23:25:48Z")

</div>

To reduce the time it takes for an Event to start there a few things you can do:

- Use a [non-streaming loading mode](https://www.fmod.com/resources/documentation-studio?version=2.0&page=managing-assets.html#loading-modes)

- Load the [sample data](https://www.fmod.com/resources/documentation-api?version=2.0&page=white-papers-studio-banks.html#sample-data) for the Bank or Event well before the Event is required.

- You can also attach the FMOD Studio Profiler to see if there may be a specific reason for the Event being delayed.

- [Performance Tips and Tricks](https://www.fmod.com/resources/documentation-api?version=2.0&page=white-papers-cpu-performance.html#tips-and-tricks).

---

<div class="post-metadata">

**Author:** ![ThomasHoey](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@ThomasHoey](https://qa.fmod.com/u/ThomasHoey)\
**Post date:** [July 4, 2019, 11:48am UTC](https://qa.fmod.com/t/using-frame-look-ahead-to-beat-latency/14808/4 "2019-07-04T11:48:57Z")

</div>

Nice one, Pere!

i’ll give that a test run over the next couple of days 🙂

cheers  
thomas

---

<div class="post-metadata">

**Author:** ![ThomasHoey](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@ThomasHoey](https://qa.fmod.com/u/ThomasHoey)\
**Post date:** [July 4, 2019, 11:50am UTC](https://qa.fmod.com/t/using-frame-look-ahead-to-beat-latency/14808/5 "2019-07-04T11:50:23Z")

</div>

thanks cameron!

i’ll fiddle around with these things and test.

cheers  
thomas

---

<div class="post-metadata">

**Author:** ![nshooter](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/nshooter/32/562_2.png) [@nshooter](https://qa.fmod.com/u/nshooter)\
**Post date:** [July 24, 2019, 6:32am UTC](https://qa.fmod.com/t/using-frame-look-ahead-to-beat-latency/14808/6 "2019-07-24T06:32:52Z")

</div>

Are you still having this problem? I’ve tried all the methods described above, and I still have significant latency in fmod events that isn’t present in unity’s audiosource sounds.

---

<div class="post-metadata">

**Author:** ![ThomasHoey](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@ThomasHoey](https://qa.fmod.com/u/ThomasHoey)\
**Post date:** [August 30, 2019, 10:09am UTC](https://qa.fmod.com/t/using-frame-look-ahead-to-beat-latency/14808/7 "2019-08-30T10:09:36Z")

</div>

hey! sorry for the slow response. we’ve stuck with “frame lookahead” to solve it in the end. getting the event to look ahead by 5 frames was good enough for us. i substituted the sfx noise for a kick and substituted the music for a metronome to fine tune it.

best of luck!
