The language, one mark at a time
What each mark means and what the engine does with it. Every example on these pages is a real document: it was executed before the page was built, what it played is printed beside it, and you can change it and hear the difference.
Every construct 36
The document
one textThe documentA project is one text. Every line is an expression, a rule or a command, and they run from the top down.% · %%Comments and fillersA single%starts a comment that runs to the end of the line. Two or more,%%, is a filler that plays nothing and lasts no time.rules · helpHousekeepingrulesprints every rule defined so far.helpprints the quick reference.
The clock
Pitch
key <root>[oct] <quality>KeyThe key that scale degrees resolve against: a root, an optional octave, andmaj,min,harmormel.mode diatonic | chromatic | midiModeWhat a bare number means.diatonic, the default, reads it as a scale degree.chromaticcounts semitones from the key root.midireads a MIDI note number.c4 f#3 eb5 m60Literal notesA pitch named outright: a lowercase letter, an optional accidental, an octave number.c4is middle C.1 '3 .5 6# 8Scale degreesA bare number is a step of the current scale.'raises it an octave,.lowers it,#andbalter it by a semitone.i<n> · s<n>Relative pitchi<n>is n semitones from the last pitch written.s<n>is n steps of the current scale. The figure moves wherever you start it.!c4 · Name(a b)Anchors!c4sets the pitch that relatives count from, without playing it.Name(a b c)states a relative rule once from each note.> · <Melodic minor directionIn amelkey,>selects the ascending form, with raised 6 and 7, and<the descending form, with natural 6 and 7.
Chords and voices
1Maj · cMin7 · 5Dom9Chord symbolsOne token that sounds a whole chord: a root, then a quality. The root is a note name (c,eb) or a degree (1,5).1Dia · 5Dia7Chords from the scaleDiastacks thirds from the scale itself, so the key decides the quality.1Maj$3 · $1-5-3VoicingsA$after a chord lists its members from the bottom up.{a, b}Voices togetherFields inside braces, separated by commas, sound at the same time. The first field sets the length and the others stretch or squeeze to fit it.
Drums
Duration
Transforms
@k · @~kTranspose@kmoves a figure by k semitones.@~kmoves it by k steps of the current scale, so it stays in the key.~RetrogradeThe figure played backwards. Durations go with their notes.^InversionThe figure mirrored around the axis: what went up goes down. The axis is degree 1 unlessaxissays otherwise.axis <degree | first>Inversion axisWhere^mirrors. The default is degree 1.axis 3mirrors around the third, andaxis firstmirrors each figure around its own first note.
Naming
Name ::= …RulesName a figure withName ::= body. Uppercase names are rules; lowercase words are sounds.instrument <voice> · Name<voice> ::= … · Name<voice>InstrumentsSay what the document is played on withinstrument bell, or what one rule is withBass<bass> ::= …. A use site overrides both:Bass<bell>. The tag takes no space before it, because a lone<is the descending mark.Name[a:b]SlicesA python slice over the ITEMS a reference plays:Row[:4],Row[2:],Row[::-1].Name \i xOverridesState a rule with one item replaced. The index is ZERO-BASED and counts what the reference PLAYS.Cell ::= $1 … · Cell(x)Cells and holesA rule with holes.$1is filled by the first argument,$2by the second. When there are more arguments than holes, the cell repeats to use them all.
Generators
A ::= x = y · A#nAlternatives=separates alternatives, which makes a rule a generator with one derivation per alternative. A bare reference plays the first;Name#nplays the nth.x? · x? yOptional slotsx?plays x or a rest of the same length.x? yplays x or y, with y fitted to x's length. Either way the beat never moves.x& · ( )Repetition and groupsx&is zero or more x. Parentheses group items so a postfix covers all of them. One or more isx x&.Name#a;b;cSelectorsAfter#, segments separated by;choose a derivation by what it holds. A number picks,ascanddescorder by pitch, and anything else must match the item at that position.