Dynamic Audio systems in Dieper & Deaper 01- Adaptive Music
I've decided to make a series of blog posts to explain some of the audio systems I designed for our game Dieper and Deaper (https://ldjam.com/events/ludum-dare/48/dieper-deaper). I hope this is of interest to some folks here!

The game is developed in Unity, using FMOD for all audio. It's a spy themed infiltration game, with a sort of Noir/60s spy movie vibe that informed a lot about how I composed the music.
I used a single FMOD event to play all the music in the game, with four separate parameters triggered in code to manage the system: Menu, Panic, YouLose and Filter. The event contains several music sections: a Menu loop, Gameplay loop, Panic transition, Panic loop, and a Loud Coda for the ending.

Menu Parameter
This one is quite self explanatory, as long as the Menu parameter is set to 1, the music sticks to a simple menu loop. If the value changes to 0, a transition is triggered at the end of the current 4 bar section into the Gameplay loop, keeping coherence. When the Menu parameter is set back to 1 at a later point (when the player quits back to the menu...), a similar transition is triggered back to the menu loop.
Panic Parameter
Because the game is about infiltration, the player has a meter that fills up when they are acting suspicious. We decided to musically emphasise the moments of panic when that meter is nearly full and the player is close to being caught. For this I created a faster, more intense section of music (235bpm instead of 140). The panic parameter is set to 1 when the suspicion meter is nearly full, triggering a transition into the Panic loop. This switch occurs at the beginning of the next bar (to react quickly in fast gameplay circumstances), and includes a short transitional drum fill (randomly selected from a set of 3 fills to avoid too much repetition). The drum fill bridges the gap into the new tempo, ensuring a smooth transition, and serves as a nice audio cue telling the player "Time to panic!". If the player successfully avoids capture, the meter falls back bellow panic levels, and a short faded transition back into the "calm" gameplay loop occurs.
YouLose Parameter
This is basically what happens when the game reaches a conclusion. I initially meant to create different variations for victory and loss, but I found that my "You Lose" music actually works well for all outcomes. When the player is caught, or finishes the mission, this parameter is set to 1, and the music jumps to this very short bombastic fanfare/coda section (with big drums and brass chords). Again, the switch is set to only occur at the beginning of a bar, to keep things smooth and logical. After the section has finished ringing, the music automatically goes back into the Menu Loop, ready to restart.
Filter Parameter
This is a simple Low Pass filter that creates that classic mufflied effect when the player hits pause. It's completely unnecessary polish in the context of a jam game, but I thought I might as well add it, as it's simple enough to implement.
Thanks for reading!
If anybody has any questions or remarks regarding FMOD or the system, please let me know in the comments! And of course, go check out our game "Dieper and Deaper" to hear the system in action!
You can also listen to a non-adaptive version of the music here:
https://soundcloud.com/pat-cleaver/dieper-deaper-ost








