Skip to content
Please note: This theme has not been updated to reflect Scratch 3.0. Visit this help article for more info.
Transcript

In this add-on, you will add music and a volume-control slider to your project.

The music will play when the Play sprite is clicked and the user will control the volume by clicking the Volume sprite.

To start, select the Volume sprite.

You can add music from the Scratch library.

To add music from the Scratch library, select the Sounds tab, click Choose Sound from Library, and select a sound.

(upbeat music)

When the Play sprite is clicked, it broadcasts a message.

To make the Volume sprite receive that message and start playing music, add a When I Receive block and select the Play message from the drop down menu.

Add a Play Sound block and select the sound you just picked from the drop down menu.

That's pretty cool but it would be even more impressive if the users could control the volume of the music in the project.

To enable the user to adjust the volume by clicking the Volume sprite, place a Set Volume block from the Sounds menu under the Play Sound block.

(gentle music)

Right now the volume is set at 100%.

To enable the user to change the volume, select the Variable menu and click Make A Variable.

Name the variable Volume.

Add the Volume variable to the Set Volume block.

To make the Volume slider show up when the user clicks the Volume sprite, check the box next to the Volume variable in the scripts menu and double click the variable display on the stage until the slider display shows up.

Move the slider next to the Volume sprite on the stage.

Try it out.

Click the Play sprite to start the music.

(gentle music)

Adjust the volume using the slider.

The volume doesn't change.

When the Volume sprite receives the play message, it sets the volume once.

To enable the user to adjust the volume at any point after the play message is received, place a forever loop around the Set Volume block to continually check the volume level the user has set.

Test it out.

(gentle music)

Sweet, it works.

Now it's your turn.

Add sound to your project and add code that lets the user adjust the volume with a variable slider.

Choose an Add-On

Scene Change

Customize your video with different backdrops.

Flashing Letters

Create an exciting video opening.

Supporters

Add other characters to support your cause.

Inspire with Music

Add uplifting music that will start when the play button is pressed.

Target Your Message

Change your message based on the user's response to a question.

Celebrate your Cause

Get the sprites moving!

Instructions

  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!