Euclidean Rhythm Generator (MIDI)

Spread k beats evenly over n steps for several drums at once and download the groove as a MIDI file.

One voice per line: pulses, steps, rotation (optional), sound (optional: kick, snare, clap, closed-hat, open-hat, low-tom, high-tom, rim or a MIDI key 0–127), velocity (optional). Example: 3, 8, 0, kick

BPM
More options
%

50 = straight; 54–62 = light to strong shuffle on the off-beat sixteenths.

Try an example: · ·

More about this tool

Part of Tickwork

How it works

Builds Euclidean rhythms with Bjorklund’s algorithm — E(3,8), E(5,16), E(7,12) and any other pulses/steps pair — with rotation, for up to eight drum voices. Voices of different lengths run against each other as a polymeter. You get the patterns as text, their beat intervals, a Standard MIDI File on the General MIDI drum channel and a Tickwork project to keep editing.

  • Bjorklund’s algorithm distributes k onsets over n steps as evenly as possible by repeatedly pairing the groups of onsets with the remainder groups, like Euclid’s algorithm for the greatest common divisor (Toussaint 2005). The first step is always a hit; rotation r shifts the pattern r steps later.
  • Each voice is one step lane of its own length on a sixteenth-note grid, so voices of 8, 12 and 16 steps drift against each other and line up again after their least common multiple.
  • The MIDI file (format 1, 480 ticks per quarter note) puts every voice on channel 10 with its General MIDI percussion key; swing delays every off-beat sixteenth to the given share of an eighth note (50 % = straight). Notes last half a sixteenth.

Sources

Part of Tickwork

  • Tickwork MIDI step & piano-roll sequencer

    Sequence synths and drums with a piano roll, chance, ratchets and parameter locks.

    Open Tickwork

Related tools

How to use the Euclidean Rhythm Generator

Spread hits evenly over steps with Bjorklund's algorithm, stack voices of different lengths into a polymetric groove, and download it as a MIDI file and a Tickwork project.

What it is for

A Euclidean rhythm spreads a number of hits (pulses) as evenly as possible over a number of steps. Three hits in eight steps give the Cuban tresillo, five in eight the cinquillo, four in sixteen a four-on-the-floor kick. Godfried Toussaint showed in 2005 that many traditional rhythms around the world are Euclidean, and the idea is now a standard feature of drum machines and modular sequencers.

The generator takes one line per voice — pulses, steps, rotation, sound and optional velocity — and writes a General MIDI drum groove on channel 10 plus a project file for the Tickwork sequencer app. Voices may have different numbers of steps; each loops on its own, so they drift against each other and only line up again after the least common multiple of their lengths.

The tool does not produce audio. Load the MIDI file into any DAW or drum machine, or open the project in Tickwork to hear it and keep editing.

Worked example

The first example uses three voices:

4, 16, 0, kick
3, 8, 2, snare
7, 12, 0, closed-hat

with 110 BPM, no swing and 4 bars. The result lists the patterns: the kick is x . . . x . . . x . . . x . . . (intervals 4-4-4-4), the snare rotated by two steps is x . x . . x . . (2-3-3), and the hats play 7 of 12 steps, x . x x . x . x x . x ., a pattern that is common in West African bell parts. The summary says "78 hits in 4 bars at 110 BPM; all voices line up every 48 sixteenths" — 48 is the least common multiple of 16, 8 and 12, so the full cycle takes three bars.

The simplest example, 3, 8, 0, clap at 96 BPM for 2 bars, gives the tresillo x . . x . . x . with intervals 3-3-2 and 12 hits in 5 seconds.

How to read the result

  • Pattern shows every step as x (hit) or . (rest), starting at step 1.
  • Intervals are the gaps between hits in steps. A Euclidean rhythm only ever uses two neighbouring interval sizes, which is why it sounds balanced.
  • Density is pulses ÷ steps.
  • Cycle is the number of sixteenths after which all voices start together again.
  • The MIDI file has one track with the tempo and all voices on channel 10. The .tickwork.json file has one drum track per voice with the lane length set to its number of steps.

Tips and common mistakes

  • The fields are separated by commas or spaces: 5 16 2 snare 90 works too. Sounds are kick, snare, clap, closed-hat, open-hat, low-tom, high-tom and rim, or any MIDI key number 0–127.
  • Rotation moves the pattern later. Rotating the snare of the example by 2 puts its first hit on the second eighth instead of the downbeat.
  • Pulses may not exceed steps; steps go up to 64.
  • Odd step counts (5, 7, 9, 11) against a 16-step kick give long, evolving grooves; keep at least one voice at 16 so the bar stays audible.
  • Swing above 50 % delays every second sixteenth, the same way as in Tickwork's swing control.

FAQ

Why does E(3,4) look rotated compared with some tables?

Bjorklund's algorithm produces one rotation of each necklace; tables sometimes list another. All rotations are the same rhythm started on a different step — use the rotation field to pick the one you want.

Which drum keys are used?

General MIDI: kick 36, rim 37, snare 38, clap 39, closed hi-hat 42, low tom 45, open hi-hat 46, high tom 50.

Can I make melodic patterns?

Give a voice a pitch number instead of a drum name, then import the MIDI file and move that track off channel 10 in your DAW, or open the project in Tickwork and use Euclidean fill on a synth track.

Is the output deterministic?

Yes. The same lines always give the same bytes.

Guide last updated:

For scripts and AI agents

  • JSON API: POST https://tickworkeuclideanrhythm.usefulweb.app/api/v1/calculate (same calculation as this page)
  • Interface description: OpenAPI 3.1 · AI guide: llms.txt
  • MCP server (Streamable HTTP): https://tickworkeuclideanrhythm.usefulweb.app/mcp · tool name tickwork_euclidean_rhythm
Example request
curl -s -X POST https://tickworkeuclideanrhythm.usefulweb.app/api/v1/calculate \
  -H 'content-type: application/json' \
  -d '{"voices":"4, 16, 0, kick\n3, 8, 2, snare\n7, 12, 0, closed-hat","tempo":110,"swing":50,"bars":4}'
Feedback · ideas & bug reports welcome