ADXTutorials

Composing Adaptive Music in AtomCraft

This post explains how to implement interactive music in your game with AtomCraft.

 

Music in Video Games

In our recent implementation posts we have talked a lot about sound effects. However, a complete interactive audio experience only comes together with music. The music is equally important as it conveys emotion and helps telling a story.
Unlike movies, games are a nonlinear media. It means that your game music needs to be adaptive in order to accommodate the interactive nature of the medium. In other words, your game music needs to be fully interactive to follow what is happening in the game due to the player’s actions.
From the very beginning, the music must be written with game interactivity in mind. Indeed, it is critical for the composer to understand the basics of adaptive music in order to successfully create assets that can be used in the game. Fortunately, AtomCraft provides a set of features that empower the composer and allow him to create interactive music very easily.
In this post, we will explain how to leverage AtomCraft’s features to implement compelling interactive music in your project. Let’s dive into it!

 

Adaptive Music Implementation in AtomCraft

To be able to successfully create interactive music with AtomCraft, there are four key features that you will need to understand: Blocks, Beat-sync, AISACs and Selectors.
This graphic demonstrates a basic interactive music workflow using ADX2. In this example, the composer creates interactive music using these four key features. The integration in AtomCraft can be easily done by the composer himself or any other team members working on the project. At runtime, the game will send data to the ADX2’s engine which will adapt the music in real-time according to the action.

Blog Picture_Samurai Music_Diagram_Interactive music

 

Working with Blocks

ADX2_IM_02

There are many powerful ways to implement interactive music with AtomCraft. Let’s start with the Block playback system. Blocks allow you to organize your Cues in vertical sections that can be played in a different order depending on the game context. They are a bit similar to the pattern-based systems you can find in some sequencers.

Blocks have a lot of benefits:

ADX2 - IM - TAB1

Step by Step

Step 1: Change the display units of the timeline to bars and beats.
• Start by opening your Cue
Right-click on the ruler and select [Timebase Settings]

ADX2_IM_03

• In the [Timebase Settings] window, choose Bars/Beat

ADX2_IM_04

Step 2: Create Blocks in a Cue.
• Right-click on the timeline and, in the context menu, select [New Object].

ADX2_IM_05

• Chose [Create Block].
A new Block appears at the top of the time line

ADX2_IM_06

• Create more Blocks for your music

ADX2_IM_07

Step 3: If you like, change the color of your Blocks to organize them.
• Right-click on a Block and select [colour settings].

ADX2_IM_08

Step 4: Add your music
• Create a Track per instrument or per type of music loop.

ADX2_IM_09

• Simply drop the loops on the right tracks in the appropriate Blocks.

ADX2_IM_10

Step 5: Define the Block’s behaviour.
• Double-click on a block to open the properties pane.

ADX2_IM_11

Here we can rename the Block or change its duration.

ADX2_IM_12

The Block destination corresponds to where the playback jumps when the Block has finished playing or has reached a transition point.

ADX2_IM_13

There are 3 types of transitions available:
The first one is [None]. It will stop the playback at the end of the block. The 2nd one is [Next Block]. The Block will transition to the next block. The 3rd one is [Block Destination]. The Block will transition to a block from a list of our choice.
• If you select 3rd option, the [Block Destination Setting] window will appear.

ADX2_IM_14

Here we can add or remove destination Blocks and chose among 4 types of transitions. For instance, if we chose [Sequential] and select a Block as destination, the Block will transition to the selected block at the end of the playback. If we chose [Random] and insert all the available Blocks, it will transition to a random Block at the end of the playback.
Let’s go back to the Block properties pane.
Here we can define the number of times the block should loop before transitioning. Enter either -1 for an infinite loop or the actual number of loops to perform.

ADX2_IM_15

The [Block number of divisions] setting divides the Block in intervals at which transitions can occur.

ADX2_IM_16

For instance, if we have a 4 bars music loop, set the division number to 4 and select [Division] for the [Block transition timing], the Block will wait until the 1st beat of the next bar before transitioning to the destination Block.

ADX2_IM_17

Step 6: Add transitioning Tracks if needed.
It is possible to play a specific Track only when transitioning (end or beginning of the transition).
• Create a Track and add a transition segment at the end of a Block.

ADX2_IM_18

• Right-click on the track and in the context menu, select the [Block Transition Playback Type] and chose [Playback Transition].

ADX2_IM_19

The Track now appears differently to indicate that it will only be playing during transitions.

ADX2_IM_20

 

Working with Selectors and BeatSync

The second feature in AtomCraft that allows you to easily integrate interactive music in your game is called a Selector. Selectors are variables that can take several predefined values called Selector Labels. At run-time, the Cues will check the value of Selector and only play the tracks that are associated with the appropriate Selector Label. Here, we will use Selectors to make the music change according to the game action. We are also going to introduce the BeatSync feature in this section.

Blog Picture_Samurai Music_Diagram_Selector Labels

There is a Cue type of in AtomCraft, specifically designed for music tracks using Selectors, called “Track transition by selector”. Unlike other Cue types, when the selector label is changed during playback, the Track will transitions and crossfade automatically to the Track with the matching selector label. It means that music tracks can be easily switched depending on the game context and it can be done with minimum resource consumption. It is also possible to change the music tracks in sync and at specific timing (e.g. only on the 1st beat of every measure of a 4-bar loop).
A transition by Selector has a lot of benefits:

ADX2 - IM - TAB2

However, a Cue of type “Track transition by selector” has also many restrictions. Therefore, this Cue type must be specified when it is created and cannot be changed afterwards.
Restrictions:
• You cannot register multiple Waveforms to one Track
• You can only place the Waveform at the start time of the Track (00:00:00)
• You cannot use sequence Markers with this type of Cue
• It cannot be used in conjunction with the block feature
• You must set a selector label to each Track (each selector must be different)
• You cannot set random playback timing to a Waveform region
• You cannot use the Subsequence and the CueLink functions
• You must set the Beat-Sync information
• Sampling rate must be the same for each Waveform

Step by Step

Step 1: Create the Cues
Right-Click on a CueSheet, select “New Object” and click “Create Cue Track Transition by Selector”.

ADX2_IM_21b

Step 2: Create a Selector and Selector Labels
The first thing we need to create is the Selector. In the Global Settings section of the project tree, right-click on the Selector Folder, select “New Object” and then click on “Create Selector”. The Selector will appear and we will rename it “Music”.

ADX2_IM_22

Now we need to create the Selector Labels. Right-click on the Selector, select “New Object” and then click on “Create Selector Label”. A new Selector Label will appear and we will rename it “Navigation”. We need to create one Selector Label for each of our music track (Navigation, combat …)

ADX2_IM_23

Step 3: Assign your Selector Labels
To assign a Selector to a music Track: click on the Selector tab, specify which Selector to use and select a Selector Label.

ADX2_IM_24

Step 4: Add your music
Simply drag and drop your music on the right track.

ADX2_IM_25

Step 5Create the Beat Sync Parameter
The BeatSync feature allows for a seamless transition between music tracks, while staying in sync with the tempo and/or the beat divisions. It is also possible to change the volume in sync with the beat during playback.
To insert a BeatSync Parameter: right-click on the timeline, select “New Object” and choose “Create BeatSync Parameter”.

ADX2_IM_26

ADX2_IM_27

Finally specify the start time, BPM and select on which beats you want the music to change.

ADX2_IM_28

Step 6: Adjust the crossfading
Click on the cue track and set the fade in and fade out time.

ADX2_IM_29

Step 7: Listen to the result and adjust the parameters.
It is possible to test the implementation in the Session Window. To open the Session Window: select your Cue, click on the “View” menu and open the Session Window.

ADX2_IM_30

Click the play button and change the Selector Labels to transition between tracks.

ADX2_IM_31

 

Working with AISACs

The last feature in AtomCraft that allows you to implement interactive music in your game is called AISAC.
AISAC is a system allowing the control of audio parameters by values coming from the game. This kind of feature is also often called Real-time Parameter Controls (RPC or RTPC) by sound designers. In AtomCraft, it is possible to use this feature to implement interactive music. In that case, the game will send a value to the Cue which will then change the music in real-time in order to make it follow the action. For instance, with AISACs it is possible to fade-in and out music layers depending on what is happening in the game.

ADX2_IM_32

Transitioning with AISAC offers a lot of benefits:

ADX2 - IM - TAB3

Step by Step

Step 1: Create an AISAC Control
First we need to create an AISAC Control in order to make the link between the game and the AISACs. An AISAC Control is simply an identification name that allows the programmer to pass a value from the game to ADX2 so that it can be mapped to an AISAC curve.

Blog Picture_Samurai Music_Diagram_AISAC

To create an AISAC Control: go in the Global Settings section of the project tree, right-click on the AISAC-Control Folder, select “New Object” and then click on “Create AISAC-Control”.

ADX2_IM_33

Let’s simply name it “Music”.

Step 2: Create AISACs
To add an AISAC to your first music layer: select the Track, click on the “+” button in the AISAC pane and select “Add AISAC”.

ADX2_IM_34

A window called “Add AISAC” will appear, allowing you to associate a parameter with the new AISAC control. Select your AISAC Control “Music” and choose the “Volume” Graph type.

ADX2_IM_35

Step 3: Once the window closed, the AISAC tab is selected in the FX / AISAC panel at the bottom of the main window and a default line is drawn. We can now draw our volume curves. Simply click on the line to add points and drag them to shape the curve (you can also type in the values directly in a pane on the right).

ADX2_IM_36

To change the curve type of your AISAC: simply right-click on a dot.

ADX2_IM_37

Step 4: Repeat the same process for all your music layers.

ADX2_IM_38

Step 5: Listen to the result and fine-tune your AISACs.
Play the Cue and while the music is looping drag the AISAC cursor from left to right in order to hear the AISAC affecting the music. Finally, adjust your volume curves accordingly.

ADX2_IM_39

 

Demo project

To listen and look at some examples of interactive music implementations, we have created a small AtomCraft project that you can download below:

[This project requires AtomCraft version 2.27 or higher]

In this project, we simulate a game with 4 states:

Blog Picture_Samurai Music_Pic

The music was made and implemented to accommodate a simple gameplay sequence in which the player has to navigate and fight enemies. First, the navigation music will play and if the player encounters an enemy the music intensity will start to increase.

You will find 2 Cues named Blocks and AISAC. With these 2 Cues, we demonstrated the implementation of interactive music using the some key features we have explained in this post: Blocks & AISACs.

Using the AISACs (click on the picture to watch the video)

ADX2_IM_40

Using the Blocks (click on the picture to watch the video)

ADX2_IM_41

This concludes our post about the ADX2’s interactive music system. Let us know if you want to learn more about a specific ADX2 feature!