Like A Girl

Pushing the conversation on gender equality.

Code Like A Girl

First Steps with FMOD and Unity

Making Video Without A Videocamera — Part 3

Meet Ethan. He’s a standard Unity player character with a hip hairdo.

This may seem a bit odd, but I’m not going to talk a lot about videos in this article — please bear with me, it’s all still related to my quest to make music videos without a video camera!

I recently had a piece of music accepted for inclusion in a mobile game The Way of the Bubble, which is close to its Beta release. I’d provided a single, fixed track, but many games have music which changes according to the game play. I wanted to learn more about this side of composing for games and to learn the technical side of integrating music into a game. So when a heavily discounted Udemy course on game music composition cropped up, I went for it.

The Game Music Composition Course

The course is broader than I need: it doesn’t assume any prior composition or music production experience. It therefore includes music theory basics and an introduction to using a Digital Audio Workstation (DAW), the programme where you create your music. I decided to follow through the whole course anyway, as I don’t know the Fruity Loops DAW that is demonstrated and a little theory revision won’t hurt. I was also unsure if skipping lectures would affect earning the course certificate. This means I have quite a few extra video lectures to get through, but you can vary the playback speed up to 2x to get through familiar material quicker. If only online catchup TV had this option for the adverts!


The main benefits for me are in learning the FMOD music automation software and being introduced to the Unity ‘game engine’. Unity is one of the main design environments used by indie game developers and can also be used to make animations. Both are available as free downloads.

I like the idea of making a game that I could use to make a video by ‘filming’ it on my screen with Quicktime, as I already tried with simple animations in Processing 3 (see Making Video Without a Videocamera Parts 1 and 2). It could also be a fun ‘extra’ for a fan of my music to own such a game, even if it’s quite a simple one. At this stage, my ideas seem rather over-ambitious, but I’m keen to at least find out more!

Unity screen layout showing FMOD menu


FMOD is described on the course as ‘middleware’ — a piece of software that allows existing programs to talk to each other. In this case, the middleware is allowing your DAW to talk to Unity, albeit fairly indirectly. FMOD doesn’t appear as a plug-in in your DAW. You do, however, import an FMOD ‘package’ into your Unity project, which adds an FMOD menu to the project’s screen and FMOD objects to the Unity project’s assets.

So how does it actually work? First, you compose different sections of music in your DAW, according to the different scenarios or actions in the game-play. For example, picking up treasure will make the player invincible for a few seconds, and you want this to be reflected in the music.

Overview of game music composed in the Logic DAW. Green regions are normal music sections; purple are transition sections; there will be 3 alternative versions of the transition following the Chaos region section, using different combinations of the tracks.

You export these sections of music from the DAW just like normal music, but then pull them into FMOD to add in automation. Here, you set up the parameters that you use from within a game to trigger the different sections of music, e.g. an “Invincible” parameter for switching the invincible music on.

You can also set up how the different sections of music for different game events will transition between each other so that the sound doesn’t change or stop abruptly. You might want the music to finish playing the current section before changing, or switch at the end of the current bar. You might want it to start in the middle of a new section then loop round to the start, or for it to fade in from the beginning, whilst playing a separate sound effect. FMOD can handle all this, and you can even add some variation with different alternatives for sound triggered by a game event. This is done by giving each of these music variations a probability of playing when the event occurs, or by rotating their schedule. No coding is needed for anything I’ve described so far, by the way, as it’s all done through the FMOD interface.

FMOD screen layout showing 3 loops for Exploring, Chaos and Battle regions, and the Invincible State music.

Integration with Game-play

When you’ve got the structure of the music programmed to do your bidding and the FMOD package in the Unity project, you can finally integrate the music with the game. The game composition course doesn’t teach you to design a game, or to write scripts for controlling game components, but it does include setting up a very simple game layout, to show how FMOD integrates with Unity and triggers sounds.

You can make music appear to come from any item in the game environment, but in the course we’ve used the player character, Ethan*, as the ‘sound emitter’, as the music is designed to change based on his location and state. So when he enters a battle zone, he will trigger the switch for the battle zone parameter that you have set up in FMOD and you’ll hear dangerous-sounding music.

Taking it Further

So far, so good, no coding — it’s all in the Unity GUI. But, if you want to make your invincible state work so that the player is protected inside the battle zone when he’s picked up the treasure, you will need to start writing scripts in C# or Java. This is outside the scope of the game music composition course, but there are other courses that will help with that. I’m currently working my way through the official Unity tutorial material for beginners on YouTube, which includes some coding in C#.

This is another language that’s new to me. It is initially very intimidating, as the Unity manual explains the syntax in a form of geek-speak that I haven’t yet managed to decode. But the C# in the tutorial examples seems quite a lot like the script used in Processing 3 so far — much of the syntax looks the same. The scripts also follow a similar approach, with standard routines like a frame update that you can place code in to make it trigger when the frame is about to be redrawn. It’s all object-oriented, so it looks like it will mainly be a case of getting to know what standard game components are available, what they are there for, and the ingredients each has. At least to start off with.

Progress so far

This is where I’ve got to with my ‘game’ — don’t worry, you’re allowed to laugh, it’s seriously basic! I’ve taken it slightly further than what is covered in the Udemy course, as I’ve set up the invincible parameter to trigger when the player enters the trees, added spinning cubes that the player collects to get points, and body-modded Ethan for personality. His head wasn’t that big before he worked with me, and he has some loud new glasses — the only part of his wardrobe I’ve successfully changed. Changing his outfit to green turned his entire body and head green, so I’ve parked that for future learning.

Eventually I’ll add in an enemy element and learn how to make Ethan die without falling off the edge of the play area. With a game-over message when he does. All very humble goals at this stage, I know, but I have a lot more learning to do.

By the way, if anyone reading this fancies having a go (and I hope you do) I’ll warn you it’s seriously time-consuming and rather addictive — perhaps more so than playing games themselves?

*Footnote: Ethan is the name of the standard Unity player character for games that are played as ‘3rd-person’. I haven’t found a way of creating a female player character yet — Ethan doesn’t seem to be gender-modifiable! Perhaps Unity has a standard female player character that I haven’t discovered yet?