Game Dev Cheat Sheet

Unity Audio Volume Calculator

Convert between linear gain, decibels and a quadratic slider position. Preview the curves and grab engine-ready code.

Convert linear gain to decibels and try a quadratic volume slider: gain = slider value squared. This curve gives finer control at low gains; it does not measure perceived loudness. How loud playback sounds also depends on the recording, output level and listener.

Volume Converter

0.5000
-6.0 dB
0.7071

Volume Curves

LinearDecibel (normalised)Quadratic slider position

Example Gain Presets

Code Output

audioSource.volume = 0.5000f; // Linear
// Or using AudioMixer (dB):
audioMixer.SetFloat("MasterVolume", -6.0f);

Reference Table

dBLinearSlider positionDescription
01.0001.000Unity gain (no attenuation)
-30.7080.841Gain reduced to 70.8%
-60.5010.708Gain reduced to 50.1%
-100.3160.562Gain reduced to 31.6%
-200.1000.316Gain reduced to 10%
-400.0100.100Gain reduced to 1%
-600.0010.032Gain reduced to 0.1%
-800.00010.010Display floor (not digital silence)

Frequently asked questions

Why does 0.5 linear volume not sound half as loud?
A gain of 0.5 halves the signal amplitude and corresponds to approximately -6.02 dB. It does not establish a fixed percentage of perceived loudness; perception depends on the sound and listening conditions.
How do I convert linear volume to decibels in Unity?
Use 20 * log10(linear). For an AudioMixer Volume parameter, expose it and call audioMixer.SetFloat("MasterVolume", Mathf.Log10(linearValue) * 20f). Be sure to clamp linearValue above 0 (e.g. 0.0001f) to avoid log10(0) returning negative infinity.
Should I use AudioSource.volume or AudioMixer for game volume sliders?
Use AudioMixer with exposed Volume parameters. It gives you music/SFX/voice grouping for separate sliders, snapshot transitions, and applies effects per group. AudioSource.volume is fine for one-off effects but does not scale to a full audio system.
Does the slider measure perceived loudness?
No. The quadratic slider maps its position to linear gain using gain = position squared. The decibel value expresses that gain relative to unity gain. Neither is a measurement of the loudness of a recording.

Last updated: