Lab 09: Exploring Music
- Learn some fundamentals of sound and music
- Create musical compositions
Having explored and used many of the robot commands by now, you have seen that your robot make beeps when you call the beep() function. For instance, if you execute the following command:
This command tells your robot to play a tone at 880 Hertz for 3 seconds. Hertz is
a unit that measures frequency.
1Hertz = 1cycle / second
Therefore, a beep at 880 Hz represents 880 complete cycles per second. Humans can hear frequencies in the 20 Hz to 20000 Hz (or 20 Kilo Hertz) range and are able to distinguish sounds that differ only by a few Hertz (as little as 1 Hz). This ability varies from person to person.
Try the following commands and see if you can distinguish between the two tones:
beep(1, 440) beep(1, 450)
To make the tones more distinctive, place the commands above in a loop so
that you can repeatedly hear the alternating tones.
Do This: Program the Scribbler to create a siren by repeating two different tones. You will have to experiment with different pairs of frequencies (they may be close together or far apart) to produce a realistic sounding siren. Write your program to play the siren for 15 seconds.The louder the better! You can also have Myro make a beep directly out of your computer, rather than the robot, with the command: