Long Form

* This article was a “featured post” on the Gamasutra Blog.

article

Game Audio Starter Kit: Tips, tutorials and code samples to get you started

Want to start learning how to design adaptive audio for games?

Here’s what I did. Some project links, tips & code examples.

Around a year ago I was working a job that I didn’t like. It wasn’t in audio and it wasn’t going anywhere so I took the plunge and quit. I moved on to a job as audio post for the soon-to-become-infamous ESGN TV, an eSports broadcaster who flamed out after only five months of broadcasting. This left me in the interesting position of having some insolvency insurance money coming in and a whole lot of time on my hands, so I decided not to look for another job and instead to spend the time training myself to work with procedural audio.

But where to start?

Start with some hypothetical projects

  • Sound Replacements are “Meh”

The most common way of creating some hypothetical work seems to be taking an existing trailer / gameplay clip and recreating the audio for it. I have a couple of major problems with this concept. However, to be positive first: it is a way to show your ability with mixing, asset creation and creativity. Make sure that you are creative. When I was doing sound replacements I made sure to NEVER listen to the original audio. I found that I would get the original audio in my head and thus basically force myself into making “creative” decisions just to get away from what the original designer had done. What I really enjoyed, although it was slightly nerve racking, was, once I’d finished my clip and finally listened to the original, comparing where I had made the exact same decision as the pro designer and where I had come to a different conclusion.

Sunset OD Mine: https://youtu.be/d0wBzXGh5bw

Sunset OD Original: https://www.youtube.com/watch?v=cOSnhhWcukk

So while there are positive aspects to doing an audio replacement; my issues with the format are simple:

  1. You are putting your work up against the best and most experienced designers that the industry has to offer. Chances are you’ll come out second best here.

  2. You are creating a linear audio track.

  3. You are only fighting half the battle because you are not implementing.

So I decided I needed to find some ways to do some “sound replacements” and other hypothetical projects either in engine or in middleware to simulate working on a non-linear game job.

These are the projects that I found. I will give a quick overview about what my purpose was, what resources I used to learn the required skills and any pros & cons of the project. Where possible I’ll also provide links for the programs and project files you will need, some code snippets and anything else that might help.

LIMBO – Wwise Implementation

https://youtu.be/V9yg6K-Swfo

LIMBO is a game by Danish developer Playdead. They kindly cooperated with Audiokinetic (makers of audio middleware Wwise) to give out the final Wwise project file for the game. This was released for a competition but it is still about so you can download the game demo, Wwise, and the Wwise project file for free and get stuck into doing a sound replacement.

https://www.audiokinetic.com/limbo-redux-contest/

You have a couple of options when approaching this sound replacement. The easy option is to find the existing audio files in the project and simply swap them out for your own assets. However I would challenge you to uncheck the existing containers in the state or event you want to edit and implement your own sounds in your own containers. This project can look a little daunting, but here are a couple of tips:

1) Connect the game and the session (check the Wwise Limbo manual) and play the game while using the profiler window in Wwise to see what is going on.

2) In the Project Explorer / Audio open the following path: Actor-Mixer / ambience / state ambience / AMBIENCE / amb_sws_start / amb_sws_start_falling_eyesopen

This is the state that governs the ambient sounds playing when you first start the game and find the boy lying on the ground.

If you have problems with Wwise look for the tutorial “Project Adventure” that comes included on download. That is a truly brilliant tutorial and will give you all the knowledge you need to get started with Wwise.

The trickier part of attempting this Limbo sound replacement is that all of the connections between Wwise and game are already set in stone (as far as I understand). So you may have ideas of sounds or implementations that you simply cannot achieve. Still, a great way to work on one of the best sounding games ever made using industry standard middleware.

IN ENGINE / MIDDLEWARE IMPLEMENTATION

The Unity game engine is now free to use for projects with a budget under $100k and seems to be growing hugely in popularity, particularly on indie projects. It also works in basically the same way as Unreal engine meaning that learning one will enable you to be proficient on either. Although not essential knowledge for an audio person, this is probably just something that you should know your way around.

However you probably don’t want to learn enough to build your own whole test game just to do sound for it. (If you do, this tutorial is simple and awesome: http://addcomponent.com/unity-3d-fundamentals/)

So this is what I suggest.

Unity Asset Store – Complete Projects

Unity has an Asset Store where you can download free or paid assets as well as some whole projects. I found these to be the perfect sandbox to test audio implementation. The other benefit with working in engine is that when finished you can publish a playable build on your website rather than just having a youtube vidcap of you playing. (That said you should do both. Make sure it is easy for people to view your work. Chances are they’re busy.)

Unity Implementation (Bootcamp)

https://youtu.be/mt8hEjDkeOI

Bootcamp is a 3rd person shooter demo. I essentially approached this project as a straight audio replacement; removing the existing sound effects and replacing them with my own assets. The main change that I made to the implementation was to add some pitch and volume randomisation to the character footsteps. I am not in any way a programmer but with a bit of help from my friend google I managed to hack together some code to achieve that. Here is the code I used:

In the “footsteps” script I added a private variable:

private var soundEffectPitchRandomness = 0.15;

and for each “if” clause I added a command to vary the pitch by a random amount defined by the private variable:

audio.pitch = Random.Range(1.0 – soundEffectPitchRandomness, 1.0 + soundEffectPitchRandomness);

FMOD Implementation (Nightmare)

https://youtu.be/jdJUfxNbLNs

Nightmare is another complete project on the Unity Asset store. This one’s a survival shooter. I wanted to test using middleware (FMOD Studio) and connecting this with Unity. As mentioned I am no programmer, so this took a lot of trial and error. For the most part I applied lessons learned from this great tutorial series by Indiana University about implementing FMOD audio using the roll-a-ball demo.

http://www.indiana.edu/~audioweb/gqaudio/fmod-unity-00.html

The tutorial explains how to connect FMOD and Unity using the free package from FMOD including code examples and links to download everything you need.

Unity 5 Sample Assets Project – Fabric Implementation (Particles)

https://youtu.be/EbGHkKpqqZk

Unity’s latest release, Unity 5, comes with its own demo project called “Standard Assets Demo Project.” This comes with a number of very useful scenes featuring first-person, third-person, cars, planes – all sorts of good stuff to play with. The particle scene caught my eye / ear.

I had wanted to try out the Fabric plug in for Unity by Tazman Audio ( http://www.tazman-audio.co.uk/) which provides a tool set of audio tools that are implemented in the Unity engine. I recommend this tutorial by Anastasia Devana which shows how to install the Fabric plugin and some basic tips on how to use them: https://www.youtube.com/watch?v=joV2LpShX14

The scene I had the most fun with was the explosion. Here’s a couple of things I focused on.

1) I used the new audio mixers in Unity 5 to attach side chain compression to the box sounds so that they duck under the explosion sound. This ensured that, no matter what sound the boxes made, the explosion itself would always punch through cleanly.

2) I wanted to add some variation to the sounds that the boxes made as they fell. There are such a large number of them, but the player can easily just interact with only one, so each one needed to make a sound. I varied the priority of each of box so that, when you destroy a stack, not all the boxes will sound at once. I also used a bit of code from the roll-a-ball demo mentioned above that added volume variation based on the velocity of each impact.

First add a private floating variable:

private float velToVol = 0.8F;

*(0.8F is an adjustable multiplier that you will need to adjust to taste per your sound effect)

Then add the following equation to the OnCollisionEnter command:

float hitVol = coll.relativeVelocity.magnitude * velToVol;

Unity 5 Sample Assets Project – FMOD Adaptive Music Implementation

The next core skill that I think is important to demonstrate is implementing a simple adaptive music score that is procedurally affected by in game parameters. I’m not a composer so I collaborated with a very talented friend of mine (http://www.michailcomposer.com/) to produce a score that increased in intensity. I set it up in FMOD Studio with one parameter named LevelIntensity that migrated through the score as the player progresses through triggers inside the level. I found this tutorial incredibly useful for setting up the FMOD session: http://blog.soundguychris.com/2014/04/28/an-introduction-to-fmod-part-3/

In Unity I used the 3rd Person Controller scene in the Sample Assets Project, and in the maze portion of the map I added trigger colliders across areas that where I wanted to send a parameter control from Unity to FMOD. Communicating between the two programs is difficult so I will try to briefly explain my method.

  1. Use tags on the Trigger object in Unity. I named mine iTrigger.

  2. Add a C# script to the player controller:

Add the following code:

FMOD.Studio.EventInstance iTrigger; //name the event instance

FMOD.Studio.ParameterInstance musicIntensity; //name the parameter instance

void Start ()

{

iTrigger = FMOD_StudioSystem.instance.GetEvent(“event:/YOUR_FMOD EVENT_NAME”); //pull up your FMOD event

}

void OnTriggerEnter(Collider other) //when the player passes through a trigger collider

{

if (other.gameObject.tag == “iTrigger”) //check if the collider is tagged with iTrigger

{

iTrigger.getParameter (“LevelIntensity”, out musicIntensity); // call the parameter called LevelIntensity in FMOD

musicIntensity.setValue(xf); //set the LevelIntensity value to x

}

}

I found this code by doing a lot of googling followed by a lot of testing. Excuse the cliche, but “the answers are out there.” If you look hard enough you’ll find a way to acheive whatever result you want. If you’ve slogged your way through this article you certainly have the determination it takes. If I can help further please drop me a line at ali@hellolooklisten.com or ali_LookListen on Twitter.