01 Structure
otype 1
language version, first line of a file (optional)
def name [| arg ...]
define a function (a brick when it has no menu); body indented below
const name value
file-level constant (number, string, list or condition), global to all files
menu "level" >> "action"
place of the function in the menu (levels up to 6 chars, action up to 10)
page "label"
list the function on the SCRIPT page of the unit (label 1..8 characters; no argument, at most 6 params, no card/slot/pool op)
var name init
persistent variable initialized to init (integer constant) on script load
in clock n: | in note [ch]: | in cc ch n: | in trig t [all]:
event block for periodic clock, incoming MIDI note / CC events, or the sequencer's trigs
launch n
live script: quantize the first wake to the next multiple of n ticks of the grid (96 = a beat)
param name [int] d min max | bool d | option d "a"... | folder "path"
a setting editable on the unit: number in range, bool (yes/no), option (labels) or folder browser
confirm ["text"]
ask YES/NO before running (implied by destructive operations)
input sample
placement header: function acts on the host audio sample context
04 Variables
a
local to one run of the function, 0 at start; assignable
b
local to one run of the function, 0 at start; assignable
c
local to one run of the function, 0 at start; assignable
d
local to one run of the function, 0 at start; assignable
x
global, shared, kept from one press to the next, 0 at boot; assignable
y
global, shared, kept from one press to the next, 0 at boot; assignable
z
global, shared, kept from one press to the next, 0 at boot; assignable
t
global, shared, kept from one press to the next, 0 at boot; assignable
i
counter of the innermost loop (l, each); read-only, 0 outside loops
j
counter of the loop above the innermost one; read-only, 0 outside loops
05 Language
sub x y-
subtract y from x
div x y/
divide x by y (0 if y is 0)
mod x y%
remainder of x / y, never negative (0 if y is 0)
min x y
the smaller of x and y
max x y
the larger of x and y
neg x
x with its sign flipped
lim x lo hi
clamp x into lo..hi
wrap x lo hi
wrap x around into lo..hi
ne x y!=
1 if x differs from y
lt x y<
1 if x is less than y
gt x y>
1 if x is greater than y
le x y<=
1 if x is less than or equal to y
ge x y>=
1 if x is greater than or equal to y
and x y
1 if x and y are both true (both are evaluated)
or x y
1 if x or y is true (both are evaluated)
xor x y
1 if exactly one of x and y is true
? c a b
a if c is true, else b (only the chosen one is evaluated)
rnd n
random number 0..n-1
rrand a b
random number a..b inclusive
chance p
1 with p percent probability, else 0
pick list
random element of a list
at list i
i-th element of a list (1..n, clamped)
len list
number of elements of a list
er k n s
1 if step s plays in a Euclidean rhythm of k hits over n steps
er.r k n r s
like er, with the rhythm rotated by r steps
dr.v c s
velocity 0..127 of curve c at step s (16 steps, repeats): 0 flat, 1 beats, 2 off-beats, 3 ramp up, 4 ramp down, 5 eighths, 6 tresillo, 7 swell; another c reads 0
flip / flip x
alternates 0, 1, 0... on each read; flip x sets it
o / o x
counter, moves by o.inc after each read, between o.min and o.max; o x sets it
o.min x
lowest value of o (default 0) statement
o.max x
highest value of o (default 63) statement
o.wrap x
1 = o wraps around at its limits (default), 0 = it stops statement
o.inc x
step of o after each read (default 1) statement
drunk / drunk x
random walk: moves by -1, 0 or +1 on each read; drunk x sets it
drunk.min x
lowest value of drunk (default 0) statement
drunk.max x
highest value of drunk (default 127) statement
drunk.wrap x
1 = drunk wraps around at its limits, 0 = it stops (default) statement
06 Context
trk t...
act on tracks t... (or cur, or all)
steps all|a b|pred
act on all steps, steps a..b, or the steps matching a predicate (has.trig)
trk.cur
the current track number
step.cur
the current step number
seed n
reproducible randomness from here on: seeds all five streams
rand.seed n
seed the random stream of rnd, rrand and pick only
toss.seed n
seed the random stream of toss and chance only
prob.seed n
seed the random stream of the prob modifier only
drunk.seed n
seed the random stream of drunk only
file.seed n
seed the random stream of file.rnd, file.pick and slots.rnd only
09 Trigs
has.trig s
1 if step s has a trig predicate
is.empty s
1 if step s has no trig and no lock predicate
tr.add s
add a trig on step s (a one-shot or trigless trig becomes red; keeps its locks)
tr.del◌ s
remove the trig on step s (and its locks, sample lock, condition)
tr.flip◌ s
toggle the trig on step s (removal as tr.del)
tr.clr◌
remove every trig of the current steps (as tr.del) destructive
tl.add s
add a trigless lock trig on step s
tl.fill p
fill the current steps with trigless locks, p percent of them
tl.del◌ s
remove the trigless lock on step s (mask and locks)
tt.add◌ s
add a trigless trig on step s
tt.del◌ s
remove the trigless trig on step s
os.add◌ s
add a one-shot trig on step s
os.del◌ s
remove the one-shot trig on step s
os.arm◌
rearm one-shot trigs on context tracks
sw.add◌ s
add a swing trig on step s
sw.del◌ s
remove the swing trig on step s
sw.flip◌ s
toggle the swing trig on step s
sl.add◌ s
add a slide trig on step s
sl.del◌ s
remove the slide trig on step s
sl.flip◌ s
toggle the slide trig on step s
rt.add s [src]
add a recorder trig on step s with source mask src (1 AB, 2 CD, 4 internal, 1..7; default 7)
rt.del s
remove the recorder trig on step s (sources, one-shot flag and micro-timing)
rt.clr
remove every recorder trig of the current steps (as rt.del) destructive
rt.src s v
set the source mask v (1 AB, 2 CD, 4 internal, 1..7) of the recorder trig on step s
ro.add s [src]
add a ONE SHOT recorder trig on step s with source mask src (1 AB, 2 CD, 4 internal, 1..7; default 7)
ro.del◌ s
remove the recorder trig on step s, one shot or not (sources, one-shot flag and micro-timing)
11 Track
trk.swing◌ / trk.swing x
swing amount 50..80 percent on context tracks; trk.swing x sets it
trk.type◌ / trk.type x
machine type of context track (0 static, 1 flex, 2 thru, 3 neighbor, 4 pickup); trk.type x sets it
trk.slot◌ / trk.slot x
assigned sample slot of context track (1..128); trk.slot n sets it
trk.level◌ / trk.level x
track LEVEL (0..127); trk.level x sets it
trk.cue◌ / trk.cue x
track CUE level (0..127); trk.cue x sets it
trk.mute◌ / trk.mute x
track mute status (1 = muted, 0 = active); trk.mute x sets it
rec.src t n v
set recorder input source n (1 INAB, 2 INCD, 3 SRC3) to stock value v on track t (INAB/INCD 0 - 1 A B/C D 2 A/C 3 B/D 4 A+B/C+D; SRC3 0 - 1..8 T1..T8 9 MAIN 10 CUE)
rec.len t v
set recorder length RLEN to v steps (1..63) or max (64) on track t
rec.trig t v
set the recorder TRIG mode of track t: 0 ONE, 1 ONE-2, 2 HOLD
rec.loop t v
set recorder LOOP of track t: 0 off, 1 on (the captured sample loops when played back)
rec.arm t [src]
start recording on track t now, sources src (1 AB, 2 CD, 4 SRC3, 1..7; default 7); QREC is honoured statement
trk.init
reset the track's sound: fx, slot, parameters; not its trigs, locks or machine type destructive
12 Pages
Reading / writing parameters
par.get◌ p
the base value of parameter p in the part
par.set p v
set parameter p of the part to v (clamped to its range; refused if the part disables it)
par.min◌ p
the lowest value parameter p accepts on the context track (refused if the part disables it)
par.max◌ p
the highest value parameter p accepts on the context track (refused if the part disables it)
Playback
pb n
flat parameter number of the n-th parameter of the pb page
pb.setup◌ n / pb.setup n x
setting n (1..6) of the PLAYBACK SETUP page; pb.setup n v sets it
AMP
amp n
flat parameter number of the n-th parameter of the amp page
amp.atk
parameter number of amp ATK
amp.hold
parameter number of amp HOLD
amp.rel
parameter number of amp REL
amp.vol
parameter number of amp VOL
amp.bal
parameter number of amp BAL
amp.xvol
parameter number of amp XVOL
amp.setup◌ n / amp.setup n x
setting n (1..6) of the amp SETUP page; amp.setup n v sets it
LFO
lfo n
flat parameter number of the n-th parameter of the lfo page
lfo.spd n
flat parameter number of lfo n speed (n=1..3)
lfo.dep n
flat parameter number of lfo n depth (n=1..3)
lfo.dest x p
aim lfo x (1..3) at parameter p
lfo.wave◌ n / lfo.wave n x
waveform of lfo n (1..3); lfo.wave n w sets it
lfo.mult◌ n / lfo.mult n x
multiplier of lfo n (1..3, 0..6 for 1x..64x); lfo.mult n v sets it
lfo.trig◌ n / lfo.trig n x
trig mode of lfo n (1..3, 0..7); lfo.trig n m sets it
LFO designer
lfod.set◌ s v
set value (-64..63) of step s (1..16) in lfo designer
lfod.get◌ s
value of step s (1..16) in lfo designer (-64..63)
lfod.interp◌ s x
set interpolation of step s (1..16) in lfo designer (0 off, 1 on)
FX1 / FX2
fx1 n
flat parameter number of the n-th parameter of the fx1 page
fx2 n
flat parameter number of the n-th parameter of the fx2 page
fx.type x y
choose effect type y of FX block x (1 or 2)
fx.count◌ x
number of entries in the effect chooser of FX block x (1 or 2), NONE included
fx1.setup◌ n / fx1.setup n x
setting n (1..6) of the fx1 SETUP page; fx1.setup n v sets it
fx2.setup◌ n / fx2.setup n x
setting n (1..6) of the fx2 SETUP page; fx2.setup n v sets it
17 Slots
static.load n f
load file f of the list into Static slot n
static.free n
1 if Static slot n is free
static.firstfree
number of the first free Static slot (0 if none)
static.clr n
empty Static slot n destructive
static.swap◌ a b
swap the samples of Static slots a and b (an empty slot swaps too; a = b does nothing)
slots.clr
empty the working set of slots
slots.add n
add slot n to the working set
slots.rnd
a random slot of the working set
flex.load◌ n f
load file f of the list into Flex slot n
flex.free◌ n
1 if Flex slot n is free, 0 if occupied
flex.firstfree◌
number of the first free Flex slot (0 if none); recorder buffers are not counted (experimental)
flex.del◌ n
empty Flex slot n and give its RAM back (stop FIRST while the sequencer plays, if the slot is occupied; experimental) destructive
19 Live scripts
play t
schedule track t to play at the current block's tick of the live script statement
seq.run◌
1 if sequencer is running, 0 if stopped
seq.step◌ t
current playing step of track t (1..64)
seq.mute◌ t
1 if track t is muted, 0 if active
nx.smp◌ n
lock Static sample slot n (1..128) on the next play hit of this live script statement
nx.pl◌ p v
lock parameter p (0..29) to v (clamped to p's range) on the next play hit of this live script statement
note.num
note number of the current note event (0..127)
note.vel
velocity of the current note event (0..127)
note.ch
MIDI channel of the current note event (1..16)
cc.num
controller number of the current CC event (0..127)
cc.val
value of the current CC event (0..127)
cc.ch
MIDI channel of the current CC event (1..16)
trig.step
step (1..64) of the current trig event
trig.hit
1 if the current trig plays, 0 if its condition failed or the track is muted
trig.val
value (0..255) carried by a script trig (coming in 1.2)
midi.cc ch n
last value (0..127) of controller n received on MIDI channel ch (0 if none since power on)
midi.note ch
last note number (0..127) received on MIDI channel ch (0 if none since power on)
midi.vel ch
velocity of the last note received on MIDI channel ch (0 if none since power on)
send.note ch n vel dur
send MIDI note on channel ch (1..16), note n (0..127), velocity vel (0..127), duration dur (>= 1 clock ticks) statement
send.cc ch n v
send MIDI Control Change on channel ch (1..16), cc n (0..127), value v (0..127) statement
send.prog ch p
send MIDI Program Change on channel ch (1..16), program p (0..127) statement
send.nrpn ch p v
send NRPN p (0..16383) = v (0..16383) on channel ch (1..16) as CC 99, 98, 6, 38; either all four go out or none statement
gate n
emit a gate on output n (1..4) at the current block's tick; the live scripts whose `in gate NAME n` names this one run in the same pass statement
out n v
publish value v on output n (1..4), held until it changes; `cv NAME n` reads it statement
cv name n
the value published on output n (1..4) by the running script named NAME (0 if it is not running)