Getting Started
Installation
Installing EasySFX is very easy:
- Grab the module from here.
- Drop it into
ReplicatedStorage
. - Initiate it in your script like so:
LocalScript
local EasySFX = require(game.ReplicatedStorage.EasySFX) -- Import the EasySFX module.
local soundObj = script.Sound -- Reference your Sound object.
local sound = EasySFX:Load(soundObj) -- Load a sound into EasySFX (Returns EasySFX object).
Introduction
Once you've loaded a sound, you can apply effects to it. Here's how:
LocalScript
local EasySFX = require(game.ReplicatedStorage.EasySFX)
local soundObj = script.Sound
local sound = EasySFX:Load(soundObj) -- (Loaded EasySFX object)
-- Apply effects (Returns effect instance):
local sound_Echo = sound:Echo() -- Add echo.
-- Apply effects with properties (applies before parenting):
local sound_Reverb = sound:Reverb({
DryLevel = 1,
WetLevel = -2
})
-- Apply properties **after** initializing the effect:
sound_Echo.DryLevel = 0
-- Remove an effect:
sound.RemoveEffect(sound_Echo) -- Remove the echo effect.
-- Unload the sound and remove all effects:
sound.Unload() -- Unload the sound. Returns true on success, nil otherwise.
Example
LocalScript
local EasySFX = require(game.ReplicatedStorage.EasySFX)
local soundObj = script.Sound
local sound = EasySFX:Load(soundObj)
-- Chaining multiple effects:
local sound_Reverb = sound:Reverb({ DryLevel = 0, WetLevel = -6 })
local sound_Distortion = sound:Distortion({ Gain = 0.8 })
local sound_Chorus = sound:Chorus({ Depth = 0.5, Rate = 10 })
-- Using OnUnload to clean up:
sound.Sound.Ended:Connect(function()
print("Sound ended, unloading effects")
sound.OnUnload(function() -- Call OnUnload() BEFORE Unloading for it to work.
print("Successfully unloaded")
end)
sound.Unload()
end)
OUTPUT:
"Successfully unloaded" - LocalScript