Euclidean Rhythm Screensaver
A free screensaver that draws four to six concentric rings, each holding a Euclidean rhythm E(k,n) — k pulses spread as evenly as possible over n steps — and plays them live with sounds it synthesises itself. Sound starts only after your first click or key press, because browsers block audio until then; until that moment the screensaver runs silently. Press ESC to exit.
How the Euclidean Rhythm Rings screensaver works
Each ring is a Euclidean rhythm E(k,n): k pulses placed as evenly as possible among n steps, computed with Bjorklund's algorithm, which has the same structure as Euclid's greatest-common-divisor algorithm. The rings are drawn as circles with n step positions; filled dots are pulses, faint dots are rests, and a polygon joins the pulses of each ring.
One playhead sweeps all rings once per bar (four beats at the tempo you choose). Because the rings have different n, a ring with 12 steps and a ring with 8 steps run against each other as polyrhythms. A pulse lights up when the playhead reaches it and fires that ring's voice.
Every sound is generated in the browser with the Web Audio API: a pitch-dropping sine kick, a marimba-like pair of sine partials, a short wood-block tick, a bell with inharmonic partials, filtered noise for the hat and a low triangle bass. The pitched rings walk through the scale you select. A compressor acts as a limiter and the master volume is kept low. Nothing is downloaded and no samples are used.
Every few bars one ring gains or loses a pulse, or rotates by one step, so the pattern slowly changes; the Evolution option sets how often. A ring is only labelled with a traditional name when its pattern, at rotation zero, is exactly the one printed in Toussaint's 2005 paper; a rotated ring is labelled as rotated. Sound starts only after your first click or key press, because browsers block audio until then; until that moment the screensaver runs silently.
Euclidean rhythms and Toussaint's 2005 paper
The construction comes from a 2003 problem in accelerator timing: E. Bjorklund described how to distribute a given number of pulses as evenly as possible among timing intervals for the Spallation Neutron Source at Los Alamos. Godfried Toussaint's paper "The Euclidean Algorithm Generates Traditional Musical Rhythms" (Proceedings of BRIDGES, Banff, 2005) observed that the same sequences are rhythms found in traditional music, and named them Euclidean rhythms.
The rhythm names on screen come from section 4 of that paper, for example E(2,5) as the Persian Khafif-e-ramal, E(3,4) as the Cumbia pattern, E(3,8) as the tresillo, E(5,8) as the cinquillo and E(7,12) as a West African bell pattern. The paper treats many rhythms as rotations of the same necklace, which is why a rotated ring is labelled as rotated rather than given the plain name.
This saver does not claim to reproduce any particular piece or tradition. It plays the mathematical patterns with synthetic voices and a scale of your choice.
A worked example
With the default settings the outer ring is E(3,8), which Toussaint identifies as the Cuban tresillo: the pulses fall on steps 0, 3 and 6 of 8, x..x..x.. The second ring is E(7,12), listed in the same paper as a common West African bell pattern, x.xx.x.xx.x.. Because one sweep covers the bar for both rings, the 8-step ring fires 3 times while the 12-step ring fires 7 times, and the two only land together at the start of each bar.
Settings & tips
- Rings sets how many rhythms play at once, from four to six; each ring has its own voice.
- Tempo sets beats per minute; one playhead sweep is four beats.
- Scale for pitched rings changes the notes the marimba, bell and bass rings use.
- Evolution sets how often a ring gains or loses a pulse; 0 holds the patterns.
- Click once or press any key to start sound; click again, or press M, to mute. Press ESC to leave fullscreen.
Frequently asked questions
- Is the music pre-recorded?
- No. The rhythms are computed and every sound is synthesised live in your browser with the Web Audio API. No samples or audio files are loaded.
- Why is it silent at first?
- Browsers block audio until you interact with the page. Click or press a key once and the sound starts; the animation runs silently until then.
- What does E(5,8) mean?
- E(k,n) is a rhythm with k pulses spread as evenly as possible over n steps. E(5,8) has five pulses in eight steps, written x.xx.xx., which Toussaint identifies as the Cuban cinquillo.
- Are the rhythm names reliable?
- A name is shown only where the pattern matches a rhythm that Toussaint's 2005 paper lists for that exact E(k,n), and only at rotation zero. Most rings, and every rotated ring, are labelled by their numbers alone or marked as rotated.
- Does it sound good for hours?
- The level is kept low, a limiter prevents clipping and the patterns change slowly, but it is a simple generator, not a composer. Mute with a click if it grows repetitive.
- Does it work without sound?
- Yes. The rings, playhead and pulse flashes run the same way silent, and if your browser has no Web Audio support it simply stays silent.
- Do all rings stay in time with each other?
- Yes: all rings share one bar and one playhead, so steps are placed on exact fractions of the bar, and the scheduler looks ahead on the audio clock. Background tabs may be throttled by the browser.