About RhythmLab

I wrote RhythmLab because I couldn't find any software which would easily let me construct and visualize polyrhythms (rhythms in which a measure is divided into different subdivisions in different voices: for example, 5 against 7). RhythmLab is distributed under the Gnu General Public Licence as a tarball (click here to download) containing source and an x86 Linux executable linked against libc6, gtk 1.2.1, and audiofile 0.16. You'll probably want some percussion samples, as well (see under Links). The code is intended to be portable to other Linux architectures and other POSIX platforms supporting OSS and pthreads, but hasn't been tested (patches are welcome).

User Interface

screen image

(appearance may vary depending on selected theme)

Per-track controls

From left to right and, within that, top to bottom:

Volume scale: by default, is adjustable from 0 to 11. All volumes are relative: increasing the volume of one track won't necessarily make the overall volume lounder, because the other tracks will become softer to compensate.

Period scale: controls the the number of beats into which this track is divided.

Change wavefile button: brings up a file selection dialog to choose a new sample. (The engine also can generate square waves itself, but there's no user interface to do so yet: you need to edit the savefiles directly.)

Delete track button: deletes this track.

Balance scale: if < 0, makes the right channel softer: if > 0, makes the left softer. (I use this to help me pick out a particular track, by setting one track to be one channel and all the others to be the other, and then twiddling the channel volumes with a mixer or the balance knob on my stereo.)

Pattern area: controls the relative volume of each beat, and displays which beat is current. The area is divided into rectangles arranged left to right, one for each beat. Clicking in the upper half of the rectangle makes the (again, relative) volume for that beat louder, and clicking in the lower half makes it softer. When you move the mouse within the pattern area, a label just below the top displays the current beat you're over, its current relative volume, and whether clicking would make it louder or softer. (If gtk is very cramped for space, I think it makes this label 0-height. Either resize the window to be bigger, or bug me to implement scrollbars.) At the very top, the current sample file's name is displayed (or "NONE", for a square wave or empty sample).

Top Controls

Bpm scale: controls the speed at which the rhythms are played, in beats per minute. In constant-measure-time mode, the beat specified is the one with the highest period. (In constant-beat-time mode, it doesn't matter, because all beats are the same length.)

New Track button: creates a new track with volume 5, period 1 and an zero-volume sample waveform. Brings up dialog to select a new sample.

Pause/Restart button: pauses or restarts playing the current rhythm. The sound output device is closed while playing is paused.

"Constant Time For" radio buttons: control whether each beat takes a time proportional to 1/period, and thus all tracks go through a full cycle in the same time (polyrhythm), or whether each beat takes a constant time, so the absolute length of a full cycle varies from track to track, being proportional to the period (cyclic rhythm). These two are duals in some sense, since a track with period p in constant-beat-time is equivalent to a track with period lcm (all periods)/p in constant-measure-time.


I hope that the File menu's New, Open..., Save, Save As..., and Quit, and the Help menu's About are relatively self-explanatory. Display/Hide Controls hides all the per-track controls except the pattern area, if you want more screen real estate for it.

Save File Format

At the top level, there are three keywords:

In track mode (all volumes are relative volumes, and expressed as integers):

Command-line options


I found both Trommler, by Robert Muth, and Green Box, by Daniel Venkitachalam, to be inspirational: if RhythmLab isn't quite what you're looking for, you might want to check them out.

The percussion samples I've been using (relied upon by the contents of the examples directory) are downloadable from the Green Box page. The Trommler README suggests the following:

(Warning: audiofile does not currently do sample rate conversion, although it is scheduled to do so in the future. In the meantime, you may need to use sox to do sample rate conversion.)

Polyrhythms are traditional in parts of Africa: see C.K. Ladzekpo's Foundation Course in African Dance Drumming for Anlo-Ewe drumming, for example. Cyclic rhythm is a compositional technique Philip Glass took from South Asian classical music: for a more complete discussion, try the ICM Percussion primer.

Henry Cowell, in New Musical Resources (1919), suggested (among many other things) the exploration of polyrhythms within a Western art-music context. He and Leon Termin (better known, if not well-known, as inventor of the theremin) invented the rhythmicon, a keyboard-driven rhythm instrument. Conlon Nancarrow adopted Cowell's suggestion to manually punch player piano rolls. His work includes canons with voices running at different tempos, canons in which voices accelerate relative to others, pieces reminiscent of jazz, and other pieces. For more information, check out this link, or Kyle Gann's page (or buy his book).

(This is far from an exhaustive musicological discussion: it's just a list of sources I found particularly influential or entertaining.)

If you have questions, ideas, patches, more links for any of the above, or whatever, please feel free to mail me, Aaron Lav.