Learning Goals 3 min
By the end of this lesson you will be able to:
- Use play drum (1 v) for (0.25) beats and name at least three of the 18 percussion sounds by their drum number.
- Use play note (60) for (0.5) beats and explain why
60is middle C and what each +1 means. - Wrap a sequence of drum and note blocks inside a repeat (4) to build a looping rhythm pattern.
Warm-Up — count the beats 7 min
Last lesson you added the Music extension. Now the magenta palette sits at the bottom of the palette list with two blocks at the top:
play drum (1 v) for (0.25) beats
play note (60) for (0.5) beats
Predict — without dragging anything yet — what each of these will do when you click them once on the stage:
Reveal: play drum (1 v) for (0.25) beats
You'll hear a short snare hit — about a quarter of a beat long. Drum number 1 is the snare. At the default tempo of 60 BPM (one beat per second), 0.25 beats lasts a quarter of a second. Quick, sharp, and over.
Reveal: play note (60) for (0.5) beats
You'll hear middle C held for half a second. Note 60 is middle C on a piano. The default instrument is the piano voice. Half a beat at default tempo = half a second.
Reveal: what if I click each block five times fast?
Each click queues a new sound on top of the last one. Five quick snare hits or five overlapping middle-Cs. The Music blocks don't wait for the previous click to finish — that's why we'll soon need scripts, not clicks, to keep the beat steady.
Today is about turning those two blocks from "thing you click" into a rhythm machine.
New Concept — drums and notes by number 15 min
The Music extension uses numbers for everything. No staff, no clefs, no sharps written as #. Just numbers. That's good news for coders — once you know the numbers, you can build any rhythm or melody from blocks.
The 18 drums
Click the little arrow in the play drum (1 v) for () dropdown. You'll see all eighteen percussion sounds. The ones you'll use 90% of the time:
play drum (1 v) for (0.25) beats
play drum (2 v) for (0.25) beats
play drum (3 v) for (0.25) beats
- 1 — Snare drum. The sharp tssh on beats 2 and 4 of most pop songs.
- 2 — Bass drum (kick). The deep boom on beats 1 and 3.
- 3 — Side stick. A wood-on-wood tock. Good for quiet patterns.
- 4 — Crash cymbal. The big splash at the start of a chorus.
- 5 — Open hi-hat. A longer metallic shimmer.
You can read the rest yourself from the dropdown. The numbers are stable — drum 1 is always snare on every Scratch project, on every computer, forever.
The notes — middle C is 60
Click the number slot in play note (60) for (). A tiny piano keyboard pops up. Each white and black key has a MIDI number. Middle C — the C in the middle of a real piano — is 60. Every step up by 1 is one semitone (one piano key, including black keys).
play note (60) for (0.5) beats
play note (62) for (0.5) beats
play note (64) for (0.5) beats
play note (65) for (0.5) beats
play note (67) for (0.5) beats
play note (69) for (0.5) beats
play note (71) for (0.5) beats
play note (72) for (0.5) beats
Memorise this table — you'll use it constantly:
- 60 = C (middle C)
- 62 = D
- 64 = E
- 65 = F
- 67 = G
- 69 = A
- 71 = B
- 72 = C (one octave higher)
The jumps between letters look uneven (2, 2, 1, 2, 2, 2, 1) because the black keys sit in between. 61 is C-sharp, 63 is D-sharp — the black keys. For now we'll stick to the white-key C major scale.
How beats work
Both blocks have a "for () beats" slot. A beat is a unit of time set by the tempo. At the default tempo of 60 BPM:
1beat = 1 second0.5beats = half a second (a quaver / eighth note)0.25beats = quarter of a second (a semiquaver)2beats = 2 seconds (a minim / half note)
You'll change the tempo next lesson. For now, every example uses the default 60 BPM so you can count seconds = beats.
Sequencing — they wait for each other
Drop two Music blocks under a hat and they play one after the other. This is different from clicking them five times by hand — when they're in a script, Scratch waits for the first to finish before starting the second:
when flag clicked
play drum (2 v) for (0.5) beats
play drum (1 v) for (0.5) beats
play drum (2 v) for (0.5) beats
play drum (1 v) for (0.5) beats
Worked Example — a four-beat drum loop 12 min
We'll build a classic boom-tssh-boom-tssh loop — the heartbeat of pop, K-pop, and most Scratch game soundtracks. Eight blocks total.
Step 1 — Start fresh with the Music extension loaded
New project. Click the blue Add Extension button (bottom-left), pick Music. The magenta palette appears.
Step 2 — Drop the hat
From Events: when ⚑ clicked.
Step 3 — Add a forever loop
From Control: forever. Snap it under the hat. We want this beat to keep going.
Step 4 — Add a repeat for the bar
From Control: repeat (4). Drop it inside the forever. Each loop of the repeat will play one quarter of a four-beat bar.
Step 5 — Kick on every beat
From Music: play drum (2 v) for (0.25) beats. Drop inside the repeat. Drum 2 is the kick.
Step 6 — Snare right after
From Music: play drum (1 v) for (0.25) beats. Snap under the kick, inside the same repeat. Drum 1 is the snare.
Step 7 — Hi-hat fillers
From Music: two more play drum (3 v) for (0.25) beats blocks. Side-stick on the off-beats. Four drum hits per repeat, repeated 4 times = 16 hits per loop of the forever.
Step 8 — Click the flag
You should hear a steady boom-tssh-tock-tock pattern that loops forever. If it sounds frantic, your beat values are too small. If it sounds sluggish, they're too big. 0.25 is the standard "one drum hit per beat" length.
The full assembled stack
when flag clicked
forever
repeat (4)
play drum (2 v) for (0.25) beats
play drum (1 v) for (0.25) beats
play drum (3 v) for (0.25) beats
play drum (3 v) for (0.25) beats
end
end
What you just built: the rhythm section of a song. You can stop the script with the red button. Try swapping drum 2 for drum 4 (crash cymbal) — does the loop still feel right? Try changing the repeat (4) to repeat (2) and listen for the shorter bar.
Try It Yourself — three rhythm drills 15 min
Goal: Play the C-major scale once when the flag is clicked. Use eight play note () for (0.4) beats blocks with the numbers 60, 62, 64, 65, 67, 69, 71, 72.
when flag clicked
play note (60) for (0.4) beats
play note (62) for (0.4) beats
play note (64) for (0.4) beats
play note (65) for (0.4) beats
play note (67) for (0.4) beats
play note (69) for (0.4) beats
play note (71) for (0.4) beats
play note (72) for (0.4) beats
Think: Why 0.4 and not 0.5? Because slightly shorter notes make a scale feel brisk instead of dragging. Try both and pick what you like.
Goal: Build a two-bar kick-snare beat that loops 8 times then stops. Use repeat (8) instead of forever. Kick on beats 1 and 3, snare on beats 2 and 4.
when flag clicked
repeat (8)
play drum (2 v) for (0.5) beats
play drum (1 v) for (0.5) beats
play drum (2 v) for (0.5) beats
play drum (1 v) for (0.5) beats
end
Think: Eight loops of four hits = 32 drum sounds, 16 seconds of beat. repeat () stops automatically — useful when you don't want music forever.
Goal: Play a short bit of Twinkle Twinkle Little Star — the first line. The notes are: C C G G A A G (long). Use 60, 60, 67, 67, 69, 69, 67. Hold each at 0.4 beats except the last G — hold it for 0.8 beats so it feels like the line ends.
when flag clicked
play note (60) for (0.4) beats
play note (60) for (0.4) beats
play note (67) for (0.4) beats
play note (67) for (0.4) beats
play note (69) for (0.4) beats
play note (69) for (0.4) beats
play note (67) for (0.8) beats
Think: You just used the beat-length slot for musical expression, not just timing. A held final note is how songs say "phrase over". You'll get to design whole songs in SCR-L04-15.
Mini-Challenge — Nadia's offbeat drumline 5 min
"Why does this sound wrong?"
Nadia wants a steady kick-snare-kick-snare loop. She writes:
when flag clicked
forever
play drum (2 v) for (1) beats
play drum (1 v) for (0.1) beats
play drum (2 v) for (1) beats
play drum (1 v) for (0.1) beats
end
Click the flag mentally and listen. What's making it sound wrong?
Reveal one valid fix
Nadia mixed two beat lengths. The kick takes a full second (1 beat), the snare takes barely a tenth of a second. Her loop is 2.2 seconds of "thud — tick — thud — tick" with no breathing room around the snare. A proper 4/4 beat wants equal-length hits:
when flag clicked
forever
play drum (2 v) for (0.5) beats
play drum (1 v) for (0.5) beats
play drum (2 v) for (0.5) beats
play drum (1 v) for (0.5) beats
end
Same four blocks. Same drums. The only change: every hit lasts 0.5 beats. The loop is now a steady 2-second bar with kick and snare evenly spaced. Beat length is the whole groove. Two drums with the wrong timing sound worse than one drum with the right timing.
Recap 3 min
You met the two heart blocks of the Music extension. play drum (1 v) for (0.25) beats picks one of 18 percussion sounds by number — snare is 1, kick is 2, hi-hat tap is 3 — and plays it for the given beat length. play note (60) for (0.5) beats plays a piano note by its MIDI number — 60 is middle C, +1 is one semitone up, and the white-key scale is 60-62-64-65-67-69-71-72. Both blocks sit one after another in a script and Scratch waits for each to finish before starting the next, which is what makes rhythm possible.
- Music extension
- The magenta palette you added last lesson. Adds drum, note, tempo, and rest blocks. Not loaded by default — every project needs the extension button.
- Drum number
- The integer 1–18 that picks which percussion sound plays.
1is snare,2is kick,3is side-stick. The dropdown shows all 18 by name. - MIDI note number
- The integer that picks which musical note plays. Middle C is
60; each +1 is one semitone up. White-key C major scale: 60, 62, 64, 65, 67, 69, 71, 72. - Beat
- The unit of time used by Music blocks. At default tempo (60 BPM) one beat equals one second. Beat lengths can be fractional —
0.25is a quarter of a beat. - Bar (measure)
- A group of beats that forms one rhythm pattern. A 4/4 bar has 4 beats. Our worked-example loop is one bar repeated forever.
Homework 2 min
The One-Sprite Band. Pick a Malaysian song you know — Rasa Sayang, Negaraku, Burung Kakak Tua — and code the first phrase as a Scratch melody.
- Start a new project, add the Music extension.
- Use the C-major scale table from class (60, 62, 64, 65, 67, 69, 71, 72) and figure out the first 6–10 notes of your song by ear, one at a time.
- Set each note's beat length to match the rhythm — long notes
0.8or1, short notes0.3or0.4. - Bonus: add a quiet drum on beat 1 of every phrase using play drum (3 v) for (0.25) beats.
Save as HW-L4-13-My-Song.sb3. Hit the flag — does it sound like your song? Be patient; ears need a few tries.
Bring back next class:
- The
.sb3file. - A list of the note numbers you used, in order, written on paper.
Heads up for next class: SCR-L04-14 meets set tempo to (60) and rest for () beats — the two blocks that turn "notes happening" into "music breathing".