0
\$\begingroup\$

I have a audio system where I want to be able to control the playback volume of sound effects, music, dialouge etc.

Currently my set up has three Volume settings [0-1].

  • The playback volume specified when the audio begins playing.
  • The asset's volume.
  • A volume from the settigns menu.

I'm currently combinign them simply as playbackVolume * assetVolume * globalVolume, but this gives me a pretty steep volume curve near lower numbers.

Is there a standard way of combining multiple volume controls.

I would rather not use an Audio Mixer for this as we have a custom audio system.

\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ You may wish to augment the simple model for gameplay reasons, for example increase the volume of shots when someone is shooting directly at you - in reality there probably wouldn't be that much difference in volume from a shot at you vs 20 degrees off, however it's more important for a player to know someone is aiming at them. This just one example another example would be increasing the drop off for ambient noise, but having much less drop off for key story items/areas. \$\endgroup\$
    – DavidT
    Commented Sep 3 at 22:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .