SoundPresets
Presets are functions that you can apply to your sounds to quickly change reoccuring property values.
INFO
- Presets are closures that get passed to your fetching functions.
- You can create your own presets and combine them with the built in ones.
- When a preset runs everything should be cleaned up before exiting the function block.
TIP
You can also make your own presets and store them in a module for easy access.
local CustomPresets = {}
function CustomPresets.DoSomething(doTheThing: boolean): (Sound) -> ()
return function(sound: Sound)
if doTheThing then
sound.Volume = 0.5
else
sound.Volume = 1
end
end
end
return CustomPresets
Functions
Combine
Combines presets together into 1 reusable preset.
INFO
Presets are applied in sequence from first to last.
local myCombinedPreset = SoundPresets.Combine(
SoundPresets.NaturalPlaybackJitter(0.8, 0.1),
SoundPresets.NaturalVolumeJitter(0.7, 0.15)
)
local myCombinedPreset2 = SoundPresets.Combine(
myCombinedPreset,
SoundPresets.Parent(workspace.Sounds)
)
local sound1 = VluxySF.Fetch("mySound1", nil, myCombinedPreset)
local sound2 = VluxySF.Fetch("mySound2", nil, myCombinedPreset)
local sound3 = VluxySF.Fetch("mySound3", nil, myCombinedPreset2)
local sound4 = VluxySF.Fetch("mySound4", nil, myCombinedPreset2)
Parent
Sets the parent of a sound.
local myPreset = SoundPresets.Parent(workspace.Sounds)
local sound1 = VluxySF.Fetch("mySound1", nil, myPreset)
local sound2 = VluxySF.Fetch("mySound2", nil, myPreset)
local sound3 = VluxySF.Fetch("mySound3", nil, myPreset)
Volume
SoundPresets.Volume(volume: number--
The volume to set the sound too.
) → (Sound) → ()--
Closure of the preset.
Sets the volume of a sound.
local myPreset = SoundPresets.Volume(0.1)
local sound1 = VluxySF.Fetch("mySound1", nil, myPreset)
local sound2 = VluxySF.Fetch("mySound2", nil, myPreset)
local sound3 = VluxySF.Fetch("mySound3", nil, myPreset)
PlaybackSpeed
SoundPresets.PlaybackSpeed(speed: number--
The playback speed to set for the sound too.
) → (Sound) → ()--
Closure of the preset.
Sets the playback speed of a sound.
local myPreset = SoundPresets.PlaybackSpeed(1.3)
local sound1 = VluxySF.Fetch("mySound1", nil, myPreset)
local sound2 = VluxySF.Fetch("mySound2", nil, myPreset)
local sound3 = VluxySF.Fetch("mySound3", nil, myPreset)
NaturalVolumeJitter
SoundPresets.NaturalVolumeJitter(center: number?,--
The central value of the jitter.
spread: number?--
The spread of the jitter.
) → (Sound) → ()--
Closure of the preset.
Uses Jitter.UnitLog to apply a natural jitter to the volume of the sound.
local myPreset = SoundPresets.NaturalVolumeJitter(0.8, 0.1)
local sound1 = VluxySF.Fetch("mySound1", nil, myPreset)
local sound2 = VluxySF.Fetch("mySound2", nil, myPreset)
local sound3 = VluxySF.Fetch("mySound3", nil, myPreset)
NaturalPlaybackJitter
SoundPresets.NaturalPlaybackJitter(center: number?,--
The central value of the jitter.
spread: number?--
The spread of the jitter.
) → (Sound) → ()--
Closure of the preset.
Uses Jitter.UnitLog to apply a natural jitter to the playback speed of the sound.
local myPreset = SoundPresets.NaturalPlaybackJitter(1, 0.1)
local sound1 = VluxySF.Fetch("mySound1", nil, myPreset)
local sound2 = VluxySF.Fetch("mySound2", nil, myPreset)
local sound3 = VluxySF.Fetch("mySound3", nil, myPreset)
RandomVolumeJitter
SoundPresets.RandomVolumeJitter(center: number?,--
The central value of the jitter.
spread: number?--
The spread of the jitter.
) → (Sound) → ()--
Closure of the preset.
Uses Jitter.Default to apply a random jitter to the volume of the sound.
local myPreset = SoundPresets.RandomVolumeJitter(0.8, 0.1)
local sound1 = VluxySF.Fetch("mySound1", nil, myPreset)
local sound2 = VluxySF.Fetch("mySound2", nil, myPreset)
local sound3 = VluxySF.Fetch("mySound3", nil, myPreset)
RandomPlaybackJitter
SoundPresets.RandomPlaybackJitter(center: number?,--
The central value of the jitter.
spread: number?--
The spread of the jitter.
) → (Sound) → ()--
Closure of the preset.
Uses Jitter.Default to apply a random jitter to the playback speed of the sound.
local myPreset = SoundPresets.RandomPlaybackJitter(1, 0.1)
local sound1 = VluxySF.Fetch("mySound1", nil, myPreset)
local sound2 = VluxySF.Fetch("mySound2", nil, myPreset)
local sound3 = VluxySF.Fetch("mySound3", nil, myPreset)