[openal] Attenuation Roll-Off problems (too silent)
Chris Robinson
chris.kcat at gmail.com
Thu May 19 18:34:47 EDT 2022
On Thursday, May 19, 2022 6:22:57 AM PDT Roland Plüss wrote:
> I'm still trying to figure out why the attenuation in OpenAL is not
> working properly.
>
> According to the documentation a roll-off of 1 is the default or
> "natural". If I use this though and I have let's say a sound source a
> couple of meters above ground (think of an airplane or similar) with
> gain set to 1 then it is pretty much inaudible a couple of meters below
> on the ground. I tried setting the gain like to 10 but this does not
> help much. I ended up using a roll-off of 0.05 to make the sound audible
> on the ground.
Airplanes are very VERY loud when their engines are running. A gain of 10 is
only +20dB, whereas I'd start thinking in terms of +60dB to +100dB (gains of
1,000 to 100,000) or higher[1]. OpenAL will clamp a source's gain to
AL_MAX_GAIN (default 1) after applying distance attenuation to the source
gain, so you don't need to worry about blowing out your users' ears if they
manage to get close to such a sound source, but these are the kinds of levels
needed for very distant sounds to remain audible.
[1] https://aviation.stackexchange.com/a/50507
It's also important to set the source's AL_REFERENCE_DISTANCE property
properly, along with the source's AL_GAIN. The reference distance specifies
the distance where the source is as loud as specified by the gain (which is
relative to the actual sound in the buffer). How to set the properties in that
case will depend on the actual sound recording and the distance it's meant to
simulate at full volume.
More information about the openal
mailing list