dynamic music for procedurally generated 2D survival-horror


During the Winter of 2015-16, I spent some time exploring the dynamic music possibilities afforded by the new Unity 5 game engine, while reacquainting myself with the C language family. I altered one of the Unity 5 tutorials, a survival horror game with procedurally generated levels, altering some of the sprites, the level generation system, overhauling all sound effects, and routing my music through Unity's new audio mixer system. A crossfade between two simultaneously playing loops is triggered at the start of the fourth level, transitioning from relaxed to tense game states. I used audio mixer snapshots and the .TransitionTo method to do most of the work with crossfading.

the Unity 5 audio mixer

declarations/definitions in game manager script

simple test to trigger .TransitionTo

I initially composed the music in Spring 2015 for teaching the concept of dynamic audio in my Game Music course. It uses a totally conventional (and thus teachable) way to harmonically re-contextualize a pulse wave duet with a bass line in order to switch between relaxed and tense game states. The pulse wave duet works in both major, or its relative minor, and you can simply toggle back and forth by adding the appropriate bass line. The meter is intentionally ambiguous, allowing me flexibility in adjusting the speed of rhythmic activity. I also use timbral contrast to underline the game state transition as well, by running an NES chip sound emulator through amplifier and cabinent emulation, applying overdrive distortion.

relaxed music

tense music

The entire piece is meant to be modular, with each member of the duet optional, and an additional two layers that follow the same kind of harmonic neutrality to allow their re-contextualization. These layers could be toggled in relation to game states, but the current game simply doesn't have enough persistent states to warrant their use. For instance, there is no second player for triggering the lower member of the pulse wave duet, and there are no "power-ups" for triggering the arpeggiation filigree (or "ripple," to use the parlance of game composer Tim Follin). Those layers are presented successively here, as permanent fixtures of the music loop, rather than being triggered.

The initial idea with this music, and later its implementation in this game, was to create a dynamic music example that students with basic music theory and DAW skills can get a handle on immediately, and it now lives on in this little web app.

Try the Game Here (Use Firefox)