# Sound Blocks

## Overview

The sound blocks enable you to integrate various audio elements into your app. These blocks allow you to incorporate sounds like music, effects, or recorded audio to enhance the user experience. By using sound blocks, you can create engaging and interactive app environments that include auditory elements.

## Advanced Blocks

Each of the first four blocks in the sound blocks drawer has a regular and advanced block. When you first drag one of these blocks into your workspace it will be the regular version. To access the advanced version:

1. Add the block to your workspace.
2. Right-click on it.
3. Select **Show advanced block**.

### Outputs

The advanced blocks return an "error" output block. If there is an error when executing the block, the error block will return an error message. If not, the error block will return a null value.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2Fz8hMLOYgiQJGv02Kre4K%2Fplayadv.png?alt=media&#x26;token=b0f8b59b-e2cf-4658-829d-789859ab8ed7" alt="" width="563"></div>

## Play

The "play" block plays a selected sound. This can be an audio file uploaded to your project or a URL that streams audio.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MJWjosUAfY5JU4Fpd88%2F-MJWkRznSbvVqrAijVsL%2Fimage.png?alt=media&#x26;token=871e150e-39a8-4da6-af61-d0b23feb14cf" alt=""></div>

## Pause

The "pause" block pauses the audio file currently playing.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MJWjosUAfY5JU4Fpd88%2F-MJWkaTg0Bea6aiLzC1M%2Fimage.png?alt=media&#x26;token=c4cb402f-3619-4094-ba21-94cbaf019739" alt=""></div>

## Resume

The "resume" block resumes the audio file that was previously paused.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MJWjosUAfY5JU4Fpd88%2F-MJWkcyti0RqoFn6vedK%2Fimage.png?alt=media&#x26;token=67dca2b5-2833-4c5d-9182-2319418363b2" alt=""></div>

## Stop

The "stop" block stops the audio file that is currently playing. A sound that has been stopped cannot be resumed using the "resume" block.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MJWjosUAfY5JU4Fpd88%2F-MJWkhNuVJ51U_Msyzv1%2Fimage.png?alt=media&#x26;token=2aad5aac-7276-42f9-984b-e85face63d1d" alt=""></div>

## Is Paused?

The "is paused?" block returns true if the named sound file has been played and then paused. Otherwise, it returns false.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MJWjosUAfY5JU4Fpd88%2F-MJWkmGcYMlvqwGH4TMH%2Fimage.png?alt=media&#x26;token=4fc38ae4-ff13-42d2-a131-0062b6c1c7d9" alt="" width="375"></div>

## Sound File from Recording

The "sound file from recording" block records for the specified number of seconds and then returns the recorded audio.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MJWjosUAfY5JU4Fpd88%2F-MJWkpMeVUpFZefo16q8%2Fimage.png?alt=media&#x26;token=c30eaceb-9157-4f43-a0fc-a42b075aecbf" alt="" width="375"></div>

## Start Recording

The "start recording" block starts an untimed audio recording.

<div align="left"><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MJWjosUAfY5JU4Fpd88%2F-MJWksAQr_0hdTI-bo9-%2Fimage.png?alt=media&#x26;token=81deda9c-a61a-4997-b333-f7dfed656d37" alt="" width="188"></div>

## Sound File from Stopped Audio Recording

The "sound file from stopped audio recording" block stops a recording initiated by the "start recording" block and returns the recorded sound file.

<div align="left"><figure><img src="https://1223006790-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LAn5scXl2uqUJUOqkJo-84897653%2Fuploads%2FAQNXyRWlYPcrPomkAC7M%2Fsound%20file%20from%20stopped%20audio%20recording.png?alt=media&#x26;token=6aad8626-83d1-4b21-9b9b-17f24d4c3148" alt="" width="432"><figcaption></figcaption></figure></div>
