BEAT LAB / EUCLIDEAN

E(k, n)

Distribute k beats across n steps. As evenly as possible. This simple constraint produces every traditional rhythm on earth.

/ INTERACTIVE

Four channels. Four Euclidean patterns. Dial in the math.

beats (k) controls density. steps (n) controls resolution. offset rotates the pattern. Together: infinite rhythm.

/ THE ALGORITHM

Bjorklund. Euclidean. Bresenham.

In 2004, Godfried Toussaint noticed something. Every traditional rhythm from every culture could be described by one algorithm. Distribute k beats as evenly as possible across n steps.

It's the same algorithm Bresenham used to draw a line on a pixel grid in 1962. It's the same algorithm used in nuclear physics for neutron accelerators — the Bjorklund algorithm. It draws lines. It fires neutrons. It makes rhythm.

The math doesn't know what it's doing. It just distributes. And when it distributes beats, humans feel something inevitable. Something right.

ALGORITHM
function euclidean(k, n) {
  const pattern = Array(n).fill(0);
  let bucket = 0;
  for (let i = 0; i < n; i++) {
    bucket += k;
    if (bucket >= n) {
      bucket -= n;
      pattern[i] = 1;
    }
  }
  return pattern;
}

euclidean(3, 8)
// → [1,0,0,1,0,0,1,0]
// Tresillo. Cuban. Universal.
E(3,8)
00100101
E(5,8)
01011011
E(4,12)
001001001001
E(7,16)
0010101001010101
/ WORLD RHYTHMS

Every continent. One algorithm.

These rhythms emerged independently across cultures separated by oceans. The math is the same because the math is the most efficient distribution. Evolution found it. Humans found it. Computers find it.

E(3,8)
Tresillo Cuba, West Africa

The most common rhythm in the world. Three beats, eight steps. The backbone of son, cumbia, tresillo. You have heard this ten thousand times.

E(2,3)
March Universal

The simplest asymmetry. Two against three. A waltz. A march. The heartbeat of children's songs on every continent.

E(5,8)
Cinquillo Cuba, Haitian

Five beats, eight steps. Fills the tresillo. Together they make Cuban music. Separately they explain half of world rhythm.

E(7,12)
West African 12 Sub-Saharan Africa

Seven against twelve. Asymmetric but inevitable. When you hear it, you feel it before you count it.

E(4,9)
Turkish Aksak Turkey, Balkans

Four in nine. Aksak means 'limping.' The rhythm actually limps. Mathematics explaining culture.

E(5,16)
Bossa Nova Kick Brazil

Five in sixteen. Stretched. Laid back. The DNA of bossa nova is just five evenly-spaced hits in a long measure.

/ ROTATION

Offset is everything.

E(3,8) = [1,0,0,1,0,0,1,0]. Rotate by 2: [0,1,0,0,1,0,0,1]. Same beats. Different feel. Different groove.

Cuban son and West African bell patterns are the same Euclidean rhythm, offset by two steps. A shift in time. A shift in culture.

The offset control in the machine above is not a gimmick. It's the difference between the downbeat hitting on one or on the and-of-two. Between a march and a shuffle. Between right and right.

offset 0
1
0
0
1
0
0
1
0
offset 2
0
0
1
0
0
1
0
0
offset 4
0
1
0
0
1
0
0
1
Same E(3,8). Three different grooves. This is why offset exists.
← beat lab patterns → synth → poly →