1 Testing the Sound Library
2 Playing sounds
3 Experimenting with Rhythm
4 Exercises

Lab 4: trying out sounds

1 Testing the Sound Library

First, start up DrRacket and make sure you’re in the "Beginning Student With List Abbreviations" language. If you added any teachpacks, remove them, using Language|Remove all teachpacks.

Next, choose View|Show Log to show the log. This will make the waiting involved in the next step less painful.

Now, run this program:

(require (planet "main.rkt" ("clements" "rsound.plt" 2 5)))
(play ding)

If the planets are in alignment, you’ll watch about a minute of download and install, and then hear a ding. After the RSound library is installed, running the program again should take very little time.

2 Playing sounds

Beside ding, there are a number of other drum sounds that are built into the sound library:

Try playing some of these, using play.

3 Experimenting with Rhythm

For the next section of the lab, download the percussion.txt file. Put it in a directory of your choice. Open it in a new buffer, and set the language to Use the Language Declared in the Source.

Now, download tiny-percussion-tracker.rkt , and save it to the same directory. Open it in a new buffer. Run it. In the interactions window, call the function (go). You should hear a few closed hi-hats, two kicks, and a clap. You can call (go) as many times as you like. You can also use the (stop) function to stop the music.

Each line of "percussion.tkt" corresponds to a different instrument. The program in "tiny-percussion-tracker.rkt" reads these lines, converts them to sounds and times, and plays them.

This source file is not written in Beginning Student language; it’s written in Racket, and it uses a whole bunch of language forms that we have not seen. Don’t panic! We’ll introduce the forms that you need to know one by one. However, we also need to practice the skill of trying to figure out what something does, without really knowing it first.

So, for the next portion of the lab, you’re going to be "messing around" with this program, to try to get certain results. Don’t worry about messing up the program; you can always download it again, and the "undo" binding (ctrl-z/cmd-z) is your friend.

4 Exercises