GoalWrite a tune as a list of notes and beats, find the part that repeats and turn it into an algorithm.
New words
pitch · how high or low a note soundsbeat · a unit of time in music: at tempo 60 one beat lasts one secondrest · a pause in the musictempo · how fast the beats go
Explanation
To code a tune, first write it as a list of notes and beats. Then look for parts that repeat. Write each repeated part only once and add a repeat step. A rest is a pause, and Scratch has a “rest for” block. The notes C, D, E, F, G, A and B have the numbers shown below. At tempo 60, one beat takes one second, so half a beat takes half a second. When you write “repeat steps 2 to 4 one more time”, check the step numbers carefully. They must match the steps that you want to play again.
Note
C
D
E
F
G
A
B
Number
60
62
64
65
67
69
71
Worked examples
Part
Notes and beats
Part 1
E 0.5, E 0.5, G 1
Part 2
E 0.5, E 0.5, G 1
Part 3
A 1, G 2
The kite tune has three parts. Part 1 and Part 2 are exactly the same, so we can repeat them. The numbers after the notes are beats.
Step
Instruction
1
Start program when the green flag is clicked
2
Play note 64 (E) for 0.5 beats
3
Play note 64 (E) for 0.5 beats
4
Play note 67 (G) for 1 beat
5
Repeat steps 2 to 4 one more time
6
Play note 69 (A) for 1 beat
7
Play note 67 (G) for 2 beats
8
Stop program
The algorithm for the kite tune writes Part 1 once. Steps 2 to 4 are repeated one more time. The program plays E, E, G, E, E, G, A, G. The whole tune lasts (0.5 + 0.5 + 1) × 2 + 1 + 2 = 7 beats.
The same algorithm as a Scratch program. The repeat (2) block plays Part 1 two times in all.
Class activity
Rhythm writer (with family): make a rhythm with claps (1 beat), table taps (half a beat) and rests (1 beat). For example: clap, tap, tap, rest, clap, tap, tap, rest, tap, tap. Write the rhythm down, one action on each line. Find the part that repeats. Write an algorithm that uses a repeat step. Ask someone to perform your rhythm using only your algorithm. Did they play it as you planned?
Practice
1
The wave tune plays C for 1 beat, E for 1 beat, G for 0.5 beats and G for 0.5 beats. It plays this 3 times. Complete steps 4 to 6 of the algorithm and say how long the tune takes.
Step
Instruction
1
Start program when the green flag is clicked
2
Play note 60 (C) for 1 beat
3
Play note 64 (E) for 1 beat
4
?
5
?
6
?
7
Stop program
Step 4 is Play note 67 (G) for 0.5 beats. Step 5 is Play note 67 (G) for 0.5 beats. Step 6 is Repeat steps 2 to 5 two more times. The tune takes (1 + 1 + 0.5 + 0.5) × 3 = 9 beats, which is 9 seconds.
2
How many beats does the kite tune have in all? How many seconds does it take at tempo 60?
7 beats, which is 7 seconds at tempo 60.
3
Write the Scratch block that plays the note F for 2 beats.
play note (65) for (2) beats
4
This program should play C, D and E. Which block is wrong and what should it say?
The third block plays G (67). It should play E, so it must say play note (64) for (1) beats.