Manual

The pattern notation

Read by Strand and Refrain

Strand and Refrain keep every pattern as a line of text in one small language. You never have to write it: the steps you click, the dials you turn and the styles you pick all write it for you. It is behind Code in both plugins for when you want to type, and a few things can only be typed.

This page is the whole language. Each plugin's own manual covers its window, its controls and what it does with a pattern: Strand, Refrain.

Inside either plugin, ? beside the text opens the same tables on one sheet. Click a row to load its example.


What each plugin reads

Strand Refrain
What a hit is the gate opening a note, a chord or a drum
Rests, holds, groups, repeats, chance yes yes
Words that change a pattern the ones about time all of them
Notes, chords, drums, the harmony no: a gate has no notes, and it says so yes
A hit's own level and length how far and how long the gate opens velocity and held length

A bar and its steps

A pattern describes one cycle, which is one bar unless Cycle says otherwise. The steps you type share it equally, so x x x x is four beats and x x x is three across the same bar.

You type You get
x a hit. Any word you have not given a meaning is a hit, so boom tick tick is a rhythm
~ a rest
_ hold the step before this one longer

Groups, repeats and chance

You type You get Try
[a b] one step split into parts x [x x] x [x x x]
[a, b] two sequences layered: both sound [x ~ x, ~ x ~ x ~]
[a | b] one of them each cycle, the same way every time x [x x | ~ x] x
<a b> alternate: one per cycle <x ~> x <x [x x]>
a*n n times inside its step x*2 ~ x*3
a/n once every n cycles x [x x]/2
a!n the step repeated n times x!3 ~
a? kept half the time. a?0.8 for 80 % x x? x x?0.3
a(k,n) Euclidean: k hits spread over n steps x(3,8)
a(k,n,r) the same, rotated by r x(5,8,2)
a@w weight w, so the step takes more of the bar x@3 x

A modifier on a group applies to everything inside it.

Nothing here is random in the usual sense. A ? and a [a | b] are decided from the cycle number, so bar 37 plays the way it played last time, and the display can show what is coming.

A hit's own level and length

The signs are the same in both plugins. What they set is each plugin's own.

You type In Strand In Refrain
x^0.5 how far the gate opens for it that fraction of the Velocity knob
x:0.5 its length, as a share of what Gate gives every step held half a step. x:2 is two steps
x{attack:80;release:300} its own attack and release, in ms not read

In Strand these three are what the knobs in the Step panel write. Refrain reads three more:

You type You get
x^ louder: a quarter above the Velocity knob
x. quieter: half
x^100 exactly velocity 100, whatever the knob says

They stack, in any order: c3^:2 is a loud, long C3.

Words that change a pattern

A word can take a pattern and give back a pattern. They nest, they take modifiers like anything else, and they go anywhere a step can: x ~ rev(x x ~ x) reverses only the second half of the bar.

You type You get Reads it
rev(a) the same bar, backwards both
off(n, a) and again, n of a cycle later, layered over it both
off(n, f, a) the same, with f done to the copy on the way Refrain
every(n, f, a) f done to it every nth cycle. f is rev or palindrome, and in Refrain invert both
iter(n, a) the bar starts one nth later each cycle, coming round after n both
ply(n, a) every hit becomes n hits inside its own step both
chunk(n, f, a) the bar cut into n, and f done to a different one each cycle both
palindrome(a) there one cycle, back the next both
swing(n, a) this part swung, from 0 to 1, whatever the Swing knob says both
accel(n, a) faster across the span: accel(2, ..) ends twice as fast as it starts. Below 1 slows down both
transpose(n, a) every note moved n steps along the Scale. Negative goes down Refrain
octave(n, a) every note n octaves up, 1 to 4. Negative goes down. Drums stay where they are Refrain
invert(a) the line turned upside down, about the middle of its own range Refrain
ramp(v1, v2, a) the velocity faded from one level to another across it Refrain
channel(n, a) sent out on MIDI channel n, whatever the knobs say Refrain
cc(n, a) its levels become controller n instead of notes: 1 is the mod wheel, 11 expression, 74 a filter Refrain

every takes only the words that need no number of their own, so every(4, rev, a) works and every(4, transpose, a) does not.

Strand refuses the words that are about notes, and says why, so that they never sit in a pattern doing nothing.


Notes, in Refrain

Everything from here on is Refrain's. Strand has no notes.

You type You get
x a hit on the key
0 2 4 -1 a degree of the Scale, counted from the key, or from the chord under it when you write a progression. See The harmony below
c3 eb2 f# bb4 that note, whatever the key is. No octave means octave 3
bd sn hh oh cp cl a drum, on its General MIDI note. Never transposed
c3'maj 0'm7 g'sus4 a chord: a note or degree, a quote, a chord name
4'#maj that chord a semitone up (## for two): a chord whose root is not a note of the scale, written on a degree so that it follows the Key
c3'maj7'drop2 that chord spread this way, whatever the Chords menu says. The names are the menu's: see Chord spacings in Refrain's manual
c3'maj7'inv2 that chord turned over, inv1 to inv3
c3+ 0- an octave up, or down. Repeat the sign to go further
g3& slide into it from whatever sounded last on its channel

