Jitter
Jitter functions meant for Volume and Pitch properties of sounds. Can be used in other contexts as well.
INFO
All jitter functions are clamped from 0 to 10.
Functions
Default
Jitter.Default(center: number,--
The central value around which the jitter will occur.
spread: number--
The maximum deviation from the center value.
) → () → number--
Generates the jitter value when called.
Standard Jitter function that randomly varies from the center value +- the spread.
local myJitter = Jitter.Default(1, 0.15)
local sound1 = ...
sound1.PlaybackSpeed = myJitter() -- Sets a random value.
local sound2 = ...
sound2.PlaybackSpeed = myJitter() -- Sets another random value.
Range
Jitter.Range(min: number,--
The minimum value for the jitter range.
max: number--
The maximum value for the jitter range.
) → () → number--
Generates the jitter value when called.
Essentially just a random number that requires a specified range.
local myJitter = Jitter.Range(0.85, 1.15)
local sound1 = ...
sound1.PlaybackSpeed = myJitter() -- Sets a random value.
local sound2 = ...
sound2.PlaybackSpeed = myJitter() -- Sets another random value.
Scale
Jitter.Scale(spread: number--
The maximum deviation from the center value.
) → () → number--
Generates the jitter value when called.
Very similar to Jitter.Default but the center value is 1.
local myJitter = Jitter.Scale(0.15)
local sound1 = ...
sound1.PlaybackSpeed = myJitter() -- Sets a random value.
local sound2 = ...
sound2.PlaybackSpeed = myJitter() -- Sets another random value.
UnitLog
Jitter.UnitLog(center: number,--
The central value around which the jitter will occur.
spread: number--
The maximum deviation from the center value.
) → () → number--
Generates the jitter value when called.
Produces jitter values with a shaped distribution that favors the center value.
local myJitter = Jitter.UnitLog(1, 0.15)
local sound1 = ...
sound1.PlaybackSpeed = myJitter() -- Sets a random shaped value.
local sound2 = ...
sound2.PlaybackSpeed = myJitter() -- Sets another random shaped value.
TIP
This can be used to make more natural repetitious sounds like footsteps.