Patterns
A pattern (pat) is a named list of tokens. Length is the sum of token durations — BeatBax does not require a fixed size.
pat name = <PatternRhs>
name = <PatternRhs> # shorthand (same as pat; name must not be a reserved word)
Keep patterns on different channels the same length when you chain them in sequences so parts stay locked.
Pattern RHS
| Form | Meaning |
|---|---|
| notes / rests | See Notes |
(…)*N | Groups and repeats |
token*N | Repeat a single atom |
inst(name,N) / inst(name) / inst name | Temporary / inline instrument |
name<…> | Identifier or note with effect suffixes |
"tok tok …" | Quoted whitespace-split token list |
Groups and repeats
pat rise = (C5 E5 G5)*2 C6:4
pat lead_pat = E5 . G5 C6 . G5 E5 .
riff = C5 . E5 . G5 . # shorthand
Groups, repeats, shorthand
Interactive playback loads in the browser.
…pat rise = (C5 E5 G5)*2 C6:4riff = C5 . E5 . G5 . C6 . # shorthand (no "pat" keyword)…Temporary instrument (inst(…))
| Form | Meaning |
|---|---|
inst(name,N) | Temporary instrument for the next N non-rest hits |
inst(name) | Instrument override for the rest of the pattern |
inst name | Inline instrument switch (space form) |
The count
Nininst(name,N)applies only to notes/sustains — rests (.) do not consume from the count.
Temporary instrument override
Interactive playback loads in the browser.
…pat call = C5 E5 G5 inst(bass,2) C3 E3 G5 C5…Pattern names can include colon modifiers in the left-hand name (pat motif:rot(1) = …) — see Modifiers.