# Synchronisation between 2 musical events

**URL:** <https://qa.fmod.com/t/synchronisation-between-2-musical-events/16273>\
**Category:** FMOD Studio\
**Created:** [October 9, 2020, 11:10am UTC](https://qa.fmod.com/t/synchronisation-between-2-musical-events/16273 "2020-10-09T11:10:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bettersly](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@bettersly](https://qa.fmod.com/u/bettersly)\
**Post date:** [October 9, 2020, 11:10am UTC](https://qa.fmod.com/t/synchronisation-between-2-musical-events/16273/1 "2020-10-09T11:10:44Z")

</div>

Hello,  
I try to do something in FMOD for a game i work on, maybe someone could help me :  
I have a music event and a jingle event, both are on the same tempo. Is there a way to synchronize them together in fmod (when i win/lose the jingle start like it’s the same music, no lag, no gap, and then i go back to music perfectly synchronised) ? I could to that if i have the music and the jingle in the same event but i have about 10 musics and a lot of jingles (and the jingles events are often build with many small musics, effects, loop etc) …  
Is there a way to do this in FMOD ? Or do i need to manage this outside FMOD, and ask to developer to find a solution (the developers works on their own game engine using a small part of DearImgui).  
Thank you !  
SH

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [October 13, 2020, 3:25am UTC](https://qa.fmod.com/t/synchronisation-between-2-musical-events/16273/2 "2020-10-13T03:25:45Z")

</div>

You should be able to do this using event instruments or just a single instrument if your jingle is a single rendered audio file. Try one of these three setups:

- Place the jingle in an instrument that spans the music event in its own track. Set the instrument to be asynchronous, and set the trigger behaviour to trigger the instrument on a certain beat when the parameter conditions are met. An example is below:  

- Use quantized transition regions to transition to a “jingle” destination marker to play the jingle, then a transition marker at the end of the jingle to transition back to the main music. If you need to return to where you left off, this requires a bit more of a setup, so let me know if you wish to go this route.

- If needs be, you could also use game code to pause the music event and play a jingle event. To quantize this, you can use callbacks to get when the music event lands on a beat before pausing. Using this method lets you start the music again from where you left off.

---

<div class="post-metadata">

**Author:** ![FoxyMusic](https://avatars.discourse-cdn.com/v4/letter/f/a4c791/32.png) [@FoxyMusic](https://qa.fmod.com/u/FoxyMusic)\
**Post date:** [October 13, 2020, 6:28am UTC](https://qa.fmod.com/t/synchronisation-between-2-musical-events/16273/3 "2020-10-13T06:28:47Z")

</div>

Riachard, are there any plans to add ADHSR functionality to event Pause?

---

<div class="post-metadata">

**Author:** ![bettersly](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@bettersly](https://qa.fmod.com/u/bettersly)\
**Post date:** [October 13, 2020, 8:06am UTC](https://qa.fmod.com/t/synchronisation-between-2-musical-events/16273/4 "2020-10-13T08:06:18Z")

</div>

Hello Richard,  
Thanks you for answering. 🙂  
I’ve just tried the first setup, and it seems to work pretty well. I tried with instrument event for my jingle and nested event for the music with async setting (to loop under the jingle) and it works (i think), i have to test in game.

 ![Capture d’écran 2020-10-13 à 10.02.45](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/c/c307bf3ac439a6d8d0e46c1a13f6f618e08584d8.jpeg)  
For the second solution, i’ve already try something like this, but after i play the jingle it always return to the beginning of music… so i yes if you can explain me the setup it would be nice !  
And for the third, i will talk with the programmer , probably it should be the more safe.

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [October 16, 2020, 1:54am UTC](https://qa.fmod.com/t/synchronisation-between-2-musical-events/16273/5 "2020-10-16T01:54:55Z")

</div>

The second solution requires you to use game code and callbacks to get which position you are at in the event’s timeline. You can then store this information in a “last position” variable when the parameter conditions for transitioning are met, before using `event::setTimelinePosition(lastPosition)` to jump back to this position once the jingle has been played.

For an example of using callbacks, take a look at the `music_callbacks` example in the Core API examples.

---

<div class="post-metadata">

**Author:** ![bettersly](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@bettersly](https://qa.fmod.com/u/bettersly)\
**Post date:** [October 20, 2020, 6:40am UTC](https://qa.fmod.com/t/synchronisation-between-2-musical-events/16273/6 "2020-10-20T06:40:46Z")

</div>

Thank you very much, i’ll tell the programer about this solution !

I will try to feedback here which solution we choose, and how it works in game.

---

<div class="post-metadata">

**Author:** ![Adrian66](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Adrian66](https://qa.fmod.com/u/Adrian66)\
**Post date:** [November 8, 2020, 5:33pm UTC](https://qa.fmod.com/t/synchronisation-between-2-musical-events/16273/7 "2020-11-08T17:33:42Z")

</div>

> [@FoxyMusic](#):
>
> Riachard, are there any plans to add ADHSR functionality to event Pause?

I hope too this thing!!

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [November 10, 2020, 6:09am UTC](https://qa.fmod.com/t/synchronisation-between-2-musical-events/16273/8 "2020-11-10T06:09:36Z")

</div>

Sorry I missed this message @FoxyMusic @Adrian66

Due to the way that pausing an event works, there currently aren’t any plans to implement ADHSR functionality to the pause event.
