The sound component plays a designated sound.
There are a few ways you can set a sound source in your app:
- 2.Provide a link to the sound. The link has to end in
You can set a volume for the Sound component between 0 and 100.
This block will be triggered when the source of a Sound component is loaded. It is recommended to use this block if changing a Sound component's source during app runtime.
If a given audio is already the source of a Sound component, and you use a block to set the same audio as the source of the Sound component, this block will not be triggered. We recommend using an if statement to say that if the audio is already the source of the Sound component, execute the action you would take when the source is loaded.
In the following screenshot, we want this audio to play when the Button is pressed. If this audio is already the source for the Sound component, we play the sound. If not, we set the audio to be the Sound's source. Once the source is loaded, we play the audio.
This block will be triggered if there is an error with the Sound component.
Play, Pause, Resume or Stop a sound.
A sound can only be resumed if it has been paused.
Set the Sound's source using the drop-down menu or by using a Text block to specify a filename or URL.
Get the name of the Sound source.
Set Sound volume to value between 0 and 100.
Get Sound volume.