Drum Machine and Samples

Extension name: plight

This extension implements a sampled drum kit.


Author Name: Phil Light and Roger B. Dannenberg;
Author Email: rbd@cs.cmu.edu;

Additional File: drum.lsp;
Additional File: beats.props;
... and wav files and more ...

Usage:

See description below for details. For a quick demo, try this:
load "plight/drum.lsp"
play plight-drum-example()

Description

The drum machine software in demos/plight deserves further explanation. to use the software, load the code by evaluating:

load "plight/drum.lsp"
exec load-props-file(strcat(*plight-drum-path*, 
                            "beats.props"))
exec create-drum-patches()
exec create-patterns()

Drum sounds and patterns are specified in the beats.props file (or whatever name you give to load-props-file). This file contains two types of specifications. First, there are sound file specifications. Sound files are located by a line of the form:

set sound-directory = "./"

This gives the name of the sound file directory, relative to the beats.props file. Then, for each sound file, there should be a line of the form:

track.2.5 = big-tom-5.wav

This says that on track 2, a velocity value of 5 means to play the sound file big-tom-5.wav. (Tracks and velocity values are described below.) The beats.props file contains specifications for all the sound files in plight using 8 tracks. If you make your own specifications file, tracks should be numbered consecutively from 1, and velocities should be in the range of 1 to 9.

The second set of specifications is of beat patterns. A beat pattern is given by a line in the following form:

beats.5 = 2--32--43-4-5---

The number after beats is just a pattern number. Each pattern is given a unique number. After the equal sign, the digits and dashes are velocity values where a dash means "no sound." Beat patterns should be numbered consecutively from 1.

Once data is loaded, there are several functions to access drum patterns and create drum sounds (described below). The plight/drum.lsp file contains an example function play-drum-example() to play some drums. There is also the file plight/beats.props to serve as an example of how to specify sound files and beat patterns.

The following functions do not "autoload", so be sure to call

load "plight/drum.lsp"
in your main program to load the functions.

drum(tracknum, patternnum, bpm) [SAL]
(drum tracknum patternnum bpm) [LISP]
Create a sound by playing drums sounds associated with track tracknum (a FIXNUM) using pattern patternnum. The tempo is given by bpm in beats per minute. Normally patterns are a sequence of sixteenth notes, so the tempo is in sixteenth notes per minute. For example, if patternnum is 10, then use the pattern specified for beats.10. If the third character of this pattern is 3 and tracknum is 5, then on the third beat, play the soundfile assigned to track.5.3. This function returns a SOUND.

drum-loop(snd, duration, numtimes) [SAL]
(drum-loop snd duration numtimes) [LISP]
Repeat the sound given by snd numtimes times. The repetitions occur at a time offset of duration, regardless of the actual duration of snd. A SOUND is returned.

length-of-beat(bpm) [SAL]
(length-of-beat bpm) [LISP]
Given a tempo of bpm, return the duration of the beat in seconds. Note that this software has no real notion of beat. A "beat" is just the duration of each character in the beat pattern strings. This function returns a FLONUM.