Let your AI write music
Can't write music yourself? Let your AI do it. imadj keeps a whole track as plain text, so any AI assistant can compose one and give you a link that opens and plays it here. No account, no API.
- Give your AI this address:
https://imadj.lol/docs/ai-compose.md(or copy the guide below). - Tell it what you want, for example:
Read https://imadj.lol/docs/ai-compose.md and write me a 16-bar dub techno track at 124 BPM, dark and spacious, with a chord stab drowning in echo. Give me the imadj link.
- Open the link it gives you and press play. Change anything you like: it's your track now.
If the link breaks in the chat, ask the AI for the GLK2 text, save it as track.glk and open it with
Tracks → Open file…
# Compose for imadj.lol: a guide for AI assistants
You are helping a person make music on **imadj.lol** ("I'm a DJ, LOL"), a free browser music editor. The person
describes what they want (style, mood, tempo, length). You write the track as **GLK2 text** and hand it back as a
**link** that opens and plays the track in their browser. You need no server, account or API: the whole track
travels in the link.
Read the whole guide before writing. A valid file is not the goal: the track should sound good. Section 7 covers
that.
---
## 1. What you return
Return both of these every time:
1. **A link.** Section 5 explains how to build it. Put it on its own line.
2. **The same track as GLK2 text** in a code block. Long links sometimes break in chat windows. If the link fails,
the person can save the text as `track_glk.txt` (or `track.glk`) and open it in imadj with **Tracks → Open file…**.
Add two or three sentences on what you wrote (key, tempo, form, the trick worth listening for). Keep it short.
---
## 2. GLK2 format
Plain UTF-8 text. The first line is a header. After it comes one line per **lane**: one instrument playing its own
notes.
```
GLK2|<name>|bpm=<40-220> root=<0-11> bars=<1-64> grid=<8|16|32>[ swing=<51-75>][ keys=<bar>:<root>,…]
<inst>|vol=<0-100> echo=<0-8> bpm=<min>-<max> oct=<-3..3>[ space=<mode>][ far=<1-3>][ fixkey=1][ rate=<r>]|<note> <note> …
```
- **Name:** any text without `|` or line breaks.
- **root:** the key as a pitch class, 0 = C, 1 = C#, 2 = D, … 9 = A, 11 = B. It is the key of bar 1, and the key
every `p` is written in.
- **keys:** optional key changes (modulations) inside the track: `keys=5:2,13:9` = from bar 5 the key is D, from bar
13 it is A again. Bars are counted from 1 and must be 2…`bars`; roots 0–11 like `root`. A sign holds until the next
one; the loop goes back to `root`. From a sign on, every melodic lane sounds **transposed by the nearest interval**
from `root` to the sign's key (−6…+5 semitones: from A, D is +5, G is −2, E is −5), so write `p` as if the track
never left `root` and let the sign move it. A note that rings across a sign keeps its starting key. Drum lanes and
lanes with `fixkey=1` never move. Leave `keys` out when the track stays in one key.
- **bars:** the loop length. The track loops forever, so make bar `bars` lead back into bar 1. Prefer **16 bars or
fewer**: that is as far as a person can extend a track by hand in the editor, and longer rings get hard to edit.
Up to 64 is accepted, opens and plays, but the person can't add bars to it.
- **grid:** the editor's snap grid (8 = eighths, 16 = sixteenths, 32 = thirty-seconds). It also sets the swing pair
and the echo spacing (see below). Notes may sit on any 1/32 step, whatever the grid.
- **swing:** 50 = straight (then leave it out). With `grid=8` the eighth notes swing; with `grid=16` or `32` the
sixteenths swing. 58–62 is a light shuffle, 66 is close to a full triplet swing. All lanes swing, except lanes at
`rate=3/2` or `rate=1/3`.
### Notes
Token: `t:p:d`, then optionally `!` (accent), then optionally shape flags (`<`, `>`, `*`), then optionally `~b`
(bend). Examples: `16:26:10!`, `364:26:16~-3`, `0:19:32<<<>>`, `32:24:16*`.
| field | meaning |
|---|---|
| `t` | start, in **1/32 notes from the start of the track** (absolute, not per bar). A 4/4 bar = 32 steps, a beat = 8. Bar n (from 0) starts at `n*32`. |
| `p` | melodic lanes: semitones from the root, **`midi = 48 + root + p`**. Drum lanes: the drum row (section 4). |
| `d` | length in 1/32 notes, at least 1. Quarter = 8, eighth = 4, sixteenth = 2, whole bar = 32. |
| `!` | accent. A note has only two loudness levels: normal (0.72) and accented (1.0). For softer notes, put them in a second lane with a lower `vol` (ghost notes). |
| `<` `<<` `<<<` | fade in: the note swells in over 1/8, 1/3 or all of its length (`<<<` = from silence). Melodic lanes only. |
| `>` `>>` `>>>` | fade out: the note dies away over the last 1/8, 1/3 or all of its length and is silent at its end. If fade in + fade out exceed the note, both shrink in proportion: `<<<>>>` is a hairpin (swell to the middle, then away). |
| `*` | tremolo: the note's loudness pulses gently, about 7 times a second, locked to the tempo. One speed only. |
| `~b` | bend: the note glides from `p` to `p+b` semitones (−12…12) while it sounds. `~-2` on a long note = a jazz fall; `~2` = a lift. |
Rules: one note per `(t, p)` in a lane. Sort tokens by `t`, then `p`. Separate them with single spaces.
### Lane properties
| prop | meaning |
|---|---|
| `vol` | 0–100; loudness is (vol/100)². 80 is the default. |
| `echo` | 0–8 repeats of each note, spaced one grid unit apart (`grid=8` → an eighth), each 0.55× quieter. 1–2 gives a dub tail. |
| `bpm=min-max` | the lane plays **only while the track tempo is inside this range** (0 = no bound). `0-0` = always. This lets one track change its groove with the tempo slider (section 7). |
| `oct` | shifts the lane's **display window** (the two octaves the editor shows, from `lo + 12·oct` to `lo + 12·oct + 24`, `lo` from section 3). It **does not change pitch**: pitch is only `p`. Pick `oct` so the lane's notes fall inside that window; notes outside it still play, but the person can't see or edit them on the rings. |
| `space` | headphone surround, melodic lanes only, **at most one lane per track**: `wander` (moves around the head), `left`, `right`, `alt:0.5`, `alt:1`, `alt:2`, `alt:4` (alternates sides every N beats). |
| `far` | far echo, melodic lanes only: `1` soft, `2` medium, `3` strong (leave it out for none). A blurred repeat about 0.3 s later (the tempo-synced 1/8, 3/16 or 1/4 nearest to 0.33 s), darker each time, like a distant wall. Lovely on `jawharp`, sparse leads and voices of a breakdown. |
| `fixkey` | `1` = this lane ignores `keys` (it keeps sounding in `root`): a drone or pedal note that holds while the rest modulates. Melodic lanes only; leave it out otherwise. |
| `rate` | lane speed: `2`, `3/2`, `1/2`, `1/3`, `1/4` (leave it out for 1). The lane's notes are in its own time: step `t` sounds at track step `t / rate`, and the lane restarts with the track loop. **`rate=3/2` gives exact triplets**: a quarter in track time is 12 of the lane's steps, so its triplet eighths fall on lane steps 0, 4, 8, 12, … One track bar holds `32 × rate` of the lane's steps. |
### Limits
At most 32 lanes, 2048 notes per lane and 8192 notes per track. Over a cap the rest is cut. Keep the GLK2 text under
about 30 KB.
---
## 3. Instruments
`inst` must be one of these keys. "Range" is the comfortable `p` span: the editor shows two octaves from `lo`.
| inst | sound | range of p | good for |
|---|---|---|---|
| `vibes` | vibraphone-like mallet, long ring | 12…36 | jazz and lounge melody, soft arpeggios |
| `bells` | bright FM bell | 24…48 | sparkle, high counter-melody |
| `kalimba` | thumb piano, short and woody | 12…36 | ostinatos, organic and tribal |
| `piano` | soft piano | 0…24 | chords, ballad melody |
| `rhodes` | FM electric piano with tremolo | 0…24 | jazz and soul chords, comping |
| `organ` | drawbar organ, sustains while held | 0…24 | gospel and house stabs, long chords |
| `lead` | detuned saw lead with vibrato; an accent opens the filter | 12…36 | synth hooks, trance and synthwave leads |
| `acid` | 303-style saw through a resonant filter; slides between touching notes | −12…12 | acid lines (16ths, accents, octave jumps) |
| `theremin` | sine with glide between connected notes | 12…36 | eerie and sci-fi melody, portamento |
| `flute` | breathy flute with vibrato | 12…36 | jazz flute, world, airy melody |
| `pluck` | short synth pluck | 12…36 | arpeggios, house and trance plucks |
| `bass` | warm synth bass (sine + triangle + saw, low-pass) | −24…0 | walking bass, funk, house bass |
| `bass808` | 808: pitch drop on attack, saturated, sustains | −24…0 | trap, hip-hop, boom-bap |
| `sub` | pure sine sub | −24…0 | sub under a kick, dub, glides with `~b` |
| `psybass` | full-on psytrance rolling bass: open saw, hard click, a sine on the fundamental, pumps under the kick (silent under it, the next 16th ~7 dB down) | −24…0 | psytrance: **kick on the beat, three 16th bass notes after it** (KBBB), mostly one note (the root, e.g. A1), d=2 on grid 16 |
| `pad` | two detuned saws, slow attack | −7…17 | chord beds, ambient |
| `strings` | string ensemble | −7…17 | cinematic swells, long chords |
| `jawharp` | jaw harp (варган): a buzzy drone with a narrow mouth resonance wandering over its overtones (slow song LFO), a twang on every pluck, a "boing" on notes longer than ¼ s | −12…12 | meditative psytrance: 16ths or sparse plucks on the root an octave above the `psybass`, with `far=2`–`3` or `echo` |
| `quack` | "wah" synth: saw through formants that open on every note, a duck-like quack | 0…24 | 90s rave stabs and riffs (The Prodigy style), funky hooks |
| `drums` | drum kit (rows below) | 0…11 | every beat |
| `perc` | percussion kit (rows below) | 0…10 | latin, afro, bossa grooves on top of `drums` |
| `brushes` | jazz brush kit (rows below) | 0…9 | jazz, ballads, bossa, quiet grooves |
| `voice` | a spoken phrase, **a random one from the site's collection every time it plays**; always `p` = 0, `d` is ignored (the phrase plays to its end) | 0 | a voice sample over a break or a drop; leave room, phrases last 2–9 s; `echo` 1–2 sounds good |
**Recorded instruments** (real samples, loaded on first use; same `p` rules):
| inst | sound | range of p | good for |
|---|---|---|---|
| `grand` | concert grand piano | 0…24 | ballads, jazz chords, classical |
| `violin` | solo violin, holds long notes | 7…31 | melody, long lines |
| `cello` | cello | −12…12 | warm counter-melody, slow bass lines |
| `upright` | double bass | −24…0 | jazz walking bass |
| `bassgtr` | electric bass guitar (fingers) | −24…0 | funk, rock, pop, reggae bass |
| `nylon` | classical guitar | −5…19 | bossa, flamenco-ish, arpeggios |
| `jazzgtr` | hollow-body jazz guitar | −5…19 | jazz comping, chord melody |
| `sax` | tenor saxophone | −5…19 | jazz and soul melody |
| `trumpet` | trumpet | 7…31 | jazz, latin, fanfares |
| `choir` | choir "aah" | 0…24 | long chords, cinematic |
| `harp` | concert harp | 0…24 | arpeggios, glissandi, calm |
| `shakuhachi` | Japanese bamboo flute | 7…31 | meditative and East Asian melody |
| `koto` | Japanese zither | 0…24 | East Asian plucked melody, ostinatos |
| `sitar` | Indian sitar | 0…24 | drones, Indian-flavoured melody |
`lead`, `acid`, `theremin`, `flute`, `quack`, `sax`, `trumpet` and `shakuhachi` are melody voices: write one note at a time (acid and theremin slide or glide
between touching notes). Put chords on `rhodes`, `piano`, `grand`, `organ`, `pad`, `strings`, `choir`, `pluck`, `jazzgtr`, `nylon`, `harp` or `vibes`. A chord on
`lead` stacks several loud detuned saws and turns harsh.
Low notes on a bass (around midi 26–45, i.e. `p` from about −24 to −5 above `root`) are fine. Below midi 24 they
turn to mud.
---
## 4. Drum rows (`p` = row)
`drums`:
| p | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| sound | kick | snare | clap | closed hat | open hat | rim | low tom | high tom | shaker | ride | crash | fat snare |
`perc`:
| p | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| sound | low conga | high conga | low bongo | high bongo | cowbell | woodblock | claves | agogo | guiro | tambourine | triangle |
`brushes`:
| p | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---|---|---|---|---|---|---|---|---|---|---|
| sound | soft kick | tap | swish (long sweep) | slap | hat (pedal) | low tom | high tom | ride | ride bell | crash |
`voice` has one row: `p` = 0.
Jazz with brushes: swish on every beat, soft kick on 1 and 3, hat on 2 and 4, ride "ding ding-a ding" with swing.
Drum `d` barely matters; use 2–4. Use several drum lanes when it helps: one for the main kit, one with low `vol` for
ghost notes, and ones with `bpm=` ranges for grooves that only play at some tempos.
---
## 5. Building the link
### A. If you can run code (preferred): `#g=z…`
The code is `"z" + base64url(deflate-raw(utf8(GLK2 text)))`: raw DEFLATE without a zlib header, base64url with `-`
and `_`, no `=` padding. The link is `https://imadj.lol/#g=<code>`.
Python:
```python
import zlib, base64
def imadj_link(glk: str) -> str:
c = zlib.compressobj(9, zlib.DEFLATED, -15) # -15 = raw deflate
raw = c.compress(glk.encode("utf-8")) + c.flush()
return "https://imadj.lol/#g=z" + base64.urlsafe_b64encode(raw).decode().rstrip("=")
```
JavaScript (browser or Node 18+):
```js
async function imadjLink(glk) {
const s = new Blob([new TextEncoder().encode(glk)]).stream().pipeThrough(new CompressionStream('deflate-raw'));
const b = new Uint8Array(await new Response(s).arrayBuffer());
let bin = ''; b.forEach(x => bin += String.fromCharCode(x));
return 'https://imadj.lol/#g=z' + btoa(bin).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
}
```
### B. If you cannot run code: `#t=…`
Put the GLK2 text in the link as is, percent-encoded like `encodeURIComponent` does: space → `%20`, line break →
`%0A`, `|` → `%7C`, `:` → `%3A`, `!` stays `!`, `~` stays `~`, `-` stays `-`.
The link is `https://imadj.lol/#t=<encoded text>`.
Every character counts, so keep these tracks small (4–8 bars, a few hundred notes), and double-check the line
breaks: every lane must start after a `%0A`.
Never try to compute deflate or base64 in your head. If you have no code, use B.
---
## 6. Check before you answer
- [ ] The header starts with `GLK2|` and has bpm, root, bars and grid.
- [ ] Every lane line has exactly two `|`, a known `inst` and all of `vol echo bpm oct`.
- [ ] Every `t` is below `bars × 32` (lanes at `rate` r: below `bars × 32 × r`).
- [ ] Drum `p` is a row of that kit (`drums` 0–11, `perc` 0–10, `brushes` 0–9). Melodic `p` sits in the instrument's range.
- [ ] No duplicate `(t, p)` in a lane. Tokens are sorted.
- [ ] At most one lane has `space=`.
- [ ] Every melodic lane's `oct` puts its notes inside the editor window (section 2, `oct`).
- [ ] Chords are on a chord instrument, not on a melody voice (`lead`, `acid`, `theremin`, `flute`, `quack`, `sax`, `trumpet`, `shakuhachi`).
- [ ] The last bar leads back into the first (the bass approaches the first root, no fill cuts off mid-phrase).
- [ ] You give the link and the GLK2 code block.
---
## 7. Making it sound good
imadj plays exactly what you write: it adds no humanizing, no automation and no randomness. The musicality has to
be in the notes.
- **Start with harmony.** Pick a key and write a real progression, at least a bar per chord, with a turnaround in
the last bar. On `rhodes`, `piano` and `pad`, use voicings that move as little as possible from chord to chord
(keep common tones, move the rest by a step). Let the bass play the roots, so the keys don't have to (for example
Dm9 as F A C E).
- **The bass leads the ear.** Land on the root on beat 1 and approach the next root by a half step from above or
below on the last beat of the bar.
- **Groove comes from placement and contrast.** Accents on the backbeat, ghost notes in a quiet lane, one or two
notes pushed early (on the "and" of 4 into the next bar), space left in the pattern.
- **Use swing on purpose.** `grid=8` with `swing=60…66` gives jazz, hip-hop and shuffle feels; `grid=16` with
`swing=55…60` gives house and UK-garage swing; straight (50) suits techno, trance and psy.
- **Melody: phrases, not streams.** 2- or 4-bar phrases with rests between them; call and response between two
instruments; one long note per phrase; a leap followed by a step back.
- **Arrange inside the loop.** Over 8–16 bars change something every 4 bars: a new instrument enters, a fill on the
last beat of bar 4/8, a crash on the downbeat after the fill, a break where the kick drops out.
- **Tempo-dependent grooves (`bpm=min-max`).** Write two or three drum lanes for different tempo ranges, for
example `bpm=0-113` broken hip-hop drums, `bpm=114-0` four-on-the-floor, `bpm=122-0` extra open hats. The person
moves the tempo slider and the same track turns from a lounge groove into a dance groove. It is worth mentioning
in your answer.
- **Accent sparingly.** `!` is for a few notes per bar: the backbeat, the peak of a phrase, the first note of a riff.
If every note is accented, nothing is.
- **Shape long notes, not short ones.** `<<` / `<<<` on held strings, flute, pads and choir makes them breathe in
like a bow or a breath; `>>` on the last note of a phrase lets it die away instead of stopping. A hairpin
`<<<>>>` on a whole-bar pad note gives a swell. `*` on a long cello, violin or flute note adds a gentle tremolo.
On short notes (an eighth or less) shapes are barely heard; on piano, kalimba and plucks `<<<` sounds reversed.
- **Jazz horn phrase endings.** End a `sax` or `trumpet` phrase on one long accented note (a bar or so) with a fade
out and tremolo: `28:7:28!>>*`, or `<<>>>*` for a swell first. It sounds like a player holding the note with
vibrato as it dies away. Never bend `sax` (`~b` sounds bad on its sample); for a scoop, start the note a semitone
below and the target together, short, crossfaded: `5:5:2>>> 5:6:2!<<<` (C fades out while C# fades in), then the
next note. Upright bass: accent the downbeats and give long notes `>>>` so they decay like a plucked string.
- **Mix with vol.** Drums 75–85, bass 85–90, chords 50–65, lead 70–85, ghost lanes 25–40. The `lead` and `organ`
sounds are loud; start them lower.
- **Echo** (1–3) on one melodic lane adds depth. On every lane it turns to mush.
---
## 8. Example (4 bars, valid, plays as is)
Nu-jazz in D minor, 118 BPM, swung eighths. The `bpm=114-0` lane adds a house kick at 114 BPM and above.
Dm9 → G13 twice, walking bass, rootless Rhodes voicings, vibes melody.
```
GLK2|Blue Orbit (4-bar sketch)|bpm=118 root=2 bars=4 grid=8 swing=63
drums|vol=80 echo=0 bpm=100-130 oct=0|0:10:8! 8:3:2 8:9:3! 12:9:3 16:9:3 24:3:2 24:9:3! 28:9:3 32:9:3 40:3:2 40:9:3! 44:9:3 48:9:3 56:3:2 56:9:3! 60:9:3 64:9:3 72:3:2 72:9:3! 76:9:3 80:9:3 88:3:2 88:9:3! 92:9:3 96:9:3 104:3:2 104:9:3! 108:9:3 112:9:3 120:3:2 120:9:3! 124:9:3
drums|vol=82 echo=0 bpm=114-0 oct=0|0:0:4! 4:8:2 8:0:4 8:2:2 12:8:2 16:0:4 20:8:2 24:0:4 24:2:2 28:8:2 32:0:4! 36:8:2 40:0:4 40:2:2 44:8:2 48:0:4 52:8:2 56:0:4 56:2:2 60:8:2 64:0:4! 68:8:2 72:0:4 72:2:2 76:8:2 80:0:4 84:8:2 88:0:4 88:2:2 92:8:2 96:0:4! 100:8:2 104:0:4 104:2:2 108:8:2 112:0:4 116:8:2 120:0:4 120:2:2 124:8:2
bass|vol=90 echo=0 bpm=0-0 oct=0|0:-12:7! 8:-10:7 16:-9:7 24:-8:7 32:-7:7 40:-5:7 48:-9:7 56:-11:4 60:-11:3 64:-12:7 72:-14:7 80:-17:7 88:-18:7 96:-19:7 104:-15:7 112:-12:7 120:-11:7
rhodes|vol=60 echo=0 bpm=0-0 oct=0|0:3:6! 0:7:6! 0:10:6! 0:14:6! 12:3:4 12:7:4 12:10:4 12:14:4 36:3:4 36:7:4 36:9:4 36:14:4 52:3:6 52:7:6 52:9:6 52:14:6 60:3:8 60:7:8 60:10:8 60:14:8 76:3:4 76:7:4 76:10:4 76:14:4 88:3:4 88:7:4 88:10:4 88:14:4 96:3:6 96:7:6 96:9:6 96:14:6 108:3:4 108:7:4 108:9:4 108:14:4
vibes|vol=84 echo=1 bpm=0-0 oct=0|4:19:4 8:22:4 12:24:4 16:26:10! 28:22:4 32:21:8 40:19:4 44:17:4 48:14:12 68:19:4 72:22:4 76:24:4 80:27:8! 88:26:4 92:24:4 96:21:4 100:22:4 104:21:4 108:19:4 112:17:8
```
Link (built with method A):
https://imadj.lol/#g=zdVTLbtwwDLzvV2hv7cGAJMt6GPCllx5aoN-QfSBZJKmL3U162Y8vZ0ZBkwK9eGyRHJJDyl-_f4u3L08vR_fjvDtd3ac07O7O7vJ4vO4fPt92v56XEKo7r-t1ic5MlyW5-_PpsFR3-X36eb_kcXM4vzxfbq_r01K9O-4f1sU7Rno_hNG7dX9d_M3Pwc916-o8ztGebR63LkSgC5kQE20GNEY6uVE-ydNoQGNKOpXPlGmcsoyZTi7Lp0QaS5SxKFmVT-319IKakjX5BK-KgKrXK194KzyqKmBviJ7vNYkfNAlp-KuIn5N1MlcKYh_2jGTjkamCM6OuUoVfiS6mDQ5NG3KMmZ-JlAD4JDEnUU8inURqAJcs7pxEk8VayAqATxF3FXft5fZ6VXATd8uiscGrAa-agezLix_q8TyIGurxO_reP5NsdncXadg-7JV_p-BgVAVLNdh2FUg2NEMjGKqh6TMUQ1NkmIBVdmt_CMFSZs8X7gq50PUQkr1UmBBcwQ62hiiEo6EhgBCtKA7Fg6pszg_r4ajC838LH-e8dVaywIoXJmDAwkIOMxOC75gMx0yrQRE0AY0TQjOgCJoAxGh2nCugCHAjiaY35gzeIl4DZi2dmPeEUAShz5_Wlpm2Zabl7SEwLcbOfryCdYmEiN68nnZdr5qkV_hHrzSHpusRpUREVpt2RJn8VdBi847BerF5M8CuQEDKxEwhYsNpwG5HtUcqG3Ys_D1VcCasdOydxcBifU-OZQ5v5bMPTMaC_wA