Tuesday, June 16, 2026

Quasicrystal Drum Machine

Aperiodic Rhythms and the Mathematics of Groove

Musical rhythm does not require repetition. A listener can perceive a distinct groove from balance, distribution, and local predictability, even within an entirely aperiodic structure.

The Rhythm Paradox

What is rhythm? It seems like an easier question to answer than "what is music?", but it might not be. A sonic signal does not contain rhythm by itself. A perfectly random sequence can become rhythmic to a perceiver if the brain manages to find an internal structure within it. Rhythm is not merely an objective property of sound; it is an active cognitive construction.

Why do humans prefer some rhythms over others? Human beat perception is deeply wired into our motor timing systems, with a preferred entrainment range (the speed at which our internal biological clocks lock onto external stimuli) of around a few beats per second.

But music is rarely just a metronome. A groove is not just a clock; it is a fluid relationship between events in time.

Work by music theorist Andrew Milne and others on balanced rhythms shows that many compelling musical patterns share a specific mathematical property: events tend to be distributed as evenly as possible across a given timeline. Listeners routinely prefer patterns where onsets (the starting point of a note or drum hit) are spread out rather than clustered together.

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.

If a pattern never repeats, how does it still feel like a rhythm?

7-fold symmetry tiles

The Long Rhythm Problem

Humans do not process an entire macroscopic rhythmic structure at once. Instead, we operate with a moving perceptual window.

Cognitive Constraints: Modern psychoacoustics estimates a window of roughly 2 to 5 seconds for rhythmic grouping, and 3 to 8 discrete events for pattern recognition. Beyond that, the brain relies on memory compression, or detail is lost entirely.

If a rhythmic cycle is long enough, the brain stops trying to construct the global loop. Instead, it shifts to tracking local distributions.

Take a riff length of 23 pulses over a 4/4 drum grid. The mathematical cycle might be: \(\text{LCM}(23, 4) = 92 \text{ beats}\) (typical Meshuggah song)

This means the true loop point is massive. Perceptually, a listener's brain doesn't store 92 beats in its working memory. The perceptual window resets constantly.

As a result, the experience transforms from a repeating loop into a stationary statistical texture. The brain stops trying to "solve" the macro-cycle; it simply rides the stability of the pulse, the distribution of onsets, and the consistency of the micro-groove.


Balanced, But Never Repeating: Sturmian Sequences

A Sturmian sequence is one of the simplest examples of an aperiodic but perfectly structured sequence. They are essentially the one-dimensional equivalent of quasicrystals: binary (composed of 0s and 1s), never periodic, yet possessing minimal complexity and an extremely balanced distribution.

Their defining property is the balanced condition: in any two substrings of equal length, the number of 1s (onsets) differs by at most 1. \[\text{If } |A| = |B|, \text{ then } |\Sigma(A) - \Sigma(B)| \le 1\]

Here is an example of a Sturmian sequence acting as a rhythm:

0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0...

Notice that the "hits" (1s) never bunch up, and the "rests" (0s) never create massive gaps. The spacing stays incredibly even, yet the pattern will never loop if extended to infinity. It creates a uniform rhythmic density without a single loop.

The Fibonacci Word

The most famous Sturmian sequence is the Fibonacci word, generated recursively by replacing characters at each step (\(A \to AB\) and \(B \to A\)):

Iteration 0: 0
Iteration 1: 01
Iteration 2: 010
Iteration 3: 01001
Iteration 4: 01001010

Musically, this aperiodic pattern is highly self-similar and deeply tied to the Golden Ratio. Because it is a Sturmian sequence, the spacing between events alternates between exactly two gap sizes (a short gap and a long gap), providing an odd sense of familiarity despite its infinite variation.


Generation via Irrational Rotation

We can generate these sequences geometrically using irrational rotation or Beatty sequences. By tracking when a line crosses a threshold using an irrational slope, we map continuous geometry into discrete time: \[x_n = \lfloor (n+1)\alpha \rfloor - \lfloor n\alpha \rfloor\]

Where \(\alpha\) is an irrational number. When \(\alpha\) is the Golden Ratio (\(\phi \approx 1.618\)), this formula yields the Fibonacci word.

Conceptually, imagine moving around a circle by an irrational step size. Every time you cross a specific boundary line, the drum machine fires. Because the step is irrational, you will never land on the exact same point twice, producing a perfectly uniform, maximally balanced distribution without a single repetition.


Quasicrystal Sequences

Taking this concept further brings us to quasicrystals. Famously found in non-repeating physical structures like Penrose tilings, these sequences are entirely deterministic and non-periodic, yet they possess a strict long-range order.

They are generated via the cut-and-project method:

1. Start with a simple, perfectly periodic grid (lattice) in a higher dimension (like a 2D graph).
2. Angle a narrow "window" or slice through this grid at an irrational slope.
3. Project the lattice points that fall inside this window down onto a 1D timeline.

The result is a rhythm that is mathematically ordered, perfectly balanced, and completely devoid of repetition.


The Quasicrystal Drum Machine

The engine on this page features two interactive implementations of the cut-and-project method to generate aperiodic rhythms for a synthesizer.

1. The Fixed Generator

A streamlined, curated showcase. It features only Play and Stop controls, displaying the generated pattern visually in real time. The underlying parameters are locked to an ideal aesthetic rhythm using the Golden Ratio as its irrational slope.

2. The Exploratory Sandbox

An open interface that exposes the generator's internal parameters, letting you map out the vast landscape of aperiodic grooves.

How the Engine Works

The generator drives a line through a higher-dimensional lattice. When the line captures a lattice point within its projection window, an event is triggered. By altering the geometric rules of this projection, completely distinct rhythmic textures emerge.

A single irrational slope simultaneously generates four interrelated drum voices: Kick, Tom, Snare, and Hit

These voices are not separate, independent patterns. They are different architectural readings of the exact same geometric structure.

The core distinction between the drum voices is the Width of their respective projection windows. By widening or narrowing the window, we change how many lattice points are captured, altering the rhythmic density of that specific drum voice. While some events coincide perfectly and others split apart, all four voices remain tethered to the same hidden geometry.

They aren't playing different songs; they are playing different dimensions of the same shape.


Global Parameters

Angle (\(\theta\)): Controls the slope of the projection line through the lattice. When the slope is irrational, the sequence is truly aperiodic. The presets include various Metallic Ratios (like the Silver and Bronze ratios), which offer distinct flavors of non-repeating structure.

(Note: Because digital computers rely on finite floating-point math, these sequences will technically eventually repeat, but the loop lengths are so massive they are effectively infinite to a human listener).

Sequence Length: Restricts the generator to a finite number of steps, allowing you to intentionally clip an infinite sequence into a manageable, phrase-like cycle.

Tempo: The underlying master clock speed, measured in Beats Per Minute (BPM).


Voice-Specific Parameters

Phase (\(\psi\)): Shifts the starting position of the projection line. This offsets the sequence in time, sliding the groove forward or backward without altering its structural DNA.

Width (\(W\)): Dictates the thickness of the projection window. Larger values capture more lattice points, transforming a sparse, minimalist accent into a dense, rapid-fire pattern.

Start: Adds a localized initial delay offset to structurally decouple voices when looking for micro-polyrythms.




Electronic music featuring quasicrystal ryhthms.

No comments:

Post a Comment

Quasicrystal Drum Machine

Aperiodic Rhythms and the Mathematics of Groove Musical rhythm does not require repetition. A listener can perceive a distinct groove from b...