Sound & Images > Sound


Read our Sounds article for an explanation of these blocks.


Playback

Play / Loop Sound

play-sound-block

Plays (or loops) the chosen sound on the next available channel.

playSound([SOUND]);
loopSound([SOUND]);

Stop all Sounds

stop-sounds-block

Immediately stops playback of all sounds.

stopAllSounds();

Volume

Set Volume

set-volume-sound-block

Sets the global sound volume level. Individual channels maintain their own volume level, which is multiplied against the global volume level. Specify a value between [0-100] inclusive.

setVolumeForAllSounds([NUMBER]/100);

Fade Volume In / Out

fade-block

Fades the global sound volume level in (to 100%) or out (to 0%) over time, given in seconds.

fadeInForAllSounds([NUMBER]);
fadeOutForAllSounds([NUMBER]);

Channels

Play / Loop Sound on Channel

play-channel-block

Plays (or loops) a sound on the specified channel. If one was previously playing on the channel, it stops and gets replaced.

playSoundOnChannel([SOUND], [NUMBER]);
loopSoundOnChannel([SOUND], [NUMBER]);

Stop / Pause / Resume Sound on Channel

stop-channel-block

Controls playback of a sound on the specified channel (if one is playing). Stopping a sound and resuming will force it start from the beginning.

stopSoundOnChannel([NUMBER]);
pauseSoundOnChannel([NUMBER]);
resumeSoundOnChannel([NUMBER]);

Set Volume on Channel

volume-channel-block

Sets the volume level for the specified channel, which is multiplied against the global volume level. Specify a value between [0-100] inclusive.

setVolumeForChannel([NUMBER]/100, [NUMBER]);

Fade Volume In / Out on Channel

fade-channel-block

Fades the sound volume level for the specified channel in (to 100%) or out (to 0%) over time. Duration is given in seconds.

fadeInSoundOnChannel([NUMBER], [NUMBER]);
fadeOutSoundOnChannel([NUMBER], [NUMBER]);

Sound Position on Channel

sound-position-block

Returns the current playback position of the sound on the specified channel in milliseconds.

getPositionForChannel([NUMBER])

Length of Track on Channel

length-channel-block

Returns the length of the sound on the specified channel in milliseconds.

getSoundLengthForChannel([NUMBER])

Length of Sound

length-sound-block

Returns the length of the specified sound in milliseconds.

getSoundLength([SOUND])

Get Sound with Name

get-sound-by-name-block

Returns a sound, given its name.

getSoundByName([TEXT])