GoalUse the music blocks to set the volume, play a sound and start a melody.
New words
volume · how loud or quiet a sound ismelody · a short tunemillisecond · a thousandth of a second, so 1000 milliseconds is 1 second
Explanation
The Music group has blocks for sound. The “set volume” block sets how loud sounds are, from 0 to 255. 0 means silence and 255 is the loudest. The “play sound until done” block lets you choose a sound from a list, such as giggle, twinkle or yawn. The program waits until the sound ends. The “start melody” block lets you choose a tune from a list, and you decide whether it repeats once or forever. A volume block only changes the sounds that come after it, so it must come before the sound.
Worked examples
Volume
What you hear
0
no sound at all
60
quiet
127
medium
255
the loudest
The volume number goes from 0 to 255. Here is a rough guide.
The order of blocks matters. In the first program the volume is set to 30 before the sound, so the sound is quiet. In the second program the sound plays first at the old volume. Then the volume is set, but it is too late for that sound.
Pause
Seconds
500 ms
half a second
1000 ms
1 second
2000 ms
2 seconds
5000 ms
5 seconds
The pause block counts in milliseconds. Pausing for 1000 milliseconds is the same as 1 second. Here is how some pauses are written.
Class activity
Volume dial (with a friend): draw a half-circle dial with 0 on the left and 255 on the right, and 127 in the middle. A friend points to a number and you hum on one note at that loudness: silent for 0, a whisper for 60, normal for 127 and strong (never shouting) for 255. Then the friend predicts which number you used. Which numbers were hard to tell apart? Why do we use numbers and not words like “loud”?
Practice
1
What does the block “set volume (0)” do to the sounds after it?
They are silent. You cannot hear them at all.
2
Which program plays the sound at volume 200? Why?
Program B. In program A the volume is set after the sound, so it is too late.
3
How many milliseconds are 3 seconds?
3000 milliseconds, because 1000 milliseconds is 1 second.
4
A melody is set to repeat forever. What happens when you press the button?
The melody plays again and again until something stops it, for example the “stop all sounds” block.