Lab 16

This lab is due on Wednesday.

Use the Intermediate Student language level.

For test cases involving sounds, use rsound-equal? inside of a check-expect.

So, for instance, if you have a function called g that returns 69 frames of silence, you would test it like this:

(check-expect (rsound-equal? (g) (silence 69)))

  1. Copy or develop the data definition for a glump. Write at least two examples of glumps, including one with at least four notes, and two of them simultaneous. As in lecture, a glump is one of three things: a note, a sequence of two glumps, or an overlay of two glumps.

  2. Develop the highest function, that accepts a glump and returns the note number of the highest note in the glump.

  3. Develop the longest function, that accepts a glump and returns the note number of the longest note in the glump.

  4. Develop the serialize function, that accepts a glump and returns an rsound.

    This function should render notes using make-tone, synth-note, or another similar function.

    It should use rs-append to render sequences, and overlay to render overlays.

    Test this function by comparing it to the expected output rsound using rsound-equal?.

If you have time, try some of the following:

  1. Develop the double-time function, that cuts the duration of every note in a glump by two.

  2. Develop the shift-by-n function, that accepts a glump and an integer and produces a new glump where every note is higher by n half-steps.

  3. Take a simple melody, and use these two functions to combine it with itself in interesting ways.