Aperiodic Rhythms and the Mathematics of Groove
Musical rhythm does not require repetition. A listener can perceive groove from balance, distribution, and local predictability even in an aperiodic structure.
The Rhythm Paradox
What is rhythm? It seems like an easier question than "what is music?" but maybe it isn't. A signal does not contain rhythm by itself. A perfectly random sequence can become rhythmic to a perceiver if the listener finds structure inside it. Rhythm is not only something that exists in sound; it is something the brain constructs.
Why do humans prefer some rhythms over others? Human beat perception seems strongly connected to motor timing systems, with a preferred entrainment range around a few beats per second. But music is rarely just a pulse. A groove is not only a clock it is a relationship between events in time.
Work by Andrew Milne and others on balanced rhythms shows that many musical rhythms share a mathematical property: events tend to be distributed evenly across a cycle. Listeners often prefer patterns where onsets are spread out rather than clustered.
A balanced sequence is one where the distribution of events stays as even as possible. If you divide the timeline into equal sections, each section contains almost the same amount of activity. The rhythm avoids both extreme crowding and extreme emptiness.
In simple terms: events should avoid clustering, spacing should feel stable, and the pattern should contain some internal symmetry or near-symmetry.
But here comes the interesting part: mathematically, balance does not require repetition.
A sequence can be balanced, evenly distributed, and still be aperiodic.
If the distribution of onsets stays roughly uniform through time, the listener can perceive balance even without the pattern ever looping.
The question then becomes:
If something never repeats, where does the feeling of rhythm come from?
A sequence can be balanced, aperiodic, and totally 'random' for the rest of infinity. So we can't predict it. How is it musical at all?
The Long Rhythm Problem
Humans do not process an entire rhythmic structure at once. Instead, we operate with a moving perceptual window. Typical estimates: 2–5 seconds for rhythmic grouping, 3–8 events for pattern recognition... beyond that it becomes memory compression or loss of detail. So if a riff cycle is long enough (like 23 or 29 beats), the brain often never constructs the global structure, instead it perceives only local distributions.
Take a riff length of 23 pulses over a 4/4 drum grid. The mathematical cycle might be: LCM(23,4) = 92 beats
So the true repetition point is extremely long. But perceptually the listener never stores 92 beats, the perceptual window resets constantly so the exerience becomes a stationary statistical texture rather than a repeating pattern.
The brain doesn't try to solve the cycle It simply tracks pulse stability, onset distribution, groove consistency.
Balanced but never Repeating
A Sturmian sequence is one of the simplest examples of an aperiodic but perfectly structured sequence, they are the 1d version of quasicrystals.
Key properties: binary sequence (usually 0 and 1), never periodic, minimal complexity, extremely balanced distribution.
The defining property: In any two substrings of equal length, the number of 1s differs by at most 1.
Example (one Sturmian sequence): 0100101001001010010...
Events never cluster too much, spacing stays very even, but the pattern never repeats, the kind of structure that produces uniform rhythmic density without loops.
The Fibonacci word is the most famous Sturmian sequence. It’s generated recursively: A: AB, B: A
Iterations(Binary version): 0, 01, 010, 01001, 01001010, 0100101001001,...
Properties: aperiodic, balanced, self-similar( related to the golden ratio). Spacing between events alternates between two lengths. (Sturmian sequences use only two gap sizes)
Sturmian sequences can also be generated using irrational rotation.
Take a line: \(x_n = \lfloor (n+1)\alpha \rfloor - \lfloor n\alpha \rfloor\) , where: \(\alpha\) is irrational. (when \(\alpha\) is the golden ratio, you get the Fibonacci word)
Conceptually: move around a circle by an irrational step, record when you cross a boundary, this produces perfectly uniform distribution without repetition.
Beatty Sequences are another close relative defined as: \(a_n = \lfloor n\alpha \rfloor\) With irrational \(\alpha\), these generate complementary partitions of integers and underlie Sturmian constructions.
(For example: floor(n\alpha), floor(n\alpha²) together they cover all integers without overlap.)
Quasicrystal Sequences
These appear in aperiodic tilings like Penrose tilings, these are also deterministic, non-periodic have long-range order. Often generated by cut-and-project method (the drum machine implements this): take a periodic lattice in higher dimension, project onto a lower dimension, select points within a window...: perfectly ordered and never repeating.
The Quasicrystal Drum Machine
On this page I provide two implementations of the cut-and-project method used to generate rhythms for a synthesizer.
The first implementation is a fixed version. It has only play and stop controls, while the interface displays the generated pattern in real time. The parameters are locked to a rhythm using the golden ratio as the underlying irrational slope.
The second implementation exposes the parameters and allows you to explore the space of possible rhythms.
How does it work?
The generator starts with a line moving through a higher-dimensional lattice. Whenever the line crosses certain regions of the lattice, an event is created. This projection transforms a simple geometric rule into an aperiodic sequence.
The same irrational slope generates four related drum voices: hit, snare, tom, and kick.
The voices are not separate patterns. They are different readings of the same underlying structure.
The difference between them is the width of the projection window. Changing the width changes which lattice points are captured by the line, creating different rhythmic densities. Some events coincide, some separate, but all voices remain connected by the same hidden geometry.
They are playing different parts of the same song.
General parameters
Angle- Controls the slope of the line through the lattice. When the slope is irrational, the generated sequence is aperiodic: it never repeats exactly.
The presets include several metallic ratios, which are irrational relationships similar in spirit to the golden ratio.
Because digital computers do not work with true real numbers, these sequences are technically finite and eventually repeat. However, with appropriate values, the repetition length can become extremely large.
Sequence length- Controls the number of generated events. This can be used to intentionally create finite rhythmic cycles instead of relying on a long aperiodic sequence.
Tempo- The underlying clock speed, measured in beats per minute.
Voice parameters
Phase- The starting position of the projection line. Changing the phase shifts the sequence in time without changing its underlying structure.
Width- Controls the thickness of the projection window. Larger values capture more lattice points, increasing rhythmic density.
Start- Offsets the generated sequence by adding an initial delay.