Work in progress Fledgetone is still being built, so things may change or break.

Learn Lesson 10

Game music that reacts

Advanced35 minutesOpen the studio beside this page

Game music can't just play from start to finish, because nobody knows how long a player will stay in one place. It has to loop, change when something happens, and get busier as things heat up. In this lesson you'll take a starter, turn its sections into states and add a third, choose how the music moves between states, set up intensity layers and stingers, hear it the way a game will play it, and export it for your engine.

Open a song

  1. Open File › New… and click Plaza. It's 104 BPM in A minor, with two sections marked on the ruler: Verse (bar 1) and Montuno (bar 9).
  2. Name the sections for the game: double-click the Verse flag on the ruler, type Explore and press Enter; do the same for Montuno, naming it Danger.
  3. Open Game › Game panel (states, intensity, stingers). The Game tab opens in the bottom panel, in three columns: states and transitions, intensity, and stingers with the exports.

Any song with markers works the same way. See Game music in the guide for every control.

Markers are states

Each stretch between two markers is a state: one loop the game can ask for. Explore runs 8 bars, but its second half (with the guiro joining) feels like a journey, so make it a state of its own.

  1. Click the BAR.BEAT.TICK readout, type 5 and press Enter. The playhead jumps to bar 5.
  2. Press M to drop a marker there.
  3. Double-click its flag on the ruler, type Travel and press Enter.

The Game tab now has three state buttons: Explore, Travel and Danger.

Switch between states

  1. Click Explore. It plays and loops bars 1 to 4. The playing state is green.
  2. Click Travel. The button pulses amber while it waits for the next bar, then the music moves there.
  3. Click Danger, then Explore again.
The States column of the Game tab: three state buttons, Explore, Travel and Danger, with Explore lit green as the state playing, and the switch timing menu set to on the next bar.
Every section between markers is a state. Click one to play it; the playing state is green.

The menu at the top of the column (on the next bar) sets when a switch with no rule of its own happens: the next bar, the next beat, or at once.

Choose how states hand over

  1. Click Transitions under the states. A matrix opens: rows are the state you come from, columns the state you go to.
  2. Click the cell in the Explore row and Danger column and set it to Fill.
  3. Click the cell in the Danger row and Explore column, set it to Crossfade, over 8 beats.
  4. Click the cell in the Travel row and Danger column. Set it to Bridge, on the next phrase, of 4 bars, and 2 bars: a turn, then the pull.
The transition matrix: rows for Any, Explore, Travel and Danger, columns for each state. Explore to Danger is a Fill, Danger to Explore a crossfade, and Travel to Danger a 2-bar bridge on the next 4-bar phrase, open for editing below.
The transition matrix: Travel to Danger set to a 2-bar bridge on the next phrase.

Here's what your three rules do:

From → toRuleWhat you hear
Explore → DangerFilla snare fill over the last beat, then Danger
Danger → ExploreXF 8Danger fades out as Explore fades in, over 8 beats
Travel → DangerBridge, 2 bars, next phrasewaits for the end of a 4-bar phrase, then plays two bars that lead into Danger's opening chord

The bridge is written from your song: its last bar is the dominant seventh of the chord Danger opens on, the chord that pulls hardest into it, and the bar before turns into that. It plays on the song's own chords, bass and drums. Any cell that shows a dash has no rule and cuts on the next bar; a rule in the Any row applies from every state that doesn't have its own.

Layer the intensity

Intensity is one number, 0 to 100%, that a game turns up as things get exciting. Each track belongs to a stem group, and each group has a curve for how loud it plays at each intensity.

  1. In the middle column, set Nylon guitar to Ambient with the list beside it. (The percussion is already in Percussion and the trumpet in Climax.)
  2. Click Explore to play, and drag Intensity down to 40%.
  3. Drag it slowly up to 100% and back while the music plays.
The Intensity section: a slider at 40 percent, each track with its on switch and stem group (Ambient, Climax, Tension, Percussion, or none), and a curve per group showing how loud it plays at each intensity.
Stem groups and their curves. The dashed line is the intensity now.

