OSL ‐ Sound Handling - Mistium/Origin-OS GitHub Wiki
Important
SOUND HANDLING REQUIRES ORIGINOS VERSION 4.6.4 OR LATER
Basic Syntax
About
The "URL" input in all of these commands (other than "load") supports passing multiple sounds in an array so you can run multiple sounds at once.
Example: sound ["sound1","sound2"] "pause"
Commands
-
sound "url" "load" "name"
- loads a sound into ram from url or data uri
-
sound "url"/"name" "play"
- plays a sound from the beginning
-
sound "url"/"name" "pause"
- pauses a sound
-
sound "url"/"name" "unpause"
- unpauses a sound
-
sound "url"/"name" "start" time
- starts playing a sound at a specific time
-
sound "url"/"name" "clear"
- deletes a sound
-
sound "url"/"name" "volume" int
- changes the volume of a specific sound
-
sound "url"/"name" "speed" int
- changes the speed of the sound (default 1)
Methods
-
"sound url"/"name".soundinfo("loaded")
- boolean of if the sound is loaded into the system or not
-
"sound url"/"name".soundinfo("duration")
- integer of the length of the sound in seconds
-
"sound url"/"name".soundinfo("current_time")
- integer of how far through the sound you are
-
"sound url"/"name".soundinfo("volume")
- integer of the sound's volume
-
"sound url"/"name".soundinfo("pitch")
- integer of the sound's pitch
-
"sound url"/"name".soundinfo("playing")
- true or false of if the sound is playing or not
Example Use
sound_beep = "example.com/beep.wav"
sound sound_beep "load" "beep"
mainloop:
if "beep".soundinfo("loaded") and "beep".soundinfo("playing").not (
sound "beep" "play"
)
// this script would load a sound and then start playing it only on the frames where the sound isnt playing and the sound is loaded