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

Chris Robinson chris.kcat at gmail.com
Sun May 22 12:11:52 EDT 2022


On Sunday, May 22, 2022 6:26:05 AM PDT Roland Pl├╝ss wrote:
> Let's say I have a room of roughly 7x4m size. In the middle of the room 
> there is a sound source playing the sound of some kind of engine/motor 
> hence a looping, uniform sound. Since it is in the middle of the room 
> the sound source is 3.5m away from the door. The listener is located in 
> the door hence 3.5m away from the sound source. The volume of the source 
> is set to 1, reference distance to 1 and roll-off to 1. At the door the 
> sound is pretty much inaudible. That's what I got right now.
> 
> The sound file is normalized with peak gain at 0db. Audacity measures 
> the RMS as -13.74 db. This would be a mean volume of roughly 0.2. 
> Physically this would be 1/d = 0.2/3.5 = 0.057, hence roughly 6% volume. 
> This would explain why it is kinda inaudible at the door. Now what 
> values would you say are required to be used in OpenAL to make this 
> sound work? From the RMS value I would say the volume would need to be 
> scaled by 4.89 but OpenAL clamps this. If I use the attenuation rule 1/d 
> with 1=4.89/d then d=4.89 . Reference distance = 4.89?

OpenAL clamps it after distance attenuation. If you set the gain to 4.89, it 
will first be calculated as 4.89 * (1/3.5) = 1.389, and that then gets 
clamped, so the final mix gain ends up being 1. Setting the reference distance 
will have the same effect: 1 * (4.89/3.5) = 1.389, which gets clamped to 1. 
The sound will play at full volume at that distance, regardless of which way 
you do it. The listener would have to move away by another 1.3 meters before 
the volume starts going down at the usual rate of half gain per doubling 
distance.




More information about the openal mailing list