I’m trying to make a decibels measurer for PlaybackLoudness, but I’m not sure what it’s measured in. Anybody have any ideas?
Each person’s computer will play at a different volume based on the sound’s Volume setting, if it’s 3D then how close the person is to it, their Roblox volume setting and their computer speaker volume.
It’s not really possible to represent it in decibels to any accuracy or meaning, so just pick your own arbitrary max and min to map it to.
If you know a fire alarm is around 85 decibels as an example, and it has a peak PlaybackLoudness of 1, and you’re playing it at a Volume of 1, then you could map it such that 1 = 85.
I uploaded sine tones at varying dB levels and got this data set for PlaybackLoudness:
name avgPL [minPL, maxPL]
"Sine 440Hz -42dB" 4.01207 [3.80988, 4.20081]
"Sine 440Hz -36dB" 8.01309 [7.69351, 8.34262]
"Sine 440Hz -30dB" 16.0222 [15.408, 16.6337]
"Sine 440Hz -15dB" 90.287 [87.8928, 93.5365]
"Sine 440Hz -12dB" 127.749 [126.512, 128.951]
"Sine 440Hz -9dB" 180.488 [178.629, 182.209]
"Sine 440Hz -6dB" 255.007 [252.595, 257.655]
"Sine 440Hz -3dB" 360.337 [356.977, 363.637]
"Sine 440Hz -1dB" 452.16 [441.918, 459.156]
"Sine 440Hz 0dB" 506.108 [499.293, 511.763] (distorted and probably less than the expected value)
I plotted it and the formula seems to be playbackLoudness = 2^(decibels / 6) * 512
, or playbackLoudness = 2^(decibels / 6 + 9)
. It doesn’t match all points perfectly but it fits within [min, max]
and seems the least arbitrary. We can solve this to get decibels = math.log(playbackLoudness) * (6 / math.log(2)) - 54
.
Another formula that seems close is playbackLoudness = 10^(decibels / 20) * 512
, but I prefer the first one.
A similar problem is how to convert between Sound.Volume
and decibels. I recorded sounds playing at varying volume levels, measured it, plotted it, and came up with decibels = math.log(volume) * (6 / math.log(2))
, or volume = 2^(decibels / 6)
. This matches my plot points perfectly and is consistent with the PlaybackLoudness formula.
I was having trouble balancing sound loudness in my project and was baffled by the Sound.PlaybackLoudness
documentation that just says it’s a number between 0 and 1000. Hopefully this helps anyone with the same problems.