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);AudioComponent->SetVolumeMultiplier(0.5000f);
// Or in dB:
float Linear = FMath::Pow(10.0f, -6.0f / 20.0f);audio_player.volume_db = -6.0
# Or linear:
audio_player.volume_db = linear2db(0.5000)Reference Table
| dB | Linear | Slider position | Description |
|---|---|---|---|
| 0 | 1.000 | 1.000 | Unity gain (no attenuation) |
| -3 | 0.708 | 0.841 | Gain reduced to 70.8% |
| -6 | 0.501 | 0.708 | Gain reduced to 50.1% |
| -10 | 0.316 | 0.562 | Gain reduced to 31.6% |
| -20 | 0.100 | 0.316 | Gain reduced to 10% |
| -40 | 0.010 | 0.100 | Gain reduced to 1% |
| -60 | 0.001 | 0.032 | Gain reduced to 0.1% |
| -80 | 0.0001 | 0.010 | Display 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: