- Learnt28 min · the Music blocks, beats and tempo
- Basic24 min · a beat and a dancer
- Challenge 1–327 min · faster, a rest, three drums
- Extrabonus · a count-in and a tempo you control
Review — the Geometry Art arc 5 min
- A polygon My Block takes the number of sides as an input.
- The pen turns 360 ÷ sides degrees at every corner.
- Symmetry is one shape, drawn again and again with a turn in between.
Quick-fire
Your polygon block draws a shape with 8 sides. How far does it turn at each corner?
Reveal the answer
45 degrees — 360 ÷ 8. Today we swap the Pen for another extension. It also counts, but it counts in beats.
Today’s Topic 3 min
- The Music extension
play drum [(2) Bass Drum v] for (0.25) beats- Beats and tempo —
set tempo to (60) rest for (0.75) beats— a beat of silence
Learning outcome
By the end of this lesson you will be able to:
- Add the Music extension and play a drum.
- Say how long a beat lasts at a given tempo.
- Build a beat that a dancer steps to.
Learnt — drums and the beat 28 min
1 · Add the Music extension
The Music blocks are not in Scratch until you add them.
- Click the Add Extension button. It is at the very bottom left of the editor.
- Click Music.
- A new Music category appears at the bottom of the block list.
2 · Play a drum
- Add the Drum sprite. Call it
Kick. - Drag out
play drum [(1) Snare Drum v] for (0.25) beats. - Click the dropdown and pick
(2) Bass Drum. - Click the block. You hear one deep “boom”.
Scratch has 18 drums. Each one has a number in the dropdown. These are the four we use in this arc:
| Number | Drum | Sounds like |
|---|---|---|
| 1 | Snare Drum | a sharp “tap” |
| 2 | Bass Drum | a deep “boom” — the kick |
| 6 | Closed Hi-Hat | a short “tss” |
| 8 | Hand Clap | a clap |
3 · Beats, not seconds
Look at the end of the block: beats, not seconds. A beat is one tap of your foot in a song. The tempo says how many beats fit into one minute.
set tempo to (60)
set tempo to (120)
We keep the tempo in a variable called bpm (“beats per minute”). Then the Stage can show it.
when flag clicked
set [bpm v] to (60)
set tempo to (bpm)
repeat (4)
switch costume to [drum-b v]
play drum [(2) Bass Drum v] for (0.25) beats
switch costume to [drum-a v]
rest for (0.75) beats
end
set [bpm v] to (120)
set tempo to (bpm)
repeat (4)
switch costume to [drum-b v]
play drum [(2) Bass Drum v] for (0.25) beats
switch costume to [drum-a v]
rest for (0.75) beats
end
How to use this: Click the green flag. Nothing else to press — watch the drum light four times slowly, then four times fast.
4 · Rest — a beat of silence
The drum sound is short, only 0.25 of a beat. The rest for (0.75) beats block fills the rest of the beat with silence. Together they make one whole beat.
| Block | Beats |
|---|---|
play drum [(2) Bass Drum v] for (0.25) beats | 0.25 |
rest for (0.75) beats | 0.75 |
| Together | 1 |
How to use this: Click the green flag. Nothing else to press — the drum counts four beats out loud.
5 · Why the drum lights up
Each hit switches the drum to its drum-b costume, then back. Now you can see the beat as well as hear it. It also helps when you are fixing a beat that sounds wrong.
Basic — a beat and a dancer 24 min
Start a new project. Add the Music extension. Pick a dark backdrop, such as Spotlight.
Step 1 — the band
- Add the Drum sprite and call it
Kick. - Add the Drum-snare sprite and call it
Snare. - Add the Ballerina sprite. She is the dancer.
- Make a variable called
bpm, for all sprites.
Step 2 — the kick keeps the beat
- On the Kick:
when flag clicked, thenset [bpm v] to (100)andset tempo to (bpm). - Add
forever. Inside it, put the four lit-drum blocks from the Learnt. - After them, add
rest for (1) beats. That gap is where the snare goes.
Step 3 — the snare answers
- In the Kick’s loop, put
broadcast [snare v]just before the last rest. - On the Snare:
when I receive [snare v]. - Under it: switch to
drum-snare-b, play drum(1) Snare Drumfor 0.25 beats, switch back todrum-snare-a.
Step 4 — the dancer steps on every beat
- In the Kick’s loop, add
broadcast [beat v]at the start of each beat — twice per loop. - On the Ballerina:
when I receive [beat v]andnext costume.
when flag clicked
set [bpm v] to (100)
set tempo to (bpm)
forever
broadcast [beat v]
switch costume to [drum-b v]
play drum [(2) Bass Drum v] for (0.25) beats
switch costume to [drum-a v]
rest for (0.75) beats
broadcast [beat v]
broadcast [snare v]
rest for (1) beats
end
when I receive [snare v]
switch costume to [drum-snare-b v]
play drum [(1) Snare Drum v] for (0.25) beats
switch costume to [drum-snare-a v]
when I receive [beat v]
next costume
How to use this: Click the green flag. Nothing else to press — boom, tap, boom, tap, and the Ballerina dances to it. Press the red stop sign to end it.
The snare plays at the same time as the kick.
The broadcast is in the wrong place. Put broadcast [snare v] after the kick’s rest for (0.75) beats, not before it.
It plays far too slowly.
The tempo is still 60, which is where Scratch starts. Check set tempo to (bpm) runs before the loop.
The drum stays lit all the time.
The second switch costume to [drum-a v] is missing, or it is after the rest instead of before it.
The Ballerina does not move.
Check the message names match exactly: beat in the broadcast and in when I receive [beat v].
Faster and faster
Make the drum speed up until nobody could dance to it.
- The first bar of four beats is at tempo 60.
- Every new bar is 30 faster: 60, 90, 120, 150, 180.
- After the bar at 180 it stops and says “Too fast to dance to!”.
How to use this: Click the green flag. Nothing else to press — watch the bpm box climb as the drum gets faster.
Teacher reveal
when flag clicked
set [bpm v] to (30)
repeat until <(bpm) = (180)>
change [bpm v] by (30)
set tempo to (bpm)
repeat (4)
switch costume to [drum-b v]
play drum [(2) Bass Drum v] for (0.25) beats
switch costume to [drum-a v]
rest for (0.75) beats
end
end
say [Too fast to dance to!] for (3) seconds
Starting at 30 and adding first means the box only ever shows a tempo that is playing. Pupils who add at the end of the loop see 210 on the Stage — a good one to discuss.
Boom, boom, rest, clap
A rest is part of the rhythm. Use one on purpose.
- Each bar is four beats: kick, kick, a rest, a clap.
- The clap is drum 8, played by the Snare.
- During the rest, the Kick says “rest”.
- Tempo 120, four bars, then stop.
How to use this: Click the green flag. Nothing else to press — count along: boom, boom, rest, clap.
Teacher reveal
when flag clicked
set [bpm v] to (120)
set tempo to (bpm)
repeat (4)
switch costume to [drum-b v]
play drum [(2) Bass Drum v] for (0.25) beats
switch costume to [drum-a v]
rest for (0.75) beats
switch costume to [drum-b v]
play drum [(2) Bass Drum v] for (0.25) beats
switch costume to [drum-a v]
rest for (0.75) beats
say [rest]
rest for (1) beats
say []
broadcast [clap v]
rest for (1) beats
end
The Snare runs when I receive [clap v] with drum (8) Hand Clap. The last rest for (1) beats is the clap’s beat — without it, the next bar starts on top of the clap.
Three drums, three scripts
Each drum plays its own part in its own script. Make them stay together.
- Add the Drum-highhat sprite. It plays drum 6 on every half beat.
- The Kick plays on beats 1 and 3. The Snare plays on beats 2 and 4.
- The Stage sets the tempo to 100, then broadcasts
go. All three start ongo. - No drum may use a broadcast from another drum.
How to use this: Click the green flag. Nothing else to press — watch all three drums light, and check they finish together.
Teacher reveal
when I receive [go v]
repeat (8)
switch costume to [drum-b v]
play drum [(2) Bass Drum v] for (0.25) beats
switch costume to [drum-a v]
rest for (0.75) beats
rest for (1) beats
end
when I receive [go v]
repeat (8)
rest for (1) beats
switch costume to [drum-snare-b v]
play drum [(1) Snare Drum v] for (0.25) beats
switch costume to [drum-snare-a v]
rest for (0.75) beats
end
when I receive [go v]
repeat (32)
switch costume to [drum-highhat-b v]
play drum [(6) Closed Hi-Hat v] for (0.25) beats
switch costume to [drum-highhat-a v]
rest for (0.25) beats
end
Kick, Snare, Hi-hat. This works because every script counts in beats and there is only one tempo. Try it with wait (0.5) seconds instead of rests, then change the tempo — the drums drift apart straight away.
Dance party
Put it all together, and give the player a tempo knob.
- The Ballerina counts in: “1”, “2”, “3”, “4”, one per beat.
- Then the three drums from Challenge 3 play for ever, and she dances on every beat.
- ↑ adds 10 to the tempo and ↓ takes 10 away. It never goes below 60 or above 200.
- The bpm box always shows the tempo you hear.
How to use this: Click the green flag, then click the stage once and press ↑ or ↓ to change the tempo while the band plays.
Teacher reveal
when flag clicked
set [bpm v] to (100)
set tempo to (bpm)
say [1]
rest for (1) beats
say [2]
rest for (1) beats
say [3]
rest for (1) beats
say [4]
rest for (1) beats
say []
broadcast [go v]
when [up arrow v] key pressed
if <(bpm) < (200)> then
change [bpm v] by (10)
set tempo to (bpm)
end
The count-in is on the Ballerina; the arrow keys are on the Stage. ↓ is the same as ↑ with -10, and it checks <(bpm) > (60)> instead. The drums use forever instead of repeat.
Summary 5 min
- Add Extension → Music gives you the Music blocks.
- Music blocks count in beats. The tempo says how long a beat is.
- At tempo 60 a beat is one second; at 120 it is half a second.
rest for (1) beatsis silence that still counts.- Scripts that count in beats stay together, even in different sprites.
- Extension
- Extra blocks you add to Scratch, like Pen and Music.
- Beat
- One tap of your foot in a song.
- Tempo
- How many beats fit in one minute — the speed of the music.
- Rest
- A gap of silence, measured in beats.
- bpm
- “Beats per minute”, our name for the tempo variable.
Hand in
Save your beat. Next lesson the band gets a tune: notes, instruments, and a letter that climbs as the music goes up.