Formula reference
Everything a formula can use: the functions, the values the music gives, and, for text, the variables.
Functions
Phases go from 0 to 1 and repeat: beats, beatPhase and barPhase are made for them, as are time / 8 and the like.
| Function | What it gives |
|---|---|
sine(phase) | A smooth wave from 0 up to 1 and back as the phase goes from 0 to 1; sine(beats) swells once a beat. |
triangle(phase) | Straight up from 0 to 1 and straight back down as the phase goes from 0 to 1. |
saw(phase) | Climbs from 0 to 1 as the phase goes from 0 to 1, then drops back to 0. |
square(phase) | 1 for the first half of each phase, 0 for the second: an on-off blink. |
noise(x) | Wanders smoothly between 0 and 1 as x grows; noise(time) drifts, noise(time * 5) jitters. |
random(n) | A number between 0 and 1 that stays the same for each whole number n and jumps at the next; random(beats) changes once a beat. |
smooth(value, rise, fall) | Follows a value, taking rise seconds to go up and fall seconds to come down, as a synth envelope does: smooth(bass, 0.02, 0.4) jumps with the kick and settles slowly. Works on colours too. |
mix(a, b, amount) | Partway from a to b: 0 gives a, 1 gives b. Works on two numbers or two colours. |
min(a, b) | The smaller of two numbers. |
max(a, b) | The larger of two numbers. |
clamp(value, low, high) | The value, kept between low and high. |
step(edge, value) | 0 below the edge, 1 at it and above. |
smoothstep(low, high, value) | Rises smoothly from 0 to 1 as the value goes from low to high. |
abs(x) | The number without its sign. |
floor(x) | Rounded down to a whole number. |
ceil(x) | Rounded up to a whole number. |
round(x) | Rounded to the nearest whole number. |
fract(x) | What is after the decimal point: fract(2.25) is 0.25. |
sqrt(x) | The square root. |
pow(x, y) | x to the power y. |
exp(x) | e to the power x. |
log(x) | The natural logarithm. |
sin(radians) | The sine of an angle in radians; pi is there to use. |
cos(radians) | The cosine of an angle in radians. |
rgb(red, green, blue) | A colour from red, green and blue, each 0 to 1, with an optional fourth for how opaque it is. |
hsl(hue, saturation, lightness) | A colour from a hue in degrees, and saturation and lightness, each 0 to 1. |
oklch(lightness, chroma, hue) | A colour from lightness (0 to 1), chroma (0 for grey, up to about 0.37 for the richest) and a hue in degrees, in a space where equal steps look equal. |
hue(colour, degrees) | The colour turned round the colour wheel by so many degrees, as light as before. |
complement(colour) | The colour on the other side of the colour wheel. |
lighten(colour, amount) | The colour made lighter by an amount from 0 to 1. |
darken(colour, amount) | The colour made darker by an amount from 0 to 1. |
saturate(colour, amount) | The colour made richer by an amount from 0 to 1. |
desaturate(colour, amount) | The colour made greyer by an amount from 0 to 1. |
gray(colour) | The colour as a grey of the same lightness. |
alpha(colour, alpha) | The colour made see-through: 0 invisible, 1 solid. |
lightness(colour) | How light the colour looks, 0 to 1. |
chroma(colour) | How rich the colour is, from 0 for grey. |
hueOf(colour) | Where the colour is on the colour wheel, in degrees. |
red(colour) | The red of the colour, 0 to 1. |
green(colour) | The green of the colour, 0 to 1. |
blue(colour) | The blue of the colour, 0 to 1. |
alphaOf(colour) | How solid the colour is, 0 to 1. |
Music values
The bands, the level and the energy are scaled to the mix's own range, so a quiet mix moves the picture as much as a loud one.
| Name | What it is |
|---|---|
bass | How loud the bass is right now, 0 to 1, from the quietest to the loudest the mix gets. |
lowMids | The same for the low mids: the body of the bass line, toms, warm pads. |
mids | The same for the mids: vocals, leads, most of the melody. |
highs | The same for the highs: hats, cymbals, air. |
level | How loud the whole sound is right now, 0 to 1. |
beat | Jumps up on each kick, as far as the kick was strong, and falls back to 0 before the next. |
beatPhase | Goes from 0 to 1 between one beat and the next, for motion in time with the music. |
barPhase | Goes from 0 to 1 over every four beats. |
beats | The beats counted from the start of the mix, with the fraction of the one going on: 12.5 is half way through the thirteenth. |
tempo | The tempo in beats per minute. |
energy | Moves slowly: high in a drop, low in a breakdown, 0 to 1. |
time | Seconds since the start of the mix. |
progress | How far through the mix, 0 at the start to 1 at the end. |
trackProgress | How far through the track playing, 0 at its start to 1 where the next begins. 0 where no tracks are marked. |
length | The length of the mix in seconds. |
dt | Seconds since the frame before: a thirtieth of a second in an export. |
hasVideo | 1 when the recording is a video with a picture of its own, 0 when not. |
portrait | 1 when the picture is taller than it is wide (the vertical shape), 0 when not. |
aspect | The picture's width over its height: 1.78 landscape, 0.56 vertical, 1 square. |
Text variables
Text is written with variables between percent signs, such as %artist%, which fill themselves in. %% gives a percent sign. A field is written the same way: %venue%.
| Variable | Gives |
|---|---|
%mixName% | The mix's name. |
%mixNumber% | Which mix of the recording it is: 1, 2… |
%mixCount% | How many mixes the recording has. |
%mixLength% | How long the mix is, as 1:02:50. |
%elapsed% | How far into the mix, as a clock. |
%remaining% | How long is left of the mix, as a clock. |
%artist% | The mix's artist. |
%title% | The mix's title: its name. |
%album% | The recording's album, as set for the export's tags. |
%recordingName% | The recording's file name. |
%date% | Today's date. |
%currentTrack% | The track playing, as Artist - Title. Empty where no track is marked, so a text of it alone hides. |
%currentArtist% | The artist of the track playing. |
%currentTitle% | The title of the track playing. |
%trackNumber% | Which track of the mix is playing. |
%trackCount% | How many tracks the mix has. |
%nextTrack% | The track after the one playing. |
%tempo% | The tempo, in beats per minute, as a whole number. |