BLOCK REFERENCE / AUDIO

Audio

Sounds, music and volume.

9 blocks

Fade Volume

Actionaudio_fade_volume
Fade Volume

Sets the master volume to a target level. The fade is not implemented yet, so the change is instant.

Today it works exactly like Set Volume: it affects all sounds and music. Duration is accepted but has no effect.

FieldWhat it means
TargetnumberMaster volume from 0 (silent) to 1 (full). Values outside that range are clamped.Default: 0
DurationnumberIntended fade time in seconds. Currently ignored.Default: 1
TargetsocketMaster volume from 0 (silent) to 1 (full). Values outside that range are clamped.Default: number, any
DurationsocketIntended fade time in seconds. Currently ignored.Default: number, any

Is Music Playing?

Boolean→ booleanaudio_is_music_playing
Is Music Playing?

True when a music track started with Play Music is playing.

Music loops until stopped, so it stays true until Stop Music or a scene change.

Play Music

Actionaudio_play_music
Play Music

Starts a looping music track, replacing any music already playing.

Only one track plays at a time and running the block again restarts it, so avoid it in On Update. Music stops when a scene starts, so play it in each scene. The final volume is this value times the master volume.

FieldWhat it means
MusicdropdownAudio file from the project (wav, mp3, ogg or flac).
At VolumenumberVolume from 0 to 1. Accepts a number or a reporter.Default: 0.5
At VolumesocketVolume from 0 to 1. Accepts a number or a reporter.Default: number, any

Example In On Start of each level, play that level's theme at 0.4.

Play Sound

Actionaudio_play_sound
Play Sound

Plays a sound effect once.

Several copies of the same sound can overlap. The final volume is this value times the master volume. If the file is missing or all audio channels are busy, nothing plays.

FieldWhat it means
SounddropdownAudio file from the project (wav, mp3, ogg or flac).
At VolumenumberVolume from 0 to 1. Accepts a number or a reporter.Default: 0.5
At VolumesocketVolume from 0 to 1. Accepts a number or a reporter.Default: number, any

Example Play jump right when the player jumps.

Set AudioClip Volume

Actionaudio_set_clip_volume
Set AudioClip Volume

Sets a stored volume for one audio file and applies it right away if that file is playing.

Play Sound and Play Music always use their own At Volume, which replaces this value the next time the file is played. It is most useful to adjust a sound or music that is already playing.

FieldWhat it means
AudioClipdropdownAudio file to adjust.
VolumenumberVolume from 0 to 1. Accepts a number or a reporter.Default: 0.5
VolumesocketVolume from 0 to 1. Accepts a number or a reporter.Default: number, any

Set Volume

Actionaudio_set_volume
Set Volume

Sets the master volume that scales all sounds and music.

0 is silent and 1 is full volume; other values are clamped. Music that is playing changes immediately.

FieldWhat it means
VolumenumberMaster volume from 0 to 1. Accepts a number or a reporter.Default: 1
VolumesocketMaster volume from 0 to 1. Accepts a number or a reporter.Default: number, any

Example Connect it to a slider variable in an options menu.

Stop All Sounds

Actionaudio_stop_all_sounds
Stop All Sounds

Stops every sound effect that is playing; music keeps playing.

Use Stop Music to stop the music too.

Stop Music

Actionaudio_stop_music
Stop Music

Stops the current music track.

Sound effects are not affected.

Stop Sound

Actionaudio_stop_sound
Stop Sound

Stops every playing copy of the chosen sound effect.

FieldWhat it means
SounddropdownAudio file to stop.