Tonegrid Pattern Builder
Turn x-and-dot step notation into a Tonegrid project and a MIDI file.
Try an example: Pentatonic melody with a simple beat · Twelve-step melody against a sixteen-step beat
How it works
Write a melody and a beat as lines of x and dots, one line per note name or drum. The builder checks every note against the chosen key and scale, returns an editable Tonegrid project with a link that opens it in the app, and a Standard MIDI File with the melody and General MIDI drums.
- Each melody line is matched to a row of the grid: the root note is the lowest row and the scale repeats upward, so a note that is not in the key and range is rejected with the range that would fit.
- Steps are sixteenth notes. The melody and drum grids may have different lengths; they line up again after the least common multiple of both lengths (rounded up to an even number of steps for swing).
- The MIDI file (type 1, 480 ticks per quarter note) repeats the pattern as often as requested. Melody notes are on channel 1 with a General MIDI instrument that matches the sound; drums are on channel 10 with General MIDI percussion keys (kick 36, snare 38, closed hi-hat 42, open hi-hat 46, clap 39, low tom 45, rim 37, maracas 70). Swing delays odd steps by the swing share of a sixteenth.
The MIDI file contains notes only; the Tonegrid synth sounds and mixer settings are not part of it, so your music software chooses the instrument sounds.
Sources
- Standard MIDI Files 1.0 and General MIDI 1 specifications (MIDI Association)
Part of Tonegrid
-
Tonegrid Tone matrix & beat sequencer
Light up squares to build looping melodies and beats, then arrange them into songs.
How to use the Tonegrid Pattern Builder
Write a melody and a beat as x-and-dot lines, get a checked Tonegrid project, a General MIDI file and a link that opens the pattern in the app.
What it is for
The Pattern Builder turns plain text into music you can open and play. You write one line per note or drum: a label such as C4, D#4 or kick, followed by x for a hit and . for a rest. The builder checks every line against the key and scale you choose, then returns an editable Tonegrid project, a Standard MIDI File and a link that opens the pattern in the Tonegrid workspace.
It is handy when you want to sketch a groove without clicking squares, keep patterns in a text file, or let an AI agent compose through the JSON API or MCP. It does not render audio — open the link in Tonegrid to listen or export WAV and MP3 there.
Worked example
A blues riff in C: key 48 (C3), scale Blues, 96 BPM, 40% swing, sound Warm triangle, 4 repeats, and these lines:
G4 .... .... .... ..x.
F4 .... .... ..x. x...
D#4 .... ..x. x... ....
C4 x... x... .... ....
C3 x... .... x... ....
kick x... .... x... ....
snare .... x... .... x...
hat x.x. x.x. x.x. x.x.
The builder reports 9 melody notes and 12 drum hits on 16 steps each. With 16 rows in the blues scale the grid plays C3 to F♯5, so D#4 is row 9 and the root C3 is row 16. The pattern loops every 2.50 seconds, and the MIDI file with four repeats lasts 10.00 seconds. hat is accepted as a short name for the closed hi-hat, which lands on General MIDI key 42; kick is 36 and snare 38.
If you write F4 in the default C major pentatonic grid, the run stops with “Line 1: F4 is not one of the grid notes. This grid plays C3 to C6 in the chosen scale.” — F is simply not in that scale.
How to read the result
- Pattern metrics: melody notes, drum hits, the step count of each grid, the loop length and the MIDI file length in seconds.
- Melody rows used: row number (1 is the top), note name, MIDI number and how many hits each row has.
- Drum rows used: the drum, its General MIDI key and its hits.
- Download MIDI file and Download Tonegrid project: files valid for about two hours.
- Open in Tonegrid: a link with the whole project in the address; nothing is stored on the server.
When melody and drum lines have different lengths, the loop length is the full cycle until both line up again — 12 against 16 steps gives 48 steps.
Tips and common mistakes
- All melody lines need the same number of steps, and so do all drum lines; spaces and
|are ignored, so group steps in fours for readability. - Use sharps or flats freely:
D#4,Eb4andE♭4are the same note. - Pick the scale first, then the notes. A pentatonic or blues scale keeps clashes away; chromatic accepts every note but covers fewer octaves.
- Lines starting with
#are comments, handy for labelling sections. - Drum rows follow a fixed order (kick, snare, closed-hat, open-hat, clap, tom, rim, shaker); using
shakercreates all eight drum rows. - Swing delays every second step in the MIDI file too, so straight eighth-note hats become a shuffle.
FAQ
Can I write more than one pattern?
Not in one run. Build each pattern separately or open the first one in Tonegrid, then add patterns and a song arrangement there.
Which instruments does the MIDI file use?
Melody on channel 1 with a General MIDI program matching the chosen sound (for example celesta for Soft bell), drums on channel 10. Your music software decides how they sound.
Why is my note rejected?
It is outside the scale or above the highest row. Add rows, change the key or choose a scale that contains the note.
Is the link private?
The project is encoded in the link itself. Anyone with the link can open a copy, so share it like a file.
Guide last updated:
For scripts and AI agents
- JSON API:
POST https://tonegridpatternbuilder.usefulweb.site/api/v1/calculate(same calculation as this page) - Interface description: OpenAPI 3.1 · AI guide: llms.txt
- MCP server (Streamable HTTP):
https://tonegridpatternbuilder.usefulweb.site/mcp· tool nametonegrid_pattern_builder
Example request
curl -s -X POST https://tonegridpatternbuilder.usefulweb.site/api/v1/calculate \
-H 'content-type: application/json' \
-d '{"name":"Ripple beat","pattern":"# melody (note names) and drums: x = hit, . = rest\nG4 .... ..x. .... ..x.\nE4 .... x... .... x...\nA3 ..x. .... ..x. ....\nE3 x... .... x... ....\nkick x... .... x... ....\nsnare .... x... .... x...\nclosed-hat x.x. x.x. x.x. x.x."}'