Repository navigation
Lua Script API: Sound & Music Functions
Plays a sound, when it's finished playing the onSoundFinished() callback will be called and returns the finished tag from its tag parameter.
-
sound- Theoggsound file to be played; Must be relative tomods/soundsorassets/soundsfolders. -
volume- An optional parameter, the specified volume to set on; Goes from0to1; Defualt value:1. -
tag- An optional parameter, The tag for the sound to inherit. It is required if you want to control or manipulate the said sound instead of the music; Default value:nil.
Plays a music.
-
sound- Theoggsound file to be played; Must be relative tomods/musicorassets/musicfolders. -
volume- An optional parameter, the specified volume to set on; Goes from0to1; Defualt value:1. -
loop- An optional parameter, Whether the music will loop indefinitely or not; Default value:false.
Note
If the tag parameter is left blank for instance a nil value. The music will be control and manipulated by the function instead of the sound.
Stops the sound from playing and removes it permanently.
-
tag- The sound object tag to stop; if the argument is anilvalue, the music will stop instead.
Pauses the sound from playing.
-
tag- The sound object tag to pause; if the argument is anilvalue, the music will pause instead.
Resumes the sound from pausing.
-
tag- The sound object tag to resume; if the argument is anilvalue, the music will resume instead.
Makes the sound fade-in.
-
tag- The sound object tag to fade-in; if the argument is anilvalue, the music will fade-in instead. -
duration- The specified duration length to fade-in, determines from thefromValueandtoValueargument. -
fromValue- An optional parameter, the starting value of the fade-in; Goes from0to1; Defualt value:0. -
toValue- An optional parameter, the ending value of the fade-in; Goes from0to1; Defualt value:0.
Makes the sound fade-out.
-
tag- The sound object tag to fade-out; if the argument is anilvalue, the music will fade-out instead. -
duration- The specified duration length to fade-out, determines from thefromValueandtoValueargument. -
fromValue- An optional parameter, the starting value of the fade-out; Goes from0to1; Defualt value:0. -
toValue- An optional parameter, the ending value of the fade-out; Goes from0to1; Defualt value:0.
Cancels the sound fade.
-
tag- The sound object tag to cancel the fade; if the argument is anilvalue, the music will cancel the fade.
Sets the volume value of the sound with a new value.
-
tag- The sound object tag to set the volume; if the argument is anilvalue, the music to set the volume. -
value- The determined volume value to set to.
Sets the sound position value of the sound with a new value.
-
tag- The sound object tag to set the position; if the argument is anilvalue, the music to set the position. -
value- The determined sound position value to set to.
Sets the pitch value of the sound object.
-
tag- The sound object tag to set the pitch; if the argument is anilvalue, the music to set the pitch. -
value- The determined pitch value to set to. -
doPause- An optional parameter, pauses the sound and resumes when played; Default value:false. More Information Needed
Gets the current volume value of the sound.
-
tag- The sound object tag to get the volume; if the argument is anilvalue, the music to get the volume.
Gets the current sound position value of the sound.
-
tag- The sound object tag to get the position; if the argument is anilvalue, the music to get the position.
Gets the current pitch value of the sound.
-
tag- The sound object tag to get the pitch; if the argument is anilvalue, the music to get the pitch.
Is the page in some way inaccurate? an error, a typo, or outdated data? To report it, use the "Issue Tab". Or do you wish to include a new function or add new information? use the "Pull Request Tab". Help is always appreciated!
- Event Callbacks
- Custom Sprite
- Custom Text
- Object Functions
- General Functions
- Scripting & File Functions
- Game Input Control Functions
- Language Translation
- HScript Functions
- Custom Substates
- Custom Shaders
- Deprecated & Removed Functions
- Sound & Music Functions
- Tweens & Timers Functions
- Reflection Functions
- Variables