Euclidean Rhythm Generator
Spread k onsets as evenly as possible over n steps — the Euclidean rhythms behind countless drum patterns and live-coding beats. Set the hits, the steps and a rotation, and copy the pattern straight into TidalCycles or Strudel.
E(3,8) is the Cuban tresillo; E(5,8) the cinquillo; E(2,5), E(4,9) and E(5,16) turn up in music worldwide. See the TidalCycles and Strudel cheat sheets for the (k,n) syntax.
How it works
A Euclidean rhythm spreads k onsets as evenly as possible across n steps, using the same process as Euclid's algorithm for the greatest common divisor. It is written E(k, n).
E(k, n) = k onsets distributed as evenly as possible over n steps
The remarkable result, described by Godfried Toussaint, is that a surprising number of traditional rhythms from around the world fall out of this one procedure.
Worked example
- E(3, 8) = x..x..x. — the tresillo, everywhere in Cuban and Latin music
- E(5, 8) = x.xx.xx. — the cinquillo
- E(2, 5) = x.x.. — a common Persian and Balkan figure
- E(4, 4) = xxxx — every step, because k equals n
Rotating a Euclidean pattern — starting it at a different step — produces most of the remaining familiar variants.
In practice
- Rotation is as important as the pattern. The same E(3, 8) rotated gives several distinct, usable grooves.
- Layer different n values for evolving patterns — E(3, 8) against E(5, 16) drifts in a musical way rather than a random one.
- Live coders get this for free. TidalCycles and Strudel express it as bd(3,8); the notation is built into the mini-notation.
- Good for hats and percussion, less so for kick patterns, where even distribution often fights the downbeat.