Is there a standard way of combining multiple volume controls.
The multiplication of several "volume" coefficients is a good place to start; It makes the most sense to multiply these floats because they represent a linear coefficient for something. But you should know that these coefficients are not directly representing loudness, they are coefficients for the energy/voltage level in the sound device.
this gives me a pretty steep volume curve near lower numbers.
The loudness of a sound (what we perceive) has a non-linear relationship to the energy (voltage) used to make the sound. When you pass 0.5
to the sound card it will create a sound at 50% of its max voltage, but that will not be half as loud as 1.0
and 100% voltage. The actual relationship from energy to loudness is rather complicated but most software approximates it with a formula like loudness = log10(volume)
or loudness = sqrt(energy)
.
You should be choosing the playbackVolume
and assetVolume
with this non-linear relationship in mind:
- If
playbackVolume
scales with distance from the player you need to consider whether the "energy" of the sound drops off linearly or non-linearly with distance.
- If
assetVolume
is predetermined and you want a specific asset to sound twice as loud as something else you'll need to review your volume numbers in "loudness" terms.
- When you provide a slider in your settings UI for the user to adjust your
globalVolume
it should be a non-linear slider too. Use a formula like globalVolume = sliderValue^2
.
Hopefully after addressing all of these considerations the simple product of your volume floats becomes a lot more usable and starts sounding correct.