Synchronizing SFX and Music

Some types of gameplays – for instance puzzles – are perfect to explore the relationships between sound effects and music. In this post, we will describe two implementation techniques in AtomCraft for music-driven sound effects. We will synchronize the sound effects to the music both time-wise and frequency-wise.


Let’s start by preparing the music by creating a Cue of type “Track Transition by Selector”. This type of Cue will allow us to smoothly switch Tracks during playback via a Selector, using fading transitions and beat synchronization.

In our case, we designed 3 short loops in different keys (C, F and A).  After creating a Selector called “Music_Key” and three Selector Labels named C, F and A; we add three tracks to our Music Cue, and opt for the Selector for the Switch Variable. We assign the Selector Labels to each Track, and finally drag and drop the loops onto the corresponding tracks.

01 Music Transition Cue

It is now possible to switch between the different keys, simply by changing the value of the Music_Key Selector. Depending of the content of your loops, you may also want to set up Fade-In and Fade-Out times in the Track Transition properties of your Cue.

Moreover, to ensure that the switch always happens on a beat, we create a Beat Sync Parameter object on the timeline of our Music Cue. In our example, we set the tempo to 100 bpm. In the Beat Pattern tab of the Beat Sync properties, it is possible to select exactly on which beats the transitions are allowed to occur (here we chose the 1st and 3rd beats).

02 Beat Sync Parameter

From now on, if we try to change the value of the Selector during playback, the run-time will wait for the 1st or 3rd beat to trigger the transition to another track.

Sound Effects

On the sound effect side, let’s create some Bonus / Power Up sounds. They will be played on the beat and their key will change accordingly to the music. To spice it up a bit, for each key we set up 3 variations in a Combo Sequential Cue. This will allow us to create a progression when the player picks up several Bonuses within a short amount of time. As we have 3 tracks, we set the Combo Loop Back parameter to 2 in the Cue’s Special Playback settings. We also adjust the Combo Interval (between 1500 and 2000ms in our case).

This means that each time the player grabs a Bonus less than 1.5 seconds after the previous one, the next track of the Combo Cue will be played. Once the third track is reached, it will be played for each subsequent bonus, until the Combo is reset. For more information, you can check this blog dedicated to the Combo Sequential Cue.

03 Combo Cues

The next step is to create a Switch Cue, on which we drop the Combo Cues (one for each key, on a different Track).  On the music side, we will use our Music Cue and the Music_Key Selector to switch between the tracks. Again, we need to select the Music_Key Selector for the Switch Variable, and then assign each label to the corresponding Track.

– – Addendum: From version 3.46.06, it is recommended to use Sub-Sequences (of type Combo Sequential in our case) instead of Cue Links inside the Switch Cue if you plan to link that same Switch Cue to an Action as we explain afterward. Both projects are available in the archive linked at the end of the article to reflect this change – –

04 Switch Cue

Note that to play our sounds on the beat, we cannot use the Switch Cue directly, but we have to go through an Action. For example, here we create a new Cue called SFX_Bonus_Cue, as well as an Action Track, and we add a Start Action on this Track. Then, we can drop our Switch Cue directly on that Track to link it to the Action.

Now, if we play the SFX Bonus Cue alongside the Music Cue, it will trigger the sound effects on the beat (it will follow what you set for the Beat Sync Parameter in the Music Cue). Then, when we switch to another key using the Selector, both Music and SFX will follow!

05 Action Track


Leave a Reply

Your email address will not be published. Required fields are marked *