How is Volume Attenuation Calculated for 3D Sounds?

Hello, I am trying to find a way to calculate 3D Sound Volume Attenuation. The Sound instance has a lot of properties that also affect this “calculation”, such as Sound.RollOffMode, Sound.EmitterSize, etc. I’m trying to calculate this applied volume attenuation; however, I haven’t been able to find any resource that explains all the variables and calculations used to get the result. The Roblox Developer Hub seems to take a glimpse at some of the variables used and the conversions (i.e. converting the studs to meters which are based on SoundService.DistanceFactor), but nothing much else.

Thanks!

2 Likes

The default RollOfMode is called Inverse so I think it may be using the Inverse square law for the calculation.

Combine with this to calculate decibels (for sound pressure level):

decibels = math.log(sound.Volume) * (6 / math.log(2))
or decibels = math.log(sound.PlaybackLoudness) * (6 / math.log(2)) - 54

The inverse square law for sound would be:
I = P/4πr² (I = intensity, P = sound pressure/power, denominator is sphere area)

I don’t know much if this would help you calculate sound attenuation the same way Roblox does it, but sound attenuation in an area with no reflective surfaces certainly works using the inverse square law.

While this may not be a direct answer to my question, it certainly does help point me into the right direction in calculating. Thanks!