ADXTutorials

Generative Ambient Music

Background music can often be heard for hours while playing a game. To fight repetitiveness and avoid player fatigue, generative music techniques can be used. In this post, we will design a basic generative system using Atom Craft.  In this implementation, all the notes will be dynamically generated out of selected scales.

Assets Creation

First, we will create two types of instrumental sounds: long synth pads for the ambient bed, on top of which shorter notes (e.g., plucked strings or mallet percussions) will be played. In both cases, it is recommended to apply a long delay or a pronounced reverb effect, so that the sounds have a long tail, making it easier to blend them together. Of course, it does not have to be baked at this stage, and can also be done by using Atom Craft’s own effects later.

The main idea is to pick some interesting scales for the mood of your game, and then generate single notes following these scales. In Atom Craft, the scales will be played in a random order and the notes will be adjusted accordingly. Let’s prepare our assets:

  • Choose a set of scales (4 in our case, but it can be more)
  • From each scale, play 5 single notes lasting 1 or 2 bars with the long synth pads.
  • Then, on the same scales, play 8 single notes with the short sound.
  • Edit and export all notes individually, then import everything in Atom Craft.

Implementation

It is now time to start the implementation in Atom Craft.

  • Create 4 Random no Repeat Cues (one for each of our 4 scales) for the pad sounds.
  • Do the same for the short notes.
  • Drag and drop all the Materials (pads and shorter notes) on their respective Cues.
  • Create an extra track in each Cue and leave it empty. Playing a silence now and then will help us generate rhythmic variations.
  • In the Inspector, simply change the Random Weight for that track to 90.

01 RandomNoReapetCues

The long note Cues are used to set up the tempo on which the notes will be triggered:

  • Create a BeatSync parameter at the start of these four Cues.
  • For all of them, change the BPM to 150 and the Numerator to 8.
  • Then, disable two beats of the Beat Pattern of each Cue (different ones).

02 BeatSync

In order to trigger the notes in sync with the tempo, an Action must be used instead of a regular Cue:

  • Create 8 new Polyphonic Cues (4 long notes and 4 short notes).
  • Insert an Action Track and then add a Start Action at the beginning of the Cues.
  • Link the actions to your note Cues by dragging and dropping them onto the Action tracks.

03 Action Track

Finally, a global Cue will be used to trigger all the Actions:

  • Create a Polyphonic Cue called Sequence. Change its Time Base settings to Bars/Beats at 150 BPM.
  • Create 4 Blocks with 13 bars, corresponding to our 4 scales.
  • Set the Block Transition Destination Type property to Specify Block Transition, and change its Specification Type to Random No Repeat.
  • Add all the Blocks to the List of Block Transition Destinations so that each Block can randomly transition to any other Block.

04 Blocks

 

  • Create two tracks, one for the long notes and the other for the short notes.
  • Drag and drop the Action Cues on their respective tracks at the beginning of each Block. This will create Link Cues.
  • In order for the notes to be triggered several times, in each block set the Auto Repeat Number property to -1 in all Link Cues (for infinite repetition).
  • Change the Auto Repeat Interval to 2300 for the long notes, and to 1000 for the short ones. These values don’t have to be very precise, as the BeatSync parameter will force the notes to be triggered on the next beat anyway.

05 Cue Links

And that’s it! Once the Sequence Cue is triggered, the long notes will be played, generating chords against which the short notes will play, using the same scale. In its current state, the system can generate out-of-tune sounds during the transitions. If that is something you want to avoid, it can be fixed by adding more specific Block Transitions when switching from one scale to another. The project below should give you a good starting point for experimenting and creating more complicated generative music systems.