API & MCP
Everything a person can do on Euclidean Rhythm Generator (MIDI), a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://tickworkeuclideanrhythm.usefulweb.app/api/v1/calculate– run Euclidean Rhythm Generator (MIDI)GET https://tickworkeuclideanrhythm.usefulweb.app/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Euclidean Rhythm Generator (MIDI)
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.
| Field | Type | Default | Description |
|---|---|---|---|
voices | textarea | "4, 16, 0, kick\n3, 8, 2, snare\n7, 12, 0, closed-hat" | Rhythm voices. 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 |
tempo | number | 110 | Tempo |
swing | number | 50 | Swing. 50 = straight; 54–62 = light to strong shuffle on the off-beat sixteenths. |
bars | integer | 4 | Bars in the MIDI file |
Example request
Kick, snare and hats in three lengths
curl -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}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://tickworkeuclideanrhythm.usefulweb.app/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
tickwork_euclidean_rhythm - Local stdio connector:
node src/mcp-stdio.ts --tool=tickwork-euclidean-rhythm
{
"mcpServers": {
"tickwork-euclidean-rhythm": { "type": "http", "url": "https://tickworkeuclideanrhythm.usefulweb.app/mcp" }
}
}