Sound
Sound Functions
We have two categories for audio functions. Sound functions are for short sound clips like sound effects. Music functions are intended for longer music clips
loadSound
loadSound
Async. Loads a sound clip from a disk file.
file
*
file
-
the file that contains the sound clip
volume
number
1
a number between 0.0 and 1.0 that indicates what volume to use for this sound clip.
Returns
object
a sound that you can pass to the playSound
function (see below)
playSound
playSound
Plays a sound clip on your computer speakers.
sound
*
object
-
the sound clip to play (must have been already loaded by the loadSound
function)
repeat
boolean
false
a boolean indicating whether to repeat the sound forever or just play it once.
Returns
nothing
stopSound
stopSound
Stops a sound clip from playing.
sound
*
object
-
the sound clip to stop
Returns
nothing
loadMusic
loadMusic
Loads a music clip from a disk file so that you can play it later using the playMusic
function. Only one music clip may be loaded at a time. This supports MP3 and some other music file formats.
file
*
file
-
the file that contains the music clip
volume
number
1
a number between 0.0 and 1.0 that indicates what volume to use for this music clip.
Returns
nothing
playMusic
playMusic
Plays the music clip that you loaded with the loadMusic
function. Only one music clip can be playing at once.
repeat
boolean
false
a boolean indicating whether to repeat the music forever or just play it once.
Returns
nothing
stopMusic
stopMusic
Stops the current music from playing.
Returns
nothing
Last updated