A chord can be spread into a run with %:

You type You get
c3'maj% upwards
c3'maj%d downwards. %ud and %du go both ways
c3'maj%ud8 the same, over eight notes, so it fills the step
c3'maj7%o outside in: lowest, highest, next lowest, meeting in the middle
c3'maj7%i inside out, which is that walk backwards
c3'maj7%a an Alberti figure: bottom, top, middle, top
c3'maj7%p a pedal: the lowest note between every other one
c3'maj7%w a walk: one step at a time through the chord, never a leap, the same every bar
c3'maj7%r a new order every bar
c3'maj7%s one scramble, kept: jumbled, and the same every bar

Several lines

Everything after // on a line is a comment. A line of the form name = ... names a pattern; use the name below it as a word. A name may use the names above it.

// a drum kit, one line each
kick  = bd ~ ~ bd ~ ~ bd ~
snare = ~ ~ sn ~ ~ ~ sn ~
hats  = [hh hh]*4
[kick, snare, hats]

Any other line is part of the pattern; several of them join into one.

Lines with names and a last line that plays them together, like the kit above, are what Refrain's window calls layers: each has a pill and a grid of its own. Named lines that take turns, <verse verse chorus>, are bars with names.

The harmony

A line named chords is the progression the rest of the text is heard against.

chords = 1'm7 4'7 0'maj7 0'maj7
0 2 4 2

That is a two-five-one, and the melody over it is four degrees. A degree is counted along the Scale from the root of the chord sounding under it, so those same four degrees are D, B, G, E: the line follows the changes without being rewritten. Degree 0 is the chord's root, 2 is its third, 4 its fifth, 6 its seventh, and the odd numbers between are the passing notes.

That holds for a chord that is not the scale's own. Over a major five in a minor key, degree 2 is that chord's major third and not the scale's minor one. Over a chord whose root is not a note of the scale at all (4'#maj), every degree is counted from that root.

With no chords line, a degree is counted from the Key, which is what it has always meant. Writing a progression only adds; nothing you already have changes.

chords is an ordinary definition, so it does not sound by itself. Write the word into your pattern to hear it:

chords = 1'm7 4'7 0'maj7 0'maj7
[chords, 0 2 4 2]

Note names, plain x and drums are not moved by the harmony. c3 is C3 whatever chord is underneath, because you asked for C3. Only degrees follow.

The pattern's line names the chord you are on while it plays, at its right end: Dm7, G7, Cmaj7, and just the letter when it is a plain triad.

A chord written on a degree follows the progression too. 0'maj is a major triad on whatever root is under it, so chords = 1'm7 4'7 with 0'maj 0'maj gives a D major triad and then a G major one. Only chords written on note names, c3'maj, stay where you put them.

Notes through the words

off is the one worth learning first. One line becomes two voices:

riff = 0 2 4 2
[riff, off(0.125, rev, riff)]

channel lets one Refrain drive a rack. Everything in it goes to that channel, so a kit, a bass and a lead can be three lines in one text:

kit  = bd ~ sn ~
line = 0 2 4 2
[channel(10, kit), channel(1, line)]

cc sends a controller rather than a note, and a controller value is just a level, so everything you already know about shaping levels shapes it too. A mod wheel swell under a line, in one bar:

line = 0 2 4 2
[line, cc(1, ramp(1, 127, x*16))]

ramp sets the ends, x*16 decides how often a value is sent, and cc(1, ..) says which controller hears it. cc(74, x^100 x^20) puts a filter in two places instead of sweeping; cc(11, channel(3, x*8)) sends expression to channel 3 alone. The Velocity knob is not involved: a controller is a position, not how hard something was hit.

They are worth most on a name, because then you write the line once:

riff = c3 ~ e3 g3
riff rev(riff) transpose(2, riff) invert(riff)

Change a note in riff and all four bars follow.

They take modifiers like anything else, they nest, and they can sit anywhere a word can: rev(riff)*2, transpose(1, rev(riff)), c3 rev(e3 g3) c4.

Two things they will not do. Drums never transpose: transpose(3, bd sn) is still a kick and a snare, because a kit is a set of sounds and not a scale. And every takes only the words that need no number of their own, so every(4, rev, a) works and every(4, transpose, a) does not.

A plain x does transpose, into the note that many steps above the key. It stops being "the key" at that point, which is the price of hearing it move.


Where it comes from

This is the mini-notation of TidalCycles and Strudel, open-source projects by Alex McLean, Felix Roos and contributors. Monoglyph Audio is not affiliated with or endorsed by them. The plugins read it with a parser of their own, so what you know there works here and the reverse.