Skip to content
Transcript

Dancing isn't much fun if there's no music.

So in this video, you'll add some tunes for the sprite to dance to.

This video demonstrates how to add music then you get to try it in your own project.

In Scratch, there's a stage, or a backdrop, where the sprites move.

The code blocks you've added so far all belong to the dancing sprite and they tell it how to move.

You want the music you add to your project to play for all sprites, not just the dancing sprite 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 party, you're gonna choose from the music loops menu.

A music loop is a sound that is designed to be played over and over again, but that still sounds like one continuous song.

Listen to the different music loops available (drum loop) select one and add it to your project.

The sounds will now be added to your project.

Next, click on the sound menu.

Choose the "play sound until done" block.

If you click the block, the music will play once.

(drum loop)

But you want it to play forever so add a forever loop around the "play sound until done" block.

After you add the forever loop, the blocks will instruct the computer to keep playing the music forever.

Look back at the sound menu.

You'll notice that there is a "play sound until done" block and a "play sound" block.

There's an important difference between these two and you can see that in this example using the meow sound.

If you put the "play sound until done" block inside the forever loop, the sprite will meow over (cat meow) and over again.

(cat meows repeatedly)

If you try the same code using the "play sound" block, listen to what happens.

(rapid distorted meowing) Right.

That sounds weird.

This block stack says play sound meow forever but the computer plays the sound then immediately plays it again and again so not a single meow is ever finished.

When you use the "play sound until done" block, the computer will wait until the sound finishes before it moves onto the next block.

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, adding one flag click block to the top of your code stack.

(drum loop)

Now it's your turn.

Click on the stage backdrop.

In the sounds tab, choose a music loop.

Using forever loop and a "play sound until done" block to play the music forever when the flag is clicked.

Instructions
  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.