Learning Goals 3 min
By the end of this lesson you will be able to:
- Add the Music extension via the bottom-left blue button, and recognise that the new pink Music palette is separate from Sound, Pen, and every other built-in palette.
- Name the seven main Music blocks: play drum (1 v) for (0.25) beats, rest for (0.25) beats, play note (60) for (0.5) beats, set instrument to (1 v), set tempo to (60), change tempo by (20), and the round (tempo) reporter.
- Explain the difference between a drum (a fixed percussion hit, 1 of 18) and an instrument (a melodic voice, 1 of 21) — and where to find the dropdown for each.
Warm-Up — what's missing from your block menu 7 min
You've been using Scratch for three levels now. Look at your block menu on the left. Count the palettes from top to bottom — Motion, Looks, Sound, Events, Control, Sensing, Operators, Variables, My Blocks. That's nine.
Open the Sound palette. What blocks live there?
Reveal the answer
play sound [meow v] until done, start sound [meow v], stop all sounds, plus volume and pitch effects. All of those play recorded audio files. If you want a drum hit or a piano note, there's no block for it — Sound only plays clips you've already imported or recorded.
So if you wanted to write code that plays a real drum rhythm — kick, snare, kick-kick, snare — without recording each hit yourself, where would you get those blocks?
Reveal the answer
You'd need an extension. You met your first extension in Cluster B (Pen). Today you meet the second one — Music. Click the blue Add Extension button at the bottom-left of the editor, scroll until you see the Music tile (a yellow circle with a beamed eighth note), click it. A new pink palette appears at the bottom of your block menu — and suddenly you have drums, notes, instruments, and tempo blocks ready to use.
Today is a tour lesson. We're not composing a song yet — we're just learning what's in the Music palette so we know what we have to work with in the next four lessons.
New Concept — the Music palette and its seven blocks 15 min
The Music extension adds seven blocks to your block menu. Six are stack-shaped (you snap them like normal action blocks) and one is round (a reporter). Let's tour each.
How to add the extension
Bottom-left of the editor: the blue Add Extension button (it looks like a stack of blocks with a plus sign). Click it. A grid of extension tiles opens. Find the Music tile — yellow background, beamed eighth notes. Click it. The dialog closes, and a new pink Music palette appears at the bottom of your block menu.
when flag clicked
play drum (1 v) for (0.25) beats
(1 v) dropdown picks which drum; (0.25) picks how long it sounds for.Block 1 — play drum for beats
play drum (1 v) for (0.25) beats. The dropdown has 18 built-in drums — snare, bass drum (kick), side stick, crash cymbal, open hi-hat, closed hi-hat, tambourine, hand clap, claves, wood block, cowbell, triangle, bongo, conga, cabasa, guiro, vibraslap, cuica. Numbers 1 to 18 in the dropdown. The "beats" number says how long Scratch waits before moving to the next block — at the default tempo (60 BPM), 0.25 beats is a sixteenth note (about a quarter of a second).
Block 2 — rest for beats
rest for (0.25) beats. Plays silence for that many beats. Use this between drum hits to make rhythms with gaps — like kick, rest, snare, rest.
Block 3 — play note for beats
play note (60) for (0.5) beats. Plays a melodic note from the currently-set instrument. The number is a MIDI note number — 60 is middle C. 62 is D, 64 is E, 67 is G, 72 is the C an octave up. Don't worry about memorising — there's a piano picker that opens when you click the number, so you can just click the key you want.
Block 4 — set instrument to
set instrument to (1 v). Changes the voice of every play note () that comes after. The dropdown has 21 built-in instruments: piano, electric piano, organ, guitar, electric guitar, bass, pizzicato strings, cello, trombone, clarinet, saxophone, flute, wooden flute, bassoon, choir, vibraphone, music box, steel drum, marimba, synth lead, synth pad. Numbers 1 to 21.
when flag clicked
set instrument to (4 v)
play note (60) for (0.5) beats
play note (64) for (0.5) beats
play note (67) for (1) beats
Block 5 — set tempo to
set tempo to (60). The tempo is in beats per minute (BPM). 60 BPM means one beat per second — the default. 120 BPM is brisk pop. 80 BPM is a slow song. 200 BPM is a fast EDM track. Tempo controls how long "1 beat" actually lasts.
Block 6 — change tempo by
change tempo by (20). Nudges the tempo up (positive) or down (negative). Handy for "speed up the song with each loop" patterns.
Block 7 — tempo reporter
The round (tempo) block is a reporter — it reports the current tempo as a number. Tick the checkbox next to it to show the tempo on the Stage. Drop it into operators or say-blocks like say (tempo) to display it.
when flag clicked
set tempo to (60)
say (tempo) for (2) seconds
change tempo by (40)
say (tempo) for (2) seconds
Worked Example — a guided tour of every Music block 12 min
Open Scratch. We'll add the Music extension and try every single block. Eight steps. No song at the end — just a tour, like flipping through a new instrument shop in KL Sentral.
Step 1 — Add the extension
Bottom-left blue button. Music tile. Click. The pink Music palette appears at the bottom of your block menu — scroll down to see it.
Step 2 — Drop the hat
From Events: when ⚑ clicked.
Step 3 — Hear a drum
From Music: play drum (1 v) for (0.25) beats. Click the flag. Listen — you hear a single snare drum hit. Open the (1 v) dropdown and try drum number 2 (bass drum / kick). Click flag again — deeper thud.
Step 4 — Build a tiny rhythm
Snap four drum blocks in a row: kick (2), snare (1), kick (2), snare (1), each for 0.25 beats. Click the flag — a basic rock beat. Add a rest for (0.25) beats in between and the rhythm gains air.
Step 5 — Switch to notes
Delete the drum stack. From Music: set instrument to (1 v) — leave it on piano. Then play note (60) for (0.5) beats. Click the flag — a clean middle C on piano. Click the (60) and the piano picker opens — try clicking different keys.
Step 6 — Change the instrument
Change set instrument to (1 v) from 1 to 4 (guitar). Click the flag — same note, different voice. Try 13 (wooden flute) and 19 (marimba). The note number didn't change — just the voice that plays it.
Step 7 — Play with tempo
Add set tempo to (60) at the top of the stack. Below it, drop two notes: middle C and the C above it. Hit the flag and listen to the pace. Now change tempo to 200 and hit the flag again — the same notes play more than three times faster, because the beat-length shrinks.
Step 8 — Read the tempo
Tick the checkbox next to the round (tempo) block in the palette. A small read-out appears on the Stage showing the current tempo. Change it with change tempo by (-50) and watch the number on the Stage drop.
The full assembled tour stack
when flag clicked
set tempo to (120)
play drum (2 v) for (0.25) beats
play drum (1 v) for (0.25) beats
rest for (0.25) beats
play drum (2 v) for (0.25) beats
set instrument to (4 v)
play note (60) for (0.5) beats
play note (64) for (0.5) beats
play note (67) for (1) beats
change tempo by (-40)
say (tempo) for (2) seconds
What you just toured: seven blocks, eighteen drums, twenty-one instruments, and a project-wide tempo setting. That's the whole Music extension. The next four lessons (L04-13 onwards) will dig deeper — first into rhythm with drums, then melody with notes, then putting them together into a real song.
Try It Yourself — three palette drills 12 min
Goal: Play every one of the 18 drums in a row, each for 0.2 beats, so you know which number is which sound. Don't worry about rhythm — this is an audio test, not a song.
when flag clicked
set tempo to (120)
play drum (1 v) for (0.2) beats
play drum (2 v) for (0.2) beats
play drum (3 v) for (0.2) beats
play drum (4 v) for (0.2) beats
play drum (5 v) for (0.2) beats
say [keep going up to 18!] for (2) seconds
Think: Make a note of which numbers you like — your favourite drums for next lesson. Many students like 1 (snare), 2 (bass), 5 (open hi-hat), and 8 (hand clap).
Goal: Play the same three notes (60, 64, 67) using five different instruments in turn. You'll hear what makes piano sound different from guitar from flute from marimba from steel drum.
when flag clicked
set tempo to (120)
set instrument to (1 v)
play note (60) for (0.3) beats
play note (64) for (0.3) beats
play note (67) for (0.3) beats
set instrument to (4 v)
play note (60) for (0.3) beats
play note (64) for (0.3) beats
play note (67) for (0.3) beats
set instrument to (12 v)
play note (60) for (0.3) beats
play note (64) for (0.3) beats
play note (67) for (0.3) beats
Think: The note didn't change, only the instrument. That's how composers say things like "play the violin part on the cello" — same notes, different voice.
Goal: Use the (tempo) reporter inside a say () for () seconds to display the current tempo on the Stage, then use change tempo by () three times to walk the tempo from 60 → 120 → 60 → 200, saying the new value at each step.
when flag clicked
set tempo to (60)
say (tempo) for (1) seconds
change tempo by (60)
say (tempo) for (1) seconds
change tempo by (-60)
say (tempo) for (1) seconds
change tempo by (140)
say (tempo) for (1) seconds
Think: Tempo is just a number stored by Scratch. You can read it (reporter), set it (set block), and nudge it (change block) — same three things you'd do with any variable. That's not an accident. Many Music blocks act like variables behind the scenes.
Mini-Challenge — Hana's silent piano 5 min
"I'm pressing the flag but nothing plays"
Hana wants to play a quick scale on the piano. She writes this:
when flag clicked
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
Why does the same script work for Hana and not for Adam?
Reveal one valid solution
Adam never added the Music extension. The play note () blocks Hana sees only exist in her project because she added Music. When Adam copies the script (or rebuilds it from memory) and goes looking for the block, it's not in any palette — because Music isn't on by default. Even if he could somehow paste the script in, Scratch would refuse to run the missing blocks.
The fix for Adam is one click — bottom-left blue button, Music tile, click. Now the pink Music palette appears, the play note () blocks are available, and the script plays exactly the same scale.
when flag clicked
set instrument to (1 v)
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
While Adam's there, it's good practice to add set instrument to (1 v) at the top so he knows for sure what voice he's hearing. The default is piano, but a previous script in the project might have changed it.
The lesson: extensions are per-project. Music isn't part of Scratch — it's an add-on you opt into every time you make a new project that needs it.
Recap 3 min
You added your second extension — Music. The pink palette adds seven blocks: play drum () for () beats, rest for () beats, play note () for () beats, set instrument to (), set tempo to (), change tempo by (), and the round (tempo) reporter. Eighteen drums, twenty-one instruments, one project-wide tempo. Today was the tour — next lesson we start composing.
- Extension
- An add-on palette you turn on per-project from the blue Add Extension button at the bottom-left of the editor. Pen (Cluster B) and Music (Cluster C) are both extensions.
- Drum
- A fixed percussion sound played by play drum (1 v) for () beats. 18 to choose from in the dropdown — snare, bass, hi-hat, tambourine, claves, and more. No pitch, just the hit.
- Instrument
- A melodic voice used by play note (). 21 to choose from — piano, guitar, marimba, flute, choir, and more. The current instrument is set with set instrument to (1 v) and stays in effect until changed.
- MIDI note number
- The number used by play note (60) for () beats. 60 = middle C, 62 = D, 64 = E, 67 = G, 72 = C one octave up. Click the number to open Scratch's piano picker.
- Tempo (BPM)
- How many beats fit in one minute. 60 BPM = one beat per second. Set with set tempo to (), nudged with change tempo by (), read with the round (tempo) reporter.
- Beat
- The unit of musical time. How long a beat lasts depends on the tempo. The number you put in play drum () for (0.25) beats says how many beats the block waits before moving on.
Homework 2 min
The Music-Block Scavenger Hunt. A worksheet-style task to make sure every block in the Music palette is in your fingers before next lesson.
- New Scratch project. Add the Music extension.
- Use play drum () for (0.3) beats to play your three favourite drums in a row (any three from 1–18). Write down which numbers you picked.
- Use set instrument to () + play note (60) for (0.5) beats to play middle C on instruments 1, 8, 13, and 19. Listen to each and write down which one you liked best.
- Use set tempo to () at three different values (60, 120, 200) before the same three notes. Notice how the pace changes even though the notes don't.
- Tick the checkbox next to (tempo) so the tempo shows on the Stage during your test.
- Save as
HW-L4-12-Music-Tour.sb3.
Total blocks should be around 12–18 — well under the L4 cap of 30.
Bring back next class:
- The
.sb3file. - A small piece of paper with: your three favourite drum numbers, your favourite instrument number, and which tempo you'd use for a sad song.
Heads up for next class: SCR-L04-13 is Play Drum, Play Note — we'll dig into the two performance blocks side by side, learn what each beat-number really means (sixteenth note, quarter note, half note), and use them inside repeat loops to build your first real rhythm.