Source:setFalloff

Edit

Sets the volume falloff of the Source, causing it to get quieter as it gets further away from the listener.



Arguments

NameTypeDescription
minDistancenumber The distance at which the volume will start to decrease.
minVolumenumber The minimum volume for the falloff. For example, .25 would clamp the falloff to 25% of the source's volume. Note that other effects like cone and occlusion can still decrease the volume further. The falloff volume factor gets combined (multiplied) with other volume factors.

Returns

Nothing

Arguments

NameTypeDescription
enableboolean Whether volume falloff should be enabled. Passing true will set a default falloff with a minDistance of 0 and a minVolume of 0. Falsy values disable falloff completely by setting the minVolume to 1.

Returns

Nothing

Notes

The formula for falloff is:

if distance > minDistance then
  volume = volume * math.max(minVolume, 1 / (1 + distance - minDistance))
end

See also