choice(list)
list → anyOne element picked at random. Re-rolled on every eval.
Building and reshaping lists — of notes, of steps, of anything else.
One element picked at random. Re-rolled on every eval.
Dot a written note value: q.dot is a dotted quarter, a quarter and an eighth. dots defaults to 1; q.dot(2) is the doubly-dotted quarter, which is a quarter and an eighth and a sixteenth. Written as a count rather than by repeating .dot, because each dot adds half of the note itself rather than half of what the last one left.
Keep the elements the predicate answers non-zero for. The predicate is an ordinary user fn of one argument.
The number of elements in the list.
Apply a function to every element: riff.map(up). The transform is an ordinary user fn of one argument, and may answer with anything — mapping to oscillators is the only way to hold several voices apart, since a for over audio sums instead of collecting.
The list followed by its mirror: [a, b, c] becomes [a, b, c, c, b, a].
A new list without its last element. Index the list to read that element.
A new list with value appended. Lists are immutable — the original is unchanged.
The list, back to front.
Rotate left, wrapping. amount defaults to 1; a negative amount rotates right.
Rotate right, wrapping. amount defaults to 1; a negative amount rotates left.
The list shuffled. Re-rolled on every eval.
The list sorted ascending. Every element must be a compile-time number.
Break the list into chunks of size. A short final chunk is kept.
Patterns that sound at once instead of in turn: stack([c4;2, e4;2], [g4;4]) is a two-note line under a held g. Each argument keeps its own division, so the layers need not agree on a rhythm — a three against a four is written by stacking them. This is how a chord is written, and how a drawn part with overlapping notes is split into voices. Lanes read a stack as all its values in order, layer by layer.
Add every element together. Folds numbers at compile time and emits mixing nodes for signals, so a list of oscillators sums into the graph.
One element picked at random, weighted. The two lists run in parallel; weights must be finite and >= 0.
Pair elements positionally: zip([1, 2], [3, 4]) is [[1, 3], [2, 4]]. Every argument must be a list, and all must be the same length.
18names in Lists. All categories.