Lab/Homework Assignment, Due 11/21/2006
Build a Csound drumkit instrument that uses General MIDI drum samples and can
play the score excerpt DRUMTRAK.SCO. The score excerpt and drum sample files
are on the UTEMS ftp site under GMDrums.zip. All
the drum samples are aiff files whose root pitches have been set to the correct
GM note numbers. These are the
NN Description Filename
36 Kick Drum BD36.aif
38 Snare Drum SD38.aif
42 HiHat HH42.aif
43 Low Tom LoTom43.aif
46 Open HiHat OHH46.aif
47 Mid Tom MidTom47.aif
49 Crash Cymbal HiCrsh49.aif
50 High Tom HiTom50.aif
51 Ride Cymbal Ride51.aif
53 Bell of Cymbal Bell53.aif
Use Gen01 with deferred table size to load the sample files. Use loscil for
playback. You will need to convert from MIDI velocities (p4) to amplitudes and
Hint: the durations in the score are often shorter than the durations of the sample files being played. In some cases (esp. the crash cymbal), this will result in truncated decays. To adjust the note durations to match the drum samples, use the ftlen() function to determine the actual table size within the instrument, divide that by the sample rate, and adjust p3 accordingly, i.e.:
p3 = ftlen(ifn) / sr ;get length of this sample function and divide by sr to find duration in seconds.