[openal] Attenuation Roll-Off problems (too silent)

Chris Robinson chris.kcat at gmail.com
Fri May 20 23:05:47 EDT 2022

On Friday, May 20, 2022 5:40:23 AM PDT Roland Pl├╝ss wrote:
> That does not sound very usable. I've created my game engine to be 
> predictable to avoid trial-and-error. I'm also using CPU ray-tracing to 
> do a form of aurealization. Messing with roll-off and reference-distance 
> makes this difficult.
> Let's get back to the conversation example. When a person is standing 
> across the room then I can not set the volume to 4 or more to make it 
> audible. This would mean the person speaks as loud as a car engine or 
> something similar. This also means whenever a person moves you have to 
> adjust the gain to make it louder when further away.
> There has to be a sane way to set this value in a physically plausible way.

It depends on the volume of the sound itself. You can't just take a random 
audio file, apply a generic reference distance and gain, and expect it to 
always sound correct. The only way you could get away with a generic reference 
distance and gain on sources is if the sound itself is authored at a proper 
volume. So if the sound of a person speaking is too quiet with the reference 
distance and gain you set, you need to alter the sound itself to be louder.

Although that can run into issues with resolution/bit-depth since some sounds 
need to be loud but not clip when stored, while others need to be much quieter 
relative to it, which reduces the available dynamic range. For example, having 
the sound of an airplane compared to a footstep on grass/dirt, if you want the 
airplane sound to be heard from far away while not clipping, you would have 
trouble making the footstep sound quiet enough to use the same reference 
distance and gain.

At best, you could probably get away with using a particular reference 
distance and gain for particular types of sound (e.g. voices use one reference 
distance and gain, cars use another, planes use another, etc), then balance 
the sound file given the sound type. As long as a given type/category of sound 
should be roughly at the same volume.

In any case, though, you need to know what kind of sound you're dealing with 
to set a proper reference distance and gain for what the sound is. If you 
don't know what the sound is, OpenAL can't automatically make it sound right.

More information about the openal mailing list