Audio Levels in Unity

Zero-Knowledge-Proof
7 min readApr 7, 2021

Hi everyone I’m venturing on writing this first publication since I had been searching for specific info on this topic and couldn’t find anything at all, it is kind of surprising how scarce detailed information is on this matter both on the Unity site/manual and on the web in general (I know, who cares about audio in a game? duh), so I had to put up some tests to get to some, hopefully useful, conclusions.

Full disclosure, I am no Unity expert whatsoever and I am probably missing something here (if you happen to know what I’d appreciate if you could let me know), still I went on to do some tests to get my own understanding on how levels on the Unity Mixer and a couple of effects work so, hope this helps anyone looking for the same answers as me or if you find I’m writing nonsense here, again, help is much appreciated.

As said above this only focuses on the Mixer (Master Mixer) and channel effects, nothing to do with scripting or adding sounds to your scene which I saw there is already enough information out there so it assumes there is already sounds on your scene that you can play with.

Problem

I have been working on a game where you have let’s say one channel for Music and another one for Sound FX and while trying to level them out I was struggling to understand what the meters were actually telling me mainly because being on the digital realm I was expecting a 0 dBFS as the top value and while I understand this is a VU meter it didn’t make quite complete sense to me how it was measuring and what it was doing to de sound when taking up the volume… also I wanted to check what all those percentage and float values to determine volumes were actually doing.

Fader on the Audio Mixer

To make sure I had a proper track to use as a reference I went on to create a single-tone track and leveled it up to 0 dB using my DAW, as you can see on the SpectrumAnalyzer’ level meter the peak volume is 0 dBFS but the RMS level (on the red lines) is -3dB (which is ok due to the nature of the sine wave https://theproaudiofiles.com/amplitude-and-loudness/). Keep this in mind as it will come back over and over later.

Creation of 432 Hz Tone at 0 dBFS Peak (-3 dBFS RMS)

Mixer Meters

With this in hand I went to Unity and started playing with it, first I just played it straight on to the scene from an Audio Source at level 1. All good here, first clue, the meter on the Master fader shown below gives us the RMS value and not the peak value like the Default master meter on my DAW would for example.

Playing tone with everything at Default value (1 on Audio Source volume, 0 on the faders)

The point above is important because as soon as I took up 0.1 dB the Music_Settings fader I started getting distortion on the signal even if the meter showed it still at -2.8 dB… 1.0 dB up and it sounds already like a square tone but the meter still shows -2.0 dB… Although the distortion is pretty noticeable what is important to mention is that it is not a digital clipping distortion like it used to be on old DAWs and I believe it has to do with floating point processing (https://medium.com/@dannyanthony/the-advantages-of-a-floating-point-system-in-a-daw-b45fd9a4efc2) which is very good in case your audio ever gets above 0.0 dB.)

Audio Source Volume Level vs Mixer Meter

Good news here, the volume level changes the value in a logarithmic way which means that values like 0.708 and 0.501 would result in a reduction of -3 dB and -6 dB respectively. This is important to know in case you think you want to “take the level to half volume” well, now you know for sure it is not 0.5 or even more important if you are already at 0.6 and you want to halve that it won’t be 0.3, instead the proper value would be around 0.45 since you only want to take -3 dB from the current level (from -7.4 dB to -10.4 dB).

Another good example could be when playing two sounds of equal level at the same time causing distortion when summed up, then you know you can just halve both at 0.7 and they won’t be louder than their original level (this is actually going to help me on what I wanted to achieve later leveling out Sounds and Music playing at the same time).

Levels registered on the Mixer Meter while changing the Volume value on the Audio Source
Two Audio Sources playing the same 0 dBFS (peak) audio at the same time with Volume at 0.708 (-3 dB)

Compressor

You might’ve noticed that the compressor is lacking Ratio and Knee settings which are typical for compressors… I tried it for a couple of scenarios but I stopped using it because I noticed the compression was super hard and very destructive… reason is it actually works more like a brick wall limiter. Whatever value you put on the Threshold it seems like it will never be passed, I tried a couple of sounds and never heard (nor saw) this pumping effect above the threshold reason why I started using the “Duck Volume” effect as a compressor.

Compressing the 0 dBFS (-3 dB RMS) tone with a Threshold of -10 dB resulting on a -13 dB level

Duck Volume

Although the main use of a Docking effect is to use it as a side-chain compressor with signal from another channel this one happens to have this setting called “Sidechain Mix” that at 0% would react only to the signal getting in the channel it is ON instead of from another channel (it just needs to have a Send signal attached to it). Anyways, using this Sidechain Mix can come in handy if like in my case you are trying to Duck the music with the Sound Fx but the level of the Sound FX isn’t always enough to trigger the effect, you can add a bit of the music signal itself to keep you barely on the limit of the Threshold.

Using this as a compressor gives you the chance to tweak values of Ratio and Knee which I was missing on the compressor. After a few tries I can say that I actually liked its performance. Although I intuited what the percentage value (%) meant on the ratio I wasn’t completely sure, long story short, yeah, the percentage is equivalent to the Ratio:

  • 100% means a Ratio of 1:1 so it won’t do anything, 200% equal to 2:1 and so on.

Just as a refresher (for myself), a 2:1 Ratio means that after the Threshold every 2 dB will actually only be able to “push” 1 dB of signal, meaning that the higher the ratio it will take more “effort” for the signal to push 1 dB at the end so…

If our Tone Signal is at 0.0 dB (-3.0 dB RMS as shown on the meter) and we pick a Threshold of -9.0 dB it will mean that our Tone effectively can get 9.0 dB above threshold so if we then set our Ratio at 200% (2:1) it will tell us that after -9.0 dB it will take 2.0 dB of signal to actually push 1.0 dB so it will only manage to push 4.5 dB which in turn means it will attenuate our signal for the remaining 4.5 dB… making our meter show -7.5 dB…yes, the meter showing us RMS instead of Peak values makes it a bit trickier but it works well.

Example 1 — Ducking (compressing) our Tone signal @ -3 dB with a Ratio of 2:1

Another example would be if we take down our “Music_Settings” signal let’s say -3.0 dB then we select a Threshold of -6.0 dB with a Ratio 300% (3:1). First our signal will have the “ability” to push not to 0.0 dB peak but only to -3.0 dB (-6.0 dB RMS on the meter) since we took down the Attenuation fader. If the Threshold is set at -6.0 it means our signal can only “push” 3.0 dB above Threshold, with a Ratio of 3:1 it means the signal can actually only push 1.0 dB above -6.0 dB so we are to expect the signal to reach the value -5.0 dB (although it will show -8.0 dB on the meter due to the RMS-Peak difference)…

Example 2 — Ducking attenuated Tone signal with Ratio 3:1

Cheers!

--

--