Audio
Functions
Audio Ready
Checks if SplashKit audio currently ready to be used. Should this return false
, you may want to use Open Audio
to enable audio.
Return Type: Boolean
Signatures:
Close Audio
Turns off audio, stopping all current sounds effects and music.
Signatures:
Open Audio
Starts the SplashKit audio system working.
Signatures:
Fade Music In
Fade Music In
Fades music file matching the name to full volume over a specified number of milliseconds
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Music file to play. |
ms | Integer | How many milliseconds it takes to fade the Music to full volume |
Signatures:
Fade Music In
Fades music file matching the name to full volume over a specified number of milliseconds and loops a specified number of times
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Music file to play. |
times | Integer | Controls the number of times the music is played. |
ms | Integer | How many milliseconds it takes to fade the Music to full volume |
Signatures:
Fade Music In
Fades music up to full volume over a specified number of milliseconds.
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The name of the Music to play. |
ms | Integer | How many milliseconds it takes to fade the Music to full volume |
Signatures:
Fade Music In
Fades music up to full volume over a specified number of milliseconds for a specified number of times.
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The name of the Music to play. |
times | Integer | Controls the number of times the music is played. |
ms | Integer | How many milliseconds it takes to fade the Music to full volume |
Signatures:
Fade Music Out
Fades music outover a specified number of milliseconds
Parameters:
Name | Type | Description |
---|---|---|
ms | Integer | How many milliseconds it takes to fade the Music out |
Signatures:
Free All Music
Releases all of the music files that have been loaded.
Signatures:
Free Music
Releases the SplashKit resources associated with music.
Parameters:
Name | Type | Description |
---|---|---|
effect | Music | The music file whose resources should be released. |
Signatures:
Has Music
Determines if SplashKit has a music file loaded for the supplied name. This checks against all music files loaded, those loaded without a name are assigned the filename as a default. If this returns false
, you may want to use Load Music
to load in a specific sound effect and give it the desired name.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name to check if a music file is loaded. |
Return Type: Boolean
Signatures:
Load Music
Loads and returns a music value. The supplied filename
is used to locate the music file to load. The supplied name
indicates the name to use to refer to this Music value. The Music
can then be retrieved by passing this name
to the Music Named
function.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the resource for SplashKit |
filename | String | The filename to load |
Return Type: Music
Signatures:
Music Filename
Returns the filename the of the music data
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The music resource |
Return Type: String
Signatures:
Music Name
Returns the name that SplashKit uses to refer to this music data
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The music resource |
Return Type: String
Signatures:
Music Named
Retrieves a Music
that has been loaded into SplashKit.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the music file to return. |
Return Type: Music
Signatures:
Music Playing
Checks whether music is currently playing.
Return Type: Boolean
Signatures:
Music Valid
Lets you test if music value is valid. This will return true when it is a valid music.
Parameters:
Name | Type | Description |
---|---|---|
m | Music | the music source to test |
Return Type: Boolean
Signatures:
Music Volume
Returns the volume of the currently playing Music
.
Return Type: Float
Signatures:
Pause Music
Pauses currently playing music - see resume_music to continue playing.
Signatures:
Play Music
Play Music
Plays the music file that matches the name once at full volume.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Music to play. |
Signatures:
Play Music
Plays the music file that matches the name a specified number of times at full volume.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Music to play. |
times | Integer | Controls the number of times the music is played. |
Signatures:
Play Music
Plays a music file once at full volume.
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The name of the Music to play. |
Signatures:
Play Music
Plays a music file a specified number of times at full volume.
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The name of the Music to play. |
times | Integer | Controls the number of times the music is played. |
Signatures:
Play Music
Plays a music file for a specified number of times and playback volume.
Parameters:
Name | Type | Description |
---|---|---|
data | Music | The name of the Music to play. |
times | Integer | Controls the number of times the music is played. |
volume | Float | Indicates the percentage of the original volume to play the Music at. This must be between 0 and 1 . |
Signatures:
Resume Music
Resumes currently paused music - see pause_music to pause playing music.
Signatures:
Set Music Volume
Sets the volume of the currently playing Music
. Must be between 0 and 1, e.g. 0.1 is 10%.
Parameters:
Name | Type | Description |
---|---|---|
volume | Float | Indicates the percentage of the original volume to play the Music at. This must be between 0 and 1 . |
Signatures:
Stop Music
Stops currently playing music.
Signatures:
Fade All Sound Effects Out
Fades out all Sound Effect
s over the specified milliseconds.
Parameters:
Name | Type | Description |
---|---|---|
ms | Integer | The number of milliseconds to fade out all sound effects. |
Signatures:
Fade Sound Effect Out
Fades out the Sound Effect
over the specified milliseconds.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The Sound Effect to fade out. |
ms | Integer | The number of milliseconds to fade out the Sound Effect . |
Signatures:
Free All Sound Effects
Releases all of the sound effects that have been loaded.
Signatures:
Free Sound Effect
Releases the SplashKit resources associated with the sound effect.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The Sound Effect whose resources should be released. |
Signatures:
Has Sound Effect
Determines if SplashKit has a sound effect loaded for the supplied name. This checks against all sounds loaded, those loaded without a name are assigned the filename as a default. If this returns false
, you may want to use Load Sound Effect
to load in a specific sound effect and give it the desired name.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name to check if a sound effect is loaded. |
Return Type: Boolean
Signatures:
Load Sound Effect
The supplied filename
is used to locate the sound effect to load. The supplied name
indicates the name to use to refer to this Sound Effect
. The Sound Effect
can then be retrieved by passing this name
to the Sound Effect Named
function.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name used to refer to the sound effect. |
filename | String | The filename used to locate the sound effect to use. |
Return Type: Sound Effect
Signatures:
Play Sound Effect
Play Sound Effect
Plays a sound effect once at full volume.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the effect to play. |
Signatures:
Play Sound Effect
Plays a sound effect once at full volume.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the effect to play. |
volume | Float | The volume to play the Sound Effect |
Signatures:
Play Sound Effect
Plays a sound effect for a specified number of times at full volume.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the effect to play. |
times | Integer | Controls the number of times the sound effect is played. |
Signatures:
Play Sound Effect
Plays a sound effect for a specified number of times and playback volume.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the effect to play. |
times | Integer | Controls the number of times the sound effect is played. |
volume | Float | Indicates the percentage of the original volume to play the Sound Effect at. This must be between 0 and 1 . |
Signatures:
Play Sound Effect
Plays a sound effect once at full volume.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The effect indicates which sound effect to start playing. |
Signatures:
Play Sound Effect
Plays a sound effect once at playback volume.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The effect indicates which sound effect to start playing. |
volume | Float | Indicates the percentage of the original volume to play the Sound Effect at. This must be between 0 and 1 . |
Signatures:
Play Sound Effect
Plays a sound effect once at full volume.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The effect indicates which sound effect to start playing. |
times | Integer | Controls the number of times the sound effect is played. |
Signatures:
Play Sound Effect
This version of Play Sound Effect
allows you to control both the number of times the Sound Effect
is repeated and its playback volume.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The effect indicates which sound effect to start playing. |
times | Integer | Controls the number of times the sound effect is played. |
volume | Float | Indicates the percentage of the original volume to play the Sound Effect at. This must be between 0 and 1 . |
Signatures:
Sound Effect Filename
Returns the filename of the Sound Effect
that has been loaded by SplashKit
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The Sound Effect to check |
Return Type: String
Signatures:
Sound Effect Name
Returns the name of the Sound Effect
that has been loaded by SplashKit
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The Sound Effect to check |
Return Type: String
Signatures:
Sound Effect Named
Retrieves a Sound Effect
that has been loaded into SplashKit. If the sound effect has not been loaded, this will attempt to use the name to locate the file for you. If a file can be found, the sound effect is loaded and returned.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the sound effect to return. |
Return Type: Sound Effect
Signatures:
Sound Effect Playing
Sound Effect Playing
Checks whether the Sound Effect
that matches the name is currently playing
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Sound Effect |
Return Type: Boolean
Signatures:
Sound Effect Playing
Checks whether the Sound Effect
is currently playing
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The Sound Effect to be tested. |
Return Type: Boolean
Signatures:
Sound Effect Valid
Lets you test if a sound effect is valid. This will return true when it is a valid sound effect.
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | the effect to test |
Return Type: Boolean
Signatures:
Stop Sound Effect
Stop Sound Effect
Stops the Sound Effect
that matches the name, if it is currently playing.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Sound Effect to stop. |
Signatures:
Stop Sound Effect
Stops the Sound Effect
if it is currently playing
Parameters:
Name | Type | Description |
---|---|---|
effect | Sound Effect | The Sound Effect to stop. |
Signatures:
Types
Music
The Music type is used to refer to music that can be
played by SplashKit. Music files are loaded with
Load Music
, played using Play Music
, and must be
released using Free Music
.
Unlike Sound Effect
s, there can only be one music track
playing at a time. Playing an new track will stop the currently
playing music and switch to the new track.
Sound Effect
The Sound Effect
type is used to refer to sound effects that can be
played by the SplashKit audio code. Sound effects are:
-
loaded with
Load Sound Effect
, -
played using
Play Sound Effect
, -
and must be released using
delete_sound_effect
(to release a specific sound effect) ordelete_all_sound_effects
(to release all loaded sound effects).
SplashKit will mix the audio from multiple sound effects, making it
possible to play multiple Sound Effect
s, or even to play the one
Sound Effect
multiple times.
You can check if a Sound Effect
is currently playing using
Sound Effect Playing
.
To stop a Sound Effect
playing use Stop Sound Effect
. This will stop all
instances of this one sound effect from playing.
Use Music
for background music for your games.