Lab 3
Read the documentation for the "make-tone" function. Play two overlaid tones whose frequencies are separated by 4 Hz. Next, play two overlaid tones whose frequencies are separated by 2 Hz. Finally, play two overlaid tones whose frequencies are separated by 1 Hz. Do you hear a "beating" between the two tones? How is the rate of the beating related to the difference between the two frequencies? Write your observations in the form of a comment.
Note: it will be helpful to comment out each call to play after you’ve listened to it, so that the various sounds don’t all play on top of each other.
Search the web to find the frequencies of the "C Major" scale from middle C up one octave. Develop a program that plays this scale. See if you can avoid redundancy where possible.
Write code that computes the interval between each pair of adjacent notes in the scale. How many different intervals are present? Write your observations in the form of a comment.
Do HtDP 2e, exercise 31
Do HtDP 2e, exercise 34
Do HtDP 2e, exercise 48
Design an interactive "kick hat snare hat" program, that plays a sound each time a key is hit. The first key causes a kick, the second causes a closed hi-hat, the third causes a snare, the fourth another closed hi-hat. After this, these repeat: kick hat snare hat, kick hat snare hat, and so forth.
Hint: think first about what the state of the world should be.
Design an interactive "rhythm test" application, that tests your ability to place a sound evenly between kicks. It should play a kick drum every second, allow you to play a snare by hitting a key and evaluate your performance. More specifically: When you hit a key, the program should check to see if your keystroke was halfway between the two kicks (to the nearest 1/28 of a second). If so, it plays a ding. If not, it plays a closed hi-hat (c-hi-hat-1).