Audio tutorial for Unity: the Audio Mixer

Learn how to use the Audio Mixer in Unity to create immersive audio experiences for your games. This tutorial covers everything you need to know. By Jeff Fisher.

Leave a rating/review
Save for later
Share

Using the Unity Audio MixerFrom the morning wake up call of a buzzing alarm, to the silent rumble of an air conditioner, sound surrounds us. Audio can make or break a video game and can provide a fully immersive experience for the player when done correctly. The Audio Mixer is a great aid in helping you achieve that.

In this tutorial, you’ll learn how to do the following:

  • Create an audio mixer.
  • Create groups, views, and snapshots for the audio mixer.
  • Route audio source signals to groups.
  • Send and receive audio from one group to another.
  • Add effects to groups.
  • Expose parameters for scripting in C#
Note: This tutorial assumes you know your way around the Unity editor, and that you have a basic knowledge of Unity Audio Sources. Check out some of our other Unity tutorials first if you need to sharpen your skills in Unity.

Getting Started

Before you dive into the world of Audio Mixers, Groups, and Sound Effects, it’s best to understand the basic types of sounds that you’ll see in games:

  • Music
  • Sound effects or SFX
  • Dialogue
  • Environment or Ambiance

Each of these categories can be broken down into several sub-categories. For this tutorial, you will focus on the above four categories.

Download the starter project here and extract it to a location of your choosing.

Open up the Starter Project in Unity. The assets are sorted inside several folders:

  • Audio: Holds anything relating to Audio.
  • Audio Manager: Holds assets needed to manage your audio in-game.
  • Environment: Contains environmental audio clips.
  • Music: Contains musical audio clips.
  • SFX: Contains various sound clips.
  • StarterAssets: Contains various assets that will help make this tutorial easy and fun! You will not have to go into this folder for this tutorial.

Open the MixerMayhem scene in the StarterAssets/Scenes folder.

Run the starter project. If everything went okay, you should be able to hover over each object, and they should each produce a unique sound when clicked on.

Creating an Audio Mixer

Right now, the audio in the scene is being played by Audio Sources on each of the objects. Jumping back and forth between all these individual Audio Sources to make changes or add effects to them can become quite a tedious process. Luckily, the Unity Audio Mixer is here to save the day!

To create an Audio Mixer, first make sure the Audio Mixer window is open. You will find it located under Window >> Audio Mixer or Ctrl + 8:

In the Audio Mixer window, create an Audio Mixer named MasterMixer by clicking the + located at the top right of the window.

Alternatively, you can create an Audio Mixer under Project Window\Create\Audio Mixer:

You should now have a blank Audio Mixer opened in your Audio Mixer window.

Here’s some explanation:

  1. Audio Mixers can be routed into an Audio Group of another Audio Mixer. All of your Audio Mixers are listed here.
  2. Snapshots contain the parameters of a specific state within the Audio Mixer.
  3. Groups are how the Audio Mixer knows to work its way up the hierarchy. Each group creates another bus in the Audio Group strip view.
  4. Views are visibility toggle sets that indicate what groups to show in the strip view.
  5. Edit in Play Mode will only appear during play mode, and will allow you to make changes in the Audio Mixer during play mode that will persist outside of play mode.
  6. Exposed Parameters allows any parameter within an Audio Mixer to be modified via code.
  7. Master Group is the default group within every Audio Mixer.

Creating Groups

An Audio Mixer Group is used by one or more Audio Sources to combine and modify their audio outputs before it reaches the Audio Listener in the scene. A Group will route its output to another Group if it’s a child of that former group. The Master Group will normally route its output to the Audio Listener only if its Audio Mixer doesn’t route into yet another Audio Mixer.

To create a new Audio Mixer Group, click the + located next to Groups in the Audio Mixer window. Name this group Music.

A new group named Music should appear in the Strip View. By default, each group has a few traits to go along with it:

  1. Volume slider lets you adjust the decibel or dB level of the sound.
  2. Mute button lets you mute all sound routed to that group.
  3. Solo button adds the group to a set of soloed groups.
  4. Bypass button ignores all effects on the group.
  5. Attenuation is the default effect on every group that controls volume.
  6. Add effects allows you to layer effects in any order that will alter the final output of the sound.

Add the following additional Groups:

  • SFX
  • Grenade
  • Sink
  • Radio
  • Environment

SFX should be under Master, while Grenade, Sink, Radio and Environment should all be under SFX. If your groups ended up in a different order, you can re-order them by dragging and dropping, just as you do with GameObjects in the Hierarchy.

It’s a good habit to color-code your Groups for the ease of readability. Do that now by setting the Master to Red, Music to Orange and all of the SFX to Cyan.

To change the color of a Group, simply right-click the Group in the Strip View and choose a color.

When finished, your Groups should look like this:

Setting up Views

With your Groups in place, you can now set up Views, which are visibility toggle sets that indicate which groups to show in the Strip view. Views become quite useful when there are many Groups.

When you created the Audio Mixer, an initial View called View was created. Change the name of that view to Everything, as this will be your main view of all of the Groups. Then create two more Views by clicking the + next to Views and name them Music and SFX respectively.

With the Music View selected, toggle everything Cyan off.

Then select the SFX View and toggle everything Orange off.

You should now be able to jump between all three views by clicking on their names in the View window, and the appropriate Groups should appear in the Strip View.

Jeff Fisher

Contributors

Jeff Fisher

Author

Gijs Bannenberg

Tech Editor

Chris Belanger

Editor

Sean Duffy

Final Pass Editor

Over 300 content creators. Join our team.