Hi, I have made a very simple module that essentially just plays and stops sounds at specific timestamps, allowing you to virtually carve multiple sounds out of one sound object. It behaves similarly to a texture map, where all textures are clustered up into one image. This is basically the same thing but with sounds instead.
Usage
The usage is very simple, the module returns a constructor function to create a “family” of clips, under the same sound. It takes in the sound object itself and an array of timestamps. The structure of each clip’s timestamps is "start-end"
, so if your clip started 1.5
seconds and ended at 3.6
, it would look like "1.5-3.6"
The constructor function will return a table of clips, indexed by their respective timestamps. The clips have one basic function, Clip:Play()
. It will simply play the
Here is some sample code:
local newFamily = require(SoundClips)
local timestamps = {
"1.35-4";
"2-3.5";
}
local clips = newFamily(SoundId, timestamps)
clips["2-3.5"]:Play()
wait(5)
clips["1.35-4"]:Play()
Notes
-
You can play as many clips as you want at once
-
Treat the numbers in the timestamps as you would treat numbers in
tonumber()
, this means that you can do a little bit of fiddling with the numbers to make them look cleaner. However; the clips must be indexed the exact same way you wrote the timestamp; i.e. if you wrote your timestamp as"1 - 2"
, you must index it as"1 - 2"
. -
Please feel free to suggest any features.
Thank you for reading and I hope my script serves you well!