Skip to main content

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​

FormMeaning
notes / restsSee Notes
(…)*NGroups and repeats
token*NRepeat a single atom
inst(name,N) / inst(name) / inst nameTemporary / 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:4
riff = C5 . E5 . G5 . C6 . # shorthand (no "pat" keyword)
…

Temporary instrument (inst(…))​

FormMeaning
inst(name,N)Temporary instrument for the next N non-rest hits
inst(name)Instrument override for the rest of the pattern
inst nameInline instrument switch (space form)

The count N in inst(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.

See also​