# Mixing in unity game engine



## Kaufmanmoon (Feb 1, 2016)

I know there's a few people on here who work in games.

Hoping to find someone who might have had experience working with Unity and its audio mixer, mixing sound fx and music in the engine. (not wwise or Fmod)
As Unity doesn't have a limiter (from what i've read) Has anyone come into problems when multiple fx are triggered at the same time?

No problems at the moment but want to be ready should this problem suddenly come up and punch me in the face!

I'm aware of the LUFS levels and have been implementing/checking along the way
Any help appreciated.


----------



## Jerome Vonhogen (Feb 1, 2016)

Kaufmanmoon said:


> I know there's a few people on here who work in games.
> 
> Hoping to find someone who might have had experience working with Unity and its audio mixer, mixing sound fx and music in the engine. (not wwise or Fmod)
> As Unity doesn't have a limiter (from what i've read) Has anyone come into problems when multiple fx are triggered at the same time?
> ...


 

I've been using "Master Audio: AAA Sound" by Dark Tonic for a while. It has all the sound management and real-time mixing features you will ever need for your game, which is much more than the game engine Unity itself has to offer.

You can buy the asset for $30 in Unity's Asset Store. It's excellent value for money. There are other popular audio managers in the store as well, but I have no experience with those assets.

Good luck!

- Jerome Vonhögen


----------



## Jerome Vonhogen (Feb 1, 2016)

By the way, the price of $30 is a limited time offer (i.e. 50% discount).

Here's a link to the asset store:
https://www.assetstore.unity3d.com/en/#!/content/5607

- Jerome Vonhögen


----------



## benatural (Feb 1, 2016)

Problems such as the audio game clipping because of too many sounds playing at the same time? 

If you're using Unity 5 there are a couple of things you can do. You can set up side chain ducking so your sounds can be less loud overall. You can also try the Audio Compressor Effect on the master bus. See if you can set it to have a very high ratio, like 10:1, which is basically a limiter at that point.


----------



## Jerome Vonhogen (Feb 2, 2016)

benatural said:


> Problems such as the audio game clipping because of too many sounds playing at the same time?
> 
> If you're using Unity 5 there are a couple of things you can do. You can set up side chain ducking so your sounds can be less loud overall. You can also try the Audio Compressor Effect on the master bus. See if you can set it to have a very high ratio, like 10:1, which is basically a limiter at that point.


 

I wouldn't recommend using the compressor effect on the master bus. Unity's audio options are limited and time consuming. Unless you are getting payed by the hour, just buy an audio management asset.

In 'Master Audio: AAA Sound' you can group the individual sounds in a scene (or those triggered by the interaction with a specific game object), and then set the maximum volume for that group. You can even group busses this way. You can still set individual soundlevels for each sound, and your settings will work throughout the entire game if you don't use separate (sub-)projects for isolated scenes. There's no scripting involved either, since all available options work as prefabs which have pretty accurate sliders. It's Playmaker compatible as well, in case you really need to use scripts.

- Jerome Vonhögen

P.S. I'm not involved in the development or marketing of Dark Tonic's asset, I just like the tool.


----------



## Kaufmanmoon (Feb 2, 2016)

benatural said:


> Problems such as the audio game clipping because of too many sounds playing at the same time?
> 
> If you're using Unity 5 there are a couple of things you can do. You can set up side chain ducking so your sounds can be less loud overall. You can also try the Audio Compressor Effect on the master bus. See if you can set it to have a very high ratio, like 10:1, which is basically a limiter at that point.



Ben, the compressor was something I had thought of also, we have programmers on the team who could implement this easily if I tell them what settings. 

Jerome, thanks for the advice, I'll certainly read more into that asset.

Would be great to hear from anyone else who has used the compressor as a limiter in unity, I really should be writing this on a unity forum I guess.


----------



## Jurek (Feb 2, 2016)

+1 for "Master Audio". It´s really helpful!

Also, be sure to experiment with spacial placement settings for sfx. The default settings in Unity are way too extreme ... depends on the nature of the game and on the platform, of course.


----------



## Kaufmanmoon (Feb 2, 2016)

My worry is I think they might be too far down the line with audio implementation in the engine to use master audio.
I may be wrong.


----------



## benatural (Feb 2, 2016)

If you do get a 3rd part plugin, just make sure you read the license terms. It's $30 per seat, which means if you integrate it into your Unity project, it will cost $30 for every person on the team that uses the editor, whether they actively use the plugin or not.

Mixing audio with stock Unity can be a challenge, but there are things you can do to help. Make sure you keep your sounds categorized into subfolders in the project hierarchy: i.e. ambiences, emitters, character sounds, game object sounds, etc should all be grouped together. Think of those folders as you would a submix. Then what I'd do is master all of your audio assets to the same reference level and allow for plenty if headroom, -18 LUFS for example. Take a couple sounds from each category once they've been mastered and bring them into your DAW. Play the sounds together, and balance each sound category until you get the mix you want. 

Then you can do one of two things. 1. take those relative volume levels and apply them to your mix hierarchy in Unity. Mixers are saved uniquely with each scene, so it'll save you some time if you build your mixing desk and routing first and then save that entire collection as a prefab. That way you only build your mixer once, which makes it easy to propagate into all of your game's scenes if there are more than one. Once you have your default mixer, recreate your DAW mix decisions in Unity. It isn't a perfect solution, but it will save you time.

Solution 2. would be to batch process your asset groups using the values you defined in your DAW. Take your mastered files, and copy them into a new folder somewhere outside the project, and mirror your Unity project audio folder structure. Them batch process each group, and export them into thr correct folder in your project. You'll need something like Sound Forge, Audition, or Reaper to do that. Save each batch process as a preset so you easily come back to the assets later. Solution 2 is fiddly and can be time consuming, but certainly less time consuming than not organizing at all.

However you do this, the key is to be organized.


----------



## Kaufmanmoon (Feb 3, 2016)

benatural said:


> If you do get a 3rd part plugin, just make sure you read the license terms. It's $30 per seat, which means if you integrate it into your Unity project, it will cost $30 for every person on the team that uses the editor, whether they actively use the plugin or not.
> 
> Mixing audio with stock Unity can be a challenge, but there are things you can do to help. Make sure you keep your sounds categorized into subfolders in the project hierarchy: i.e. ambiences, emitters, character sounds, game object sounds, etc should all be grouped together. Think of those folders as you would a submix. Then what I'd do is master all of your audio assets to the same reference level and allow for plenty if headroom, -18 LUFS for example. Take a couple sounds from each category once they've been mastered and bring them into your DAW. Play the sounds together, and balance each sound category until you get the mix you want.
> 
> ...


Great post, thank you.
Part one of your solution fits in to my way of thinking. I'm interested though, did you use ducking or a compressor in unity at all to protect yourself from going over 0dbfs?

I'l be using the standalone Nugen Metering VisLM plugin to help me with lufs master levels out of unity which will help immensely.
So at least I'll


----------



## benatural (Feb 3, 2016)

The first game I shipped was with Unity 4 which didn't have mixers or mix states. We had something on the order of 10-15k assets? I've worked with Unity 5 which does have those features, but our game isn't suited for use with the mixer because of the way we load assets (not per scene but on game objects). To answer your question, no we never had any overage protection, we just built in lots of headroom and hoped for the best.

One thing I can say about solutions like VisLM is they're great for getting you in the ballpark, but I've always found you need to go through an listen to each asset and compare them to a reference. Things like dynamic range and frequency domain can vary wildly depending on how you author your sounds, and this can make it tricky to automate.

Something I forgot to mention above is that it's also critical that you maintain a strict naming convention that mirrors your subfolder hierarchy. Keep it simple and consistent. The best way to achieve this is by utilizing filename prefixes so that your assets sort properly (i.e. like assets sort together) while in the same folder. This will help you mentally while organizing your mind around your mix. Also, if you go the route of mastering your assets first, I recommend maintaining a mirror of your project hierarchy as a backup. Unmastered originals go into that folder, and get exported out of it into your Unity project folders while maintaining the same structure. Many batch processing applications allow you to specify your relative path which will mean that shouldn't have to maintain the file structure in Unity because the batch processor will do it for you as part of the batch.


----------

