Part 92

Euclidean Rhythms

Mathematical fairness = musical groove. The Bjorklund algorithm distributes k pulses across n steps as evenly as possible, and the results are rhythms humans have played for centuries.

The Problem: Spacing Beats Evenly

Imagine you have 8 time slots in a bar and you want to place 3 hits. Where do you put them?

You could cluster them at the start: X X X . . . . . But that leaves an awkward silence. You could try equal spacing, but 8 doesn't divide evenly by 3, so you can't space them perfectly. The Euclidean algorithm finds the mathematically fairest distribution: spread the gaps as evenly as possible.

For 3 hits in 8 slots, it produces this pattern:

Step: 1  2  3  4  5  6  7  8
Beat: X  .  .  X  .  .  X  .
Gaps: «— 3 —»«— 3 —»« 2 »

The gaps are 3, 3, 2: as even as possible when you can't divide 8 by 3. This is the tresillo, one of the most important rhythms in world music.

You Already Know These Rhythms

The remarkable thing about Euclidean rhythms is that they're not abstract math. They're rhythms people have been playing for hundreds of years. The algorithm just explains why they feel so natural.

Tresillo: E(3,8)

The 3-3-2 pattern above. You hear it in Cuban son, reggaeton, New Orleans second line, and thousands of pop songs. Clap it: ONE-two-three-FOUR-five-six-SEVEN-eight. It creates a push-pull tension against the straight 4/4 beat underneath.

Cinquillo: E(5,8)

Step: 1  2  3  4  5  6  7  8
Beat: X  .  X  X  .  X  .  X

Five hits in 8 slots. The tresillo's busier sibling. This is the rhythmic engine of Caribbean dance music. You hear it in calypso, soca, and Afro-Cuban genres.

Son Clave: E(3,8) rotated

Step: 1  2  3  4  5  6  7  8
Beat: .  .  .  X  .  .  X  X

Take the tresillo and rotate it 3 positions, shifting the whole pattern to the right, wrapping around. Same spacing, different starting point, completely different feel. This is the "3-side" of the son clave (the heartbeat of salsa and Latin jazz). Rotation doesn't change the math, but it transforms the groove.

Bossa Nova: E(5,16)

Step: 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
Beat: X  .  .  X  .  .  X  .  .  .  X  .  .  X  .  .

Five hits in 16 slots. The signature lazy, swaying rhythm of bossa nova. The irregular spacing (3, 3, 4, 3, 3) creates that gentle lopsidedness that makes you want to sway.

How the Algorithm Works

The algorithm is surprisingly simple. Think of it as dealing cards:

  1. Start with two groups: the hits (X X X) and the rests (. . . . .)
  2. Pair each hit with a rest: (X.) (X.) (X.), with two rests left over: (.) (.)
  3. Now pair the leftovers back in: (X..) (X..), with one (X.) left over
  4. Nothing left to distribute → done: X . . X . . X .

This is the same method Euclid used to find the greatest common divisor of two numbers, 2300 years ago. The musical connection was discovered by Godfried Toussaint in 2005.

Polymetric Layering

Layer two Euclidean patterns with different step counts on a shared clock. A kick on 8 steps and a hi-hat on 12 steps will line up at the start, then drift apart, then gradually realign. The combined rhythm only truly repeats after 24 steps (the least common multiple of 8 and 12). This creates evolving, organic-feeling complexity from two simple patterns.

Try it: below are two pattern lanes (Kick and Hat), each with its own Steps, Pulses, and Rotation. Start with "Tresillo" to hear just the kick. Then add pulses to the hat lane to layer a second rhythm.

Preset
Tempo
Kick
Hat
Kick: E(3,8)
Hat: E(5,12)

References