- Learnt27 min · loops with no gaps, and a beat
- Basic25 min · build a two-layer track
- Challenge 1–327 min · layer it, hold it, open it
- Extrabonus · put your own voice in it
Review — where we got to 5 min
The Muffin Catcher is done and saved. We need two things from it today.
play sound [Pop v]starts a sound and goes on straight away.play sound [Pop v] until donewaits for the sound to end.- Many sprites can run their own loops at the same time. None of them waits.
Quick-fire
In the Muffin Catcher, “until done” was the wrong block. It froze a falling muffin in the air. Today it is the right block. What changed?
Reveal the answer
The job changed. A falling muffin has to keep moving. A backing track has nothing else to do. So we want it to wait for the sound to end.
Today’s Topic 3 min
- The Sound tab: choosing a sound, and recording one
foreveraroundplay sound [Dance Snare Beat v] until done— a loop with no gap- A beat of your own:
play sound [Drum Bass1 v]thenwait (0.5) seconds set volume to (100) %, and two sprites playing together
Learning outcome
By the end of this lesson you will be able to:
- Loop a backing track so it plays with no gaps.
- Build a beat from a sound and a wait. Change its speed with one number.
- Play two layers at once and keep them in time.
Learnt — loops, beats and layers 27 min
A music video has two jobs: the music and the moving. They are easier one at a time. So today is all music. Nothing moves.
Set the stage
- Start a new project. Delete the cat.
- Choose the Concert backdrop.
- Add the Drum Kit sprite. It will not move. The music belongs to it.
A backing track is one block in a loop
A backing track is a long sound that plays again and again. Pick a long sound. Dance Snare Beat is four seconds long. It is made to repeat.
- Click the Drum Kit, then the Sound tab.
- Choose a Sound, search
Dance Snare Beat, and click it. - In Code, build
when flag clicked, then aforever. - Put
play sound [Dance Snare Beat v] until doneinside the forever. - Press the flag. It should go round with no gap.
when flag clicked
forever
play sound [Dance Snare Beat v] until done
end
when flag clicked
forever
play sound [Dance Snare Beat v]
end
How to use this: Click the green flag to start it. Nothing else to press — watch it through, then use ↺ Reset to run it again.
A beat is a hit and a gap
You can also make music by hitting a drum on a timer. Put one short sound and one wait in a forever.
when flag clicked
forever
play sound [Drum Bass1 v]
wait (0.5) seconds
end
play sound [Pop v] is right. The wait sets the timing, not the sound.The wait number is the speed of your track. 0.5 is a walking beat. 0.25 is twice as fast. 1 is a slow march.
How to use this: Click the green flag to start it. Nothing else to press — watch it through, then use ↺ Reset to run it again.
Layers
A layer is one sprite with one job. The drum kit plays the beat. A second sprite claps on top. Both start on the flag. Neither one waits for the other.
when flag clicked
forever
play sound [Drum Bass1 v]
wait (0.5) seconds
end
when flag clicked
forever
play sound [Clapping v]
wait (1) seconds
end
Waits of 0.5 and 1 fit together. One is twice the other. Waits of 0.5 and 0.7 do not fit. The two layers slip apart as you listen.
How to use this: Click the green flag to start it. Nothing else to press — watch it through, then use ↺ Reset to run it again.
Volume
Volume is how loud a sound is. Every sprite has its own volume. A quiet layer can sit under a loud one.
when flag clicked
set volume to (60) %
forever
play sound [Clapping v]
wait (1) seconds
end
set volume to (100) % at the top of a stack. It clears what the last run left behind.Basic — build the track 25 min
Build it in this order. Turn the volume up. Listen after every step.
How to use this: Click the green flag to start it. Nothing else to press — watch it through, then use ↺ Reset to run it again.
Step 1 — the stage
- Start a new project. Delete the cat. Choose the Concert backdrop.
- Add the Drum Kit and the Drums Conga.
- Put them where a band would stand. They will not move today.
Step 2 — the backing track
- Click the Stage. Open its Sound tab and add
Dance Snare Beat. - Give the Stage the forever and until done stack.
- Press the flag. Listen to where the track starts again. There should be no gap.
Step 3 — the drum
- On the Drum Kit, add the sound
Drum Bass1. - Build the hit-and-wait loop with
wait (0.5) seconds. - Play both at once. Tap your foot. Does the drum fit the track?
Step 4 — the clap
- On the Conga, add
Clapping. - Build the same shape with
wait (1) seconds. - Now you have three layers. Listen to it all for twenty seconds.
Step 5 — mix it
- Give each sprite a
set volume to (100) %at the top. - Turn the clap down to 60 and the drum down to 80.
- The backing track should sit under the others, not on top.
Step 6 — change the speed
- Set the drum wait to 0.25 and the clap to 0.5.
- Listen. The whole track is twice as fast. It still fits together.
- Now try 0.3 and 1. Hear them slip apart. Then put them back.
My project sounds like a roar.
A whole track starts again every frame. Find the play sound [Dance Snare Beat v] inside a forever. Change it to the until done block.
My drum plays once and stops.
Maybe the loop is a repeat (10), not a forever. Or the play block is above the loop, not inside it.
The layers slip apart after a while.
Your waits do not match. 0.5 and 1 stay together for ever. 0.5 and 0.7 never do.
Your own two layers
Make a beat that nobody else in the room has. Use two sounds and two waits.
- Two sprites, one sound each, both looping.
- The two waits match. One is double the other.
- You can say which sound is the beat. You can say which is the layer on top.
Thirty seconds, no drift
Anyone can make two sounds fit for three seconds. Make a track that still sounds right after thirty seconds.
- At least three layers play at the same time.
- It plays for thirty seconds and stays in time.
- Each layer has its own volume. You can hear all three.
Teacher note — why drift happens
A wait is not a metronome. wait (0.5) seconds waits at least half a second, and the sound before it takes a moment too, so a loop is always a shade slower than its number. Layers whose waits are doubles of each other drift together and nobody hears it. Layers on odd numbers drift apart and everybody does.
An intro, then the track
Give your track a real start. Something plays once, before the loops start. It never plays again.
- A count-in, a cymbal, or a spoken line. It plays once only.
- The loops start after it, not under it.
- Run it twice. You get the same start both times.
How to use this: Click the green flag to start it. Nothing else to press — watch it through, then use ↺ Reset to run it again.
Teacher reveal — where the intro goes
when flag clicked
set volume to (100) %
play sound [Cymbal Crash v] until done
wait (1) seconds
forever
play sound [Drum Bass1 v]
wait (0.5) seconds
end
Above the forever, so it runs once. This is the three-zone shape — set-up, loop, and the loop never ends here because a track has no curtain call.
Put your own voice in it
So far every sound came from the library. Record a sound of your own. Make it the hook. The hook is the bit people remember.
- Click a sprite, then the Sound tab.
- Point at the speaker button at the bottom left. Choose Record.
- Press the round button. Say your word. Press stop.
- Drag the handles to cut the quiet bits off both ends. Then click Save.
- Your sound is now in that sprite’s sound list, like any other.
- The hook is a sound you recorded, not a library one.
- It comes round on a timer, not at random.
- It plays on top of the track but is not too loud.
- The cut sound has no long quiet bit at either end.
Teacher notes — the two things that go wrong
An untrimmed recording has a second of room noise at each end, which puts the hook off the beat every single time. Trimming is the fix, and it is worth doing together on the board once.
The other is volume: a recording made close to the microphone is much louder than a library sound. set volume to (70) % on that sprite is usually enough.
Going further: change [pitch v] effect by (10) in the Sound drawer turns your own voice into a chipmunk, or a giant. Nobody has met sound effects yet.
Summary 4 min
Music in Scratch comes in two shapes. Today you learnt which is which.
- A track:
play sound [Dance Snare Beat v] until doneinside aforever. No gaps. - A beat:
play sound [Drum Bass1 v]andwait (0.5) secondsinside aforever. The wait is the speed. - Layers are more sprites doing the same thing, with waits that match.
- Backing track
- A long sound that loops with no gap, under everything else.
- Beat
- A short sound played again and again on a timer. The wait between hits is its speed.
- Layer
- One sprite’s loop. Put a few together to make a track.
- Volume
- How loud one sprite is. Set it at the top of every stack.
Next lesson: the dancers come. They move on the beat you built today.