RollOffMode documentation

Fairly straight forward: The RollOffMode page has no visuals that describe how the different enumerations behave. I’m probably not the only one who opened that page thinking it would give me an idea on what to expect from every enumeration, but instead it just lists the names and their identities. What is a LinearSquare and what is an InverseTapered? I have no clue and I tried googling it with… mixed results.

Fortunately someone linked me this page which does an alright job explaining a few of these things, but it would be helpful if the wiki page I linked could have some visuals similar to the EasingStyle page so I don’t have to rely on 3rd party documentation for these things.

16 Likes

I just got sidetracked with a bug because I didn’t realize EmitterSize (aka MinDistance) influenced the rate at which the sound decayed in the Inverse mode. Thanks @Zomebody for that link.

We could still use some better documentation… so I’m bumping this.

1 Like

I’m knocking this back up. I am also requesting for visuals regarding the behaviours of RollOffMode to accompany the current description. I would also like to, in addition, request for extended explanations of the terms referred in the documentation.

As a visual learner, the lack of visuals on RollOffMode don’t help me to understand the already complicated and vague explanations of the enumerations. I am not a dedicated sound designer but I still wish to be able to work with sounds with at least some rudimentary understanding of how certain properties work and how they might affect my game.

With access to better technology for development (especially an actual headset now), I find myself paying much more attention to my sound design. I ran into RollOffMode today while modifying some features in my current project and went to the Developer Hub to check for explanations of how it worked. The wording is confusing such that only certain people may understand exactly what the article is saying and the lack of visuals doesn’t help with associating the words to the behaviours.

AWN the resource in the OP no longer exists and I’m not sure what the replacement article is, so now I’m missing a potential resource that may help me understand how RollOffMode works (assuming Roblox’s version works the same as a third party one - no confidence there, since Roblox is notorious for reinventing wheels).

4 Likes

Im knocking this back up 2.0.

Use RollOffMode Linear for a smoother transition.

I think roblox should automatically default to that…

It’s been 5 years and we still do not have any pictures or formulas. I had to dive through the fmod documentation to find details on how these roll-off modes work, but I couldn’t find details on ‘inverse tapered’ and ‘linear squared’. I managed to come up with a few formulas and although they seem to follow the same behavior as documented, I cannot be sure if these formulas are actually correct. Better documentation is very much needed.

3 Likes

In concert with Zomebody I was also investigating this and was able to refine my formulae by taking samples of actual dB volume.

Here’s what I came up with:

Textual backup if images and links get lost
  • let a = RollOffMinDistance

  • let b = RollOffMaxDistance

  • let x = listener distance

  • P(a, b, x) = (x - a) / (b - a) i.e. P is the linear progress from min to max (in other words the inverse lerp of x from a to b), going from 0 to 1

  • RollOffMode “Linear” is L(a, b, x) = 1 - P(a, b, x)

  • RollOffMode “LinearSquare” is S(a, b, x) = L(a, b, x)^4

  • RollOffMode “Inverse” is I(a, b, x) = (a / x)^2

  • RollOffMode “InverseTapered” is T(a, b, x) = min( I(a, b, x), S(a, b, x) )

These formulae give you the “volume” of the sound that you hear, assuming the max volume is 1. (This volume value has no real world unit, and it is not in dB. Instead it is that same kind of unit as the Sound.Volume property.)

Accounting for additional modifiers (such as having a different max volume) is easy since it’s just multiplication e.g. if we are using Inverse roll off and the Sound.Volume property is 0.732 (i.e. max audible volume is 0.732 when you are closest to the object) then AudibleVolume = 0.732 * I(a,b,x).

The curly braces in the screenshot are for restricting the domain of the RollOffMode functions in Desmos. In code you don’t need to do that, but you should handle the case where x is outside of the domain (i.e. it’s smaller than RollOffMinDistance or larger than RollOffMaxDistance). You can do this with:

  • if x <= a then AudibleVolume = MaxVolume
  • if x >= b then AudibleVolume = 0.

(Or mathematical equivalents such as clamping.)

Here is the full Desmos graph, which includes not just the formulae but also the sample data which are used to check the formulae are correct.

Raw data & processing details

Conversion from dB to absolute value in the range 0…1 was done using the equation:
AudibleVolume_Abs = 2 * 10^(AudibleVolume_dB/10).

This is derived from the information on this page: dB conversion
And in particular the equations (A is the decibel value, P2/P1 is a “power ratio”):

  • A = 10*log10(P2/P1)
  • P2/P1 = 10^(A/10)

The multiplication by 2 is because the “reference” (max) volume for every piece of data happened to be -3 dB.

Data was obtained by sampling different distances from a Sound playing a looping sine wave (with Sound.Volume = 1) parented to a Part. Sound asset used was https://create.roblox.com/marketplace/asset/146750669/440hz-sine-wave. Listener position was set using SoundService:SetListener().

In every scenario I took a sample at distance 0 to get the reference (max) volume. After that, samples were taken at RollOffMinDistance + RollOffMaxDistance*Portion where Portion is what I modified to take different samples of the roll-off curve.

Raw data: rolloffmode_measurements.txt (3.9 KB)

Columns in raw data:

  • “dista” = listener distance from the Part
  • “deciB” = measured decibels (using some kind audio monitor e.g. I used VoiceMeeter)
  • “volu” = decibels converted to absolute value in range 0…1

Anyway it would be really nice if we didn’t have to go to all this effort to figure out how the RollOffModes are working :slight_smile:

12 Likes

For my graphs, I took the rolloff functions right from the latest FMOD source code. Here is what they look like for the version of FMOD Roblox is using right now:

3 Likes