Lab 7
THIS LAB IS DUE ON FRIDAY, OCTOBER 15.
In this lab, I’d like you to create one test case for each function *before* you develop the function itself. Use check-expect for this.
Here’s an example of a function definition accompanied by a test case defined using check-expect:
;; compute the square of half a number (define (sqhlf x) (* (/ x 2) (/ x 2))) (check-expect (sqhlf 30) 225)
Use the "Intermediate Student" language for this lab.
Develop the function up-maj-3, that accepts a frequency and returns the frequency that is higher by a major third.
Develop the function up-maj-3/nn, that accepts a MIDI note number and returns the MIDI note number that is higher by a major third. Note: yes, this is a very simple function.
Develop the function note-num->octave, that accepts a MIDI note number and returns the octave that it belongs to. Look up midi note numbers online to see which ones correspond to which note.
Develop the function note-num->class, that accepts a MIDI note number and returns a name of the note. Here are the names: "c", "c♯", "d", "d♯", "e", "f", "f♯", "g", "g♯", "a", "a♯", and "b". Note we’re arbitrarily choosing the "sharp" names as the ones that this function will return.
Develop the name->note-num function, that accepts a note name and an octave number and returns the MIDI note number that it represents. For this function, along with the names given above, you must also accept the names "d♭", "e♭", "g♭", "a♭", and "b♭". These are synonyms for the corresponding sharp. That is, "d♭" should produce the same result as "c♯".
WHEN YOU GET TO THIS POINT, SHOW ME WHAT YOU’VE GOT.
Develop the name->rsound function, that accepts a note name and an octave number and returns an rsound representing a tone of length 1/2 second at the corresponding frequency.