Formula reference

Values run from 0 to 1. This page lists everything a formula can use. In the app, Formula reference… in the clip editor shows the same list. For a gentler start, see Moving with the music.

Operators

+ - * / % ^, comparisons (which give 1 or 0), && || !, and c ? a : b. Colors accept + - * / component by component.

Variables

Name Meaning
x, y Position in the track's group. Centered at 0.5; the longest side spans 0 to 1, with the same units on both axes.
rigx, rigy Position across the whole rig, shared by every track; unaffected by effects.
i A fixture's position in the group, from 0 to just under 1.
index Its position as a count: 0, 1, 2, …
count The number of fixtures in the group.
beat The global beat counter.
bar The global bar counter (beat / 4).
clipbeat Beats since this clip launched.
time Seconds since the engine started.
bass Audio level below 150 Hz, 0 to 1.
mid Audio level from 150 Hz to 2 kHz, 0 to 1.
high Audio level above 2 kHz, 0 to 1.
level Overall audio level, 0 to 1.
kick 1 on each detected kick drum, fading out.
pi, tau π and 2π.

Colors

Function Gives
rgb(r, g, b) A color from components 0 to 1.
hsv(h, s, v) A color from hue in turns, saturation and value; hue wraps every 1.
red(color), green(color), blue(color) One component of a color, as a number for another lane.
gradient(t, c1, c2, …) The color at t from 0 (c1) to 1 (the last), blended in RGB.
huegradient(t, c1, c2, …) Like gradient, blending around the color wheel the short way, so colors stay saturated.
pick(t, c1, c2, …) One of the colors, each taking an equal share of 0 to 1, without blending.

Hex colors #fff and #ff8800 also work. mix, clamp, smooth, env and delay accept colors too. Conditions must be numbers, and both branches of a conditional must have the same type.

History

Function Gives
smooth(beats, value) Exponential smoothing: it reaches 63 % of a change after beats, and 95 % after three times as long. 0 bypasses it.
env(attack, release, value) An envelope: rises toward value like smooth over attack beats, and falls over release. 0 follows at once, so env(0, 1, kick) jumps up on each kick and fades over a beat.
delay(beats, value) The value from beats ago, up to 16. Holds the first value while history fills; zero or negative passes the input through.

Waves and shapes

Function Gives
sine(p) A smooth wave, one cycle per 1.0, going 0 → 1 → 0.
tri(p) A triangle wave.
saw(p) A rising ramp.
square(p[, duty]) On or off; on for the first duty (default 0.5) of each cycle.
decay(p, rate) A hit on each whole number that fades out.
curve(p, t0, v0, t1, v1, …) The value at p along a line through the points (t, v).
scurve(p, t0, v0, …) Like curve, with smooth easing between the points.

Randomness and noise

Function Gives
random(seed) A fixed random value for each seed, e.g. random(index).
noise(p) A smooth random wander.
noise3(x, y, z) Smooth spatial noise, 0 to 1. Animate z for evolving clouds.
plasma(x, y, phase) Interfering spatial waves, 0 to 1. phase is in cycles.

Choosing and limiting

Function Gives
if(c, a, b) a if c is not zero, otherwise b. Also c ? a : b.
mix(a, b, t) A blend from a to b.
clamp(v, lo, hi) v limited to a range.
step(edge, v) 0 below edge, 1 from it.
smoothstep(e0, e1, v) A smooth 0 → 1 between e0 and e1.
min(a, b), max(a, b) The smaller or larger of two values.

Math

Function Gives
sin(v), cos(v), tan(v) Trigonometry in radians.
pow(a, b) a to the power b.
abs(v) Absolute value.
floor(v), ceil(v), round(v) Round down, up or to the nearest integer.
fract(v) The fractional part.
sqrt(v), exp(v), log(v) Square root, e to the v, and natural logarithm.

Helpers' own functions

The Noise helper writes with plasma(x, y, phase) and noise3(x, y, z); the older noise(p) keeps its one-dimensional wander.