At 40%, Ambient (the guitar) plays at full level, Percussion at 80%, and Climax is silent. Higher up, the percussion reaches full level, then the trumpet comes in near the top, while Ambient eases back to 60%. Drag a point on a curve to move it, click empty space to add one, double-click a point to remove it. The bass has no group, so it always plays at full level.

Add stingers

Stingers are short cues the game plays over the music: a coin, a checkpoint, a win.

  1. Open + Add a stinger… at the top of the right column and choose Checkpoint. Add Item found and Victory the same way: the little game below uses them.
  2. While the music plays, click Checkpoint. It plays on the next bar, in the song's key.
  3. Click the dice beside it for another version, and pick another sound from its instrument list.
The Stingers column: the new Checkpoint, Item found and Victory stingers, each with an instrument, another-version, put-on-timeline and delete button, then Export stingers and the game kit exports: For, Export game kit, Try it in a game, Audition like the game, the web runtime kit and FMOD / Wwise package.
Stingers, and every way to take the music into a game.

Loop variations

A player who waits in one place for five minutes hears the same loop over and over. Loop variations (in the middle column) makes takes of the loop region with a different ending each.

  1. Click Travel, so the loop covers bars 5 to 9.
  2. In Loop variations, choose 3 takes and click Export.

You get take A as written, B with a snare fill into the loop point and C with a tom fill, all the same length, for the game to rotate through.

Audition like the game

  1. Click Audition like the game in the right column. It renders every state, stem, stinger and transition exactly as the game kit will (it takes a little while).
  2. Click the big Explore pad, then Travel, then Danger. Every switch follows your matrix, crossfades and the bridge included.
  3. Fire the stinger pads, drag Intensity, and try the Effect buttons, such as Underwater and Low health.
Audition like the game: big pads for the Explore, Travel and Danger states, smaller pads for the stingers, the Effect buttons (None, Underwater, Muffled, Low health, Dream) and an Intensity slider.
Audition like the game plays the states the way the game kit will.

Try it in a game

  1. Close the audition and click Try it in a game. A little 3D level opens with your song.
  2. Walk with the arrow keys or WASD, and grab coins. Coins fire your Item found stinger.
  3. Walk towards the cube guard. When it spots you the music switches to Danger through your Fill, and intensity rises as it gets closer. Jump on it with Space to beat it.
  4. Click Music wiring: it shows what each moment plays, guessed from the names. Win (stinger) is on your Victory; pick another to change it, then press R to restart and beat the guard again.
Try it in a game: a small 3D field with a little orange robot in the middle, coins around it and a purple one-eyed cube guard at the top. The panel at the top left shows three hearts, the coins, the music state playing and the intensity; Music wiring is open on the right.
Try it in a game: walk the robot about and hear the music react.

Two more games are at the top of the window. Click 2D platformer to run and jump to a flag past gaps, spikes and blobs: a blob that spots you switches the music to Danger the same way. Click Rhythm game and your song's own notes fall down four lanes; hit D F J K in time, on Easy, Normal or Hard. It's a quick way to hear whether a beat is fun to play along to.

Export for your engine

  1. In the right column, choose what the kit is For: Godot 4 project (unzip into it), Unity project (unzip into it), or Any engine (web, Godot and Unity players).
  2. Click Export game kit (.zip).

For Godot, unzip it into the folder with project.godot, open bos_music/<song>_example.tscn and press F6: number keys switch states, Up and Down change intensity, Space plays a stinger. For Unity, unzip it into the folder with Assets, add an empty GameObject, choose Add Component › Adaptive Music Example and press Play. Either way you get every state as a seamless loop, the stems by group, the stingers and transition sounds, an audio_manifest.json with the curves and rules, a player script, and a README using your own state names.

Working in audio middleware instead? Game › Export FMOD / Wwise package… lays out the same music with a script that builds the event in FMOD Studio or a Music Switch Container in Wwise. The game kit and FMOD and Wwise guide sections list every file.

What's next

You've made a song a game can steer: three states, transitions with a written bridge, intensity layers, stingers and loop takes, tested in a real level and exported. Next, finish and share your music: Export, share and finish.