The first time I encountered the West African standard bell pattern it was in a Music and Physics seminar. The lecturer played a twelve-beat cycle on a wood block — seven strokes distributed unevenly but with a rightness that arrested the room. She then played the Cuban clave, the bossa nova timeline, a Bulgarian aksak rhythm. Different cultures, different instruments, different centuries. She asked whether there was a pattern. There was. It is named after a mathematician who died around 270 BCE.
Euclid’s Algorithm
Every student who has taken a number theory course has encountered the algorithm for computing the greatest common divisor of two positive integers. Given $a \geq b$, repeatedly replace $(a, b)$ with $(b, a \bmod b)$ until the remainder is zero; the last non-zero remainder is the GCD.
For example, $\gcd(8, 3)$:
$$8 = 2 \times 3 + 2 \;\Rightarrow\; \gcd(8, 3) = \gcd(3, 2)$$$$3 = 1 \times 2 + 1 \;\Rightarrow\; \gcd(3, 2) = \gcd(2, 1)$$$$2 = 2 \times 1 + 0 \;\Rightarrow\; \gcd(2, 1) = 1.$$Three steps, result 1 (8 and 3 are coprime). The algorithm is efficient: the number of steps is proportional to the number of digits in the smaller input. It appears in Book VII of Euclid’s Elements, composed around 300 BCE, making it the oldest non-trivial algorithm in the Western mathematical tradition.
Distributing Onsets: Toussaint’s Observation
In 2005, Godfried Toussaint — a computer scientist and ethnomusicologist at McGill University — published the observation that the problem of distributing $k$ musical onsets as evenly as possible among $n$ time slots has the same recursive structure as Euclid’s algorithm applied to the pair $(k, n-k)$ (Toussaint, 2005).
The algorithm that solves this distribution problem was independently discovered in nuclear physics. Bjorklund (2003), working on timing systems for the Spallation Neutron Source particle accelerator at Oak Ridge, needed to distribute $k$ beam-extraction pulses as evenly as possible among $n$ machine cycles. The algorithm he derived — Bjorklund’s algorithm — is mathematically equivalent to the Euclidean algorithm applied to the same pair of integers.
The resulting pattern is denoted $E(k, n)$: the Euclidean rhythm with $k$ onsets distributed among $n$ pulses. A 1 denotes an onset; a 0 denotes a rest.
Working Through $E(3, 8)$: The Tresillo
Let us derive $E(3, 8)$ — 3 onsets distributed in 8 pulses — step by step.
Start: 3 onset groups and 5 rest groups:
$$[1]\; [1]\; [1]\; [0]\; [0]\; [0]\; [0]\; [0]$$Step 1: Distribute one rest group into each onset group, pairing until the shorter list is exhausted. Three pairs, with $5 - 3 = 2$ rest groups remaining:
$$[1,0]\; [1,0]\; [1,0]\; [0]\; [0]$$Step 2: Now 3 longer groups and 2 shorter groups. Distribute one shorter group into each longer group, $3 - 2 = 1$ longer group unpaired:
$$[1,0,0]\; [1,0,0]\; [1,0]$$Step 3: The two group types have different lengths and only one group of the shorter type remains; no further pairing is possible. Read the sequence left to right:
$$E(3, 8) = [1, 0, 0, 1, 0, 0, 1, 0].$$This is the Cuban tresillo — one of the foundational rhythmic cells of Afro-Cuban music, used across son, salsa, and mambo. Its onset positions are $\{0, 3, 6\}$, giving gap sizes $[3, 3, 2]$: two wide gaps and one narrow gap, arranged as evenly as the integers allow.
The parallel with Euclid’s algorithm is direct. In the division $8 = 2 \times 3
- 2$, the quotient 2 gives the number of pairing steps before a remainder appears, and the remainder 2 gives the number of groups in the shorter list at each intermediate stage. The recursion $\gcd(8, 3) \to \gcd(3, 2) \to \gcd(2, 1)$ mirrors the three steps above.
The Gap Structure
For any $E(k, n)$, the spacing between consecutive onsets takes exactly two values:
$$\text{gap} \in \left\{\left\lfloor \frac{n}{k} \right\rfloor,\ \left\lceil \frac{n}{k} \right\rceil\right\}.$$The number of each gap size is determined by the constraint that all $k$ gaps sum to $n$. Writing $\alpha = n \bmod k$:
$$\alpha \cdot \left\lceil \frac{n}{k} \right\rceil \;+\; (k - \alpha) \cdot \left\lfloor \frac{n}{k} \right\rfloor = n.$$So $E(k,n)$ has $\alpha$ gaps of the larger size and $k - \alpha$ gaps of the smaller size. The Euclidean property is that these two gap types are distributed as evenly as possible among themselves — not clustered at one end of the cycle but interleaved. A cycle that maximises the minimum distance between any two consecutive onsets has this property; it is called maximally even (Clough and Douthett, 1991).
For $E(3, 8)$: $\lfloor 8/3 \rfloor = 2$, $\lceil 8/3 \rceil = 3$, $\alpha = 8 \bmod 3 = 2$. Two gaps of 3, one gap of 2. Gap sequence $[3, 3, 2]$. Maximum-evenness is why the tresillo sounds “right” even though it is asymmetric: the asymmetry is the smallest possible deviation from perfect regularity.
A Gallery of World Rhythms
The following table, derived from Toussaint (2005, 2020), shows Euclidean rhythms alongside their ethnomusicological identifications. Asterisks mark patterns given as rotations of the canonical form.
| Pattern | Gap structure | Musical tradition |
|---|---|---|
| $E(2,3) = [1,0,1]$ | $[2,1]$ | Iambic foot; West African, Balkan |
| $E(3,8) = [1,0,0,1,0,0,1,0]$ | $[3,3,2]$ | Cuban tresillo; Flamenco |
| $E(5,8) = [1,0,1,1,0,1,1,0]$ | $[2,1,2,1,2]^*$ | Cuban cinquillo |
| $E(4,9) = [1,0,0,1,0,1,0,1,0]^*$ | $[3,2,2,2]^*$ | Turkish aksak patterns |
| $E(7,12) = [1,0,1,1,0,1,0,1,1,0,1,0]$ | $[2,1,2,2,1,2,2]^*$ | West African standard bell |
| $E(9,16)$ | $[2,1,2,2,1,2,2,1,2,1]^*$ | Brazilian and West African |
| $E(13,24)$ | South Indian (Carnatic) tāla |
Three of these are worth examining in more detail.
$E(5,8)$: the cinquillo. Five onsets in eight pulses: $\lfloor 8/5 \rfloor = 1$, $\lceil 8/5 \rceil = 2$, $\alpha = 3$. Three gaps of 2 and two gaps of 1. Gap sequence $[2,1,2,1,2]$ or a rotation thereof. The cinquillo is a fundamental pattern in Cuban music, used as a melodic rhythmic figure in the nineteenth-century contradanza and in much of what followed.
$E(7,12)$: the West African standard bell. Seven onsets in a twelve-beat cycle: $\lfloor 12/7 \rfloor = 1$, $\lceil 12/7 \rceil = 2$, $\alpha = 5$. Five gaps of 2 and two gaps of 1. This timeline — used across the Ewe, Akan, and many other traditions in West Africa — is the cyclic reference structure against which other rhythmic layers are measured in ensemble drumming. It is also the pitch-class set $\{0, 2, 4, 5, 7, 9, 11\}$ — the Western diatonic scale, translated from pitch to rhythm. That the same maximally-even distribution describes both the diatonic scale in pitch space and the standard bell in rhythm is one of the more remarkable coincidences in mathematical music theory.
Universality across non-connected cultures. The tresillo $E(3,8)$ appears independently in Cuban music, Flamenco, Namibian Juǀ’hoansi music, and medieval Persian music (Toussaint, 2020). These traditions had no common musical ancestor that could have transmitted the pattern. The Euclidean algorithm produces what maximum evenness demands, and maximum evenness turns out to be what these rhythmic traditions independently converged on.
Circular Notation and Necklaces
Euclidean rhythms are most naturally represented as necklaces — equivalence classes of binary sequences under cyclic rotation. All rotations of $E(3,8)$ represent the same rhythmic structure with a different starting downbeat: the musical identity is independent of which position is designated “beat 1.”
In circular notation, place $n$ equally spaced dots on a circle and mark the $k$ onset positions. The pattern is immediately visible: the $k$ onset-dots divide the circle as evenly as possible. For $E(7,12)$, the seven onset dots on a twelve-position circle look like the seven vertices of a near-regular heptagon inscribed in a dodecagon. For $E(3,8)$, the three onset dots form a near- equilateral triangle.
This geometric representation makes the maximum-evenness property transparent in a way that the linear binary string does not. It also makes clear why Euclidean rhythms feel “balanced” when played: the onset dots distribute the “weight” of the cycle as uniformly as the integer constraints allow.
The mathematical theory of necklaces belongs to combinatorics on words. Euclidean rhythms correspond to specific equivalence classes of binary sequences known as Christoffel words (Lothaire, 2002): words over the alphabet $\{0,1\}$ whose combinatorial properties encode the slope of a line segment, which brings us to the third independent context in which the same algorithm appears.
The Bresenham Connection
Jack Bresenham’s line algorithm (1965) rasterises a line from $(0,0)$ to $(n,k)$ on a grid of integer pixels. At each column $x$, the algorithm tracks whether the fractional error accumulated since the last row increment exceeds $\frac{1}{2}$, and if so, increments the row and resets the error. The sequence of column positions at which the row increments is the onset pattern $E(k,n)$.
Formally, an onset occurs at position $m$ in $E(k,n)$ if and only if:
$$\left\lfloor \frac{(m+1)\, k}{n} \right\rfloor > \left\lfloor \frac{m\, k}{n} \right\rfloor.$$Equivalently, the onset positions themselves form the sequence:
$$s_j = \left\lfloor \frac{j \cdot n}{k} \right\rfloor, \qquad j = 0, 1, \ldots, k-1.$$For $E(3,8)$: $s_0 = 0$, $s_1 = \lfloor 8/3 \rfloor = 2$, $s_2 = \lfloor 16/3 \rfloor = 5$, giving onset positions $\{0, 2, 5\}$ — a rotation of the tresillo.
This is exactly the Bresenham increment condition. Drawing the line from $(0,0)$ to $(8,3)$ and marking where the $y$-coordinate takes a step produces the onset positions $\{2, 5, 7\}$ — a rotation of the tresillo $\{0, 3, 6\}$.
Three independent fields — ancient Greek number theory, Afro-Caribbean percussion, and 1960s computer graphics — converge on the same mathematical object. This is not a coincidence. All three are solving the same fundamental problem: how to distribute $k$ discrete events as evenly as possible among $n$ slots. When the problem is universal, its solution is too.
Euclidean Rhythms in Contemporary Practice
Toussaint’s 2005 paper was primarily a contribution to computational ethnomusicology, but it reached electronic music production rapidly. Euclidean rhythm sequencers are now standard in modular synthesis (dedicated Eurorack hardware modules exist under names including “Euclidean” and “Erica Synths Pico”) and digital audio workstations (as Max for Live devices and software plug-ins). The interface is minimal: set $k$ and $n$, adjust the rotation offset, and hear the resulting timeline immediately.
This has opened a compositional mode in which the mathematical structure is operational: a producer constructing a layered African-style polyrhythm by stacking $E(3,8)$, $E(5,8)$, and $E(7,8)$ on different instruments is — whether they know it or not — computing the Euclidean algorithm three times and listening to the result.
Implications for Teaching Rhythm
Music conservatories in the European tradition teach rhythm almost entirely through Western notation: time signatures, note values, dotted notes, ties. This system is well-suited to the repertoire it was designed for. It handles Euclidean rhythms awkwardly. The tresillo $E(3,8)$ requires either a triplet feel against a binary pulse or a notation involving a dotted quarter note followed by a dotted quarter and a quarter, which correctly represents the sound but obscures the structural principle entirely.
The Euclidean framework suggests a different pedagogical starting point. Rather than beginning from the bar line and asking how notes fill it, begin from the cycle length $n$ and the onset count $k$ and ask how to distribute the onsets as evenly as possible. The answer is always computable and always produces a recognisable rhythm.
For students who encounter West African, Afro-Cuban, or Middle Eastern music — which conservatory students increasingly do — having a framework that makes these rhythms structurally necessary rather than culturally exotic changes the pedagogical relationship fundamentally. The tresillo is not a deviation from “normal” rhythm. It is the unique maximally even solution to the problem of placing three beats in eight pulses. That the same algorithm appeared in a 300 BCE Alexandrian text on number theory is an accident of the history of mathematics. That it sounds right is not.
Whether conservatory curricula are ready to incorporate the Euclidean framework alongside Western notation is a separate question. The mathematics does not demand it. But it offers a language for rhythm that transcends the Western bar-line without abandoning precision — and that seems worth something, especially in a world where the music students will perform and teach is no longer exclusively European.
References
Bjorklund, E. (2003). The theory of rep-rate pattern generation in the SNS timing system. Technical Report SNS-NOTE-CNTRL-99, Spallation Neutron Source, Oak Ridge National Laboratory.
Bresenham, J. E. (1965). Algorithm for computer control of a digital plotter. IBM Systems Journal, 4(1), 25–30. https://doi.org/10.1147/sj.41.0025
Clough, J., & Douthett, J. (1991). Maximally even sets. Journal of Music Theory, 35(1–2), 93–173. https://doi.org/10.2307/843811
Lothaire, M. (2002). Algebraic Combinatorics on Words. Cambridge University Press.
Toussaint, G. T. (2005). The Euclidean algorithm generates traditional musical rhythms. In R. Sarhangi & J. Sharp (Eds.), Proceedings of BRIDGES 2005: Mathematical Connections in Art, Music, and Science (pp. 47–56). Bridges Conference.
Toussaint, G. T. (2020). The Geometry of Musical Rhythm: What Makes a “Good” Rhythm Good? (2nd ed.). Chapman & Hall/CRC Press.