Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

4. Add Dance Music for Cassy


Dancing isn't much fun if there's no music, so in this screencast you'll add some tunes for Cassy to dance to. Watch as this screencast demonstrates how to add music, then you'll get to try it in your project. In Scratch, there is a "stage," or backdrop, where the sprites move. The code blocks you've added so far all belong to the sprite Cassy, and they tell her how to move. You want the music you add to your project to play for all sprites, not just Cassy, so click on the stage and add your music blocks there.

With the stage selected, click on the sounds tab and choose a sound from the sound library.

Scratch has many types of sounds to choose from, but since this is a dance scene, you're going to choose the music loops menu. A music loop is a sound that is designed to play over and over again, but that still sounds like one continuous song. Listen to the different music loops available, select one, and click OK to add it to your project. You can see here that the sound is now added to the project. Next, click on the scripts tab, and look under the sound menu. Choose the “play sound until done” block. If you click the block, the music will play once. But you want it to play forever, so add a forever loop around the “play sound until done" block. After you add the the forever loop, the block stack will instruct the computer to keep playing the music forever.

If you look back at the sound menu, you'll notice there's a "play sound until done" block AND a "play sound block." There's an important difference between these two, and you can see what it is in this example using the “meow” sound. If you put the "play sound meow until done" block into the forever loop, the cat will meow over and over again. If you try the same code using the "play sound meow" block, watch what happens. Whoa! That sounds crazy!

This block stack says "play sound meow forever," but the computer plays the meow sound, then immediately plays it again. So, not a single meow is ever finished, and the cat just keeps interrupting himself. When you use the "play sound meow until done" block, the computer will wait until the meow finishes before it moves on to the next block of code.

In your dance project, you'll want to use the “play sound until done” block. Otherwise, your project will never be able to play the music.

Lastly, add a "when flag clicked" block to the top of your music stack.

Now, it's your turn! Click on the stage backdrop. On the sounds tab, choose a music loop. Use a forever loop and a “play sound until done” block to play the music forever when the flag is clicked.

Remember, you can ask your neighbor for help if you get stuck, or put up a sticky to get the attention of your CS First Guru.

arrow_backward Back
Next arrow_forward
  1. Select the stage.
  2. Choose a music loop for Cassy to dance to.
  3. Use the "play sound until done" block to make the music loop play.
  4. Make the music loop play forever.
  5. Make the music loop start playing when the green flag is clicked.