Lab 3
Read the documentation for the "make-tone" function. For all of the following, use a "volume" of 0.5 or lower, to prevent clipping (a.k.a. distortion).
First, Define a sound containing two overlaid tones whose frequencies are separated by 4 Hz. Next, define a sound containing two overlaid tones whose frequencies are separated by 2 Hz. Finally, define a sound containing two overlaid tones whose frequencies are separated by 1 Hz. Do you hear a "beating" between the two tones when you play them? How is the rate of the beating related to the difference between the two frequencies? Write your observations in the form of a comment.
Search the web to find the frequencies of the "C Major" scale from middle C up one octave. Define a sound that contains the notes of this scale, in sequence. See if you can avoid redundancy where possible.
Write code that computes the interval (ratio) between each pair of adjacent notes in the scale. How many different intervals are present? Write your observations in the form of a comment.
(Note: I’m not asking you to write a function, or to abstract over the repeated math. You can just go ahead and write seven little expressions.)
Do HtDP 2e, exercise 31
Do HtDP 2e, exercise 34
Do HtDP 2e, exercise 40
Do HtDP 2e, exercise 48. Write your findings in the form of a comment.
Online, find a piece of sheet music for a song that you know. Use synth-note to translate at least four measures of the song into a racket program.
Using big-bang, develop a program that plays a hi-hat every second. Read the documentation for the andplay function, which will be useful here.
Extend this program so that its "state" is a boolean. When the boolean value is #true, the hi-hats play. When it’s #false, the hi-hat becomes a kick. When the user presses the space bar, the state toggles from true to false.