Skip to content

Step a Parameter Through Values

A parameter takes a pattern or a stepped signal as well as a number, and holds each value for its step. Signals & Time explains how a signal keeps time.

Write the values as a pattern, one per step:

use "std/instruments" { Sampler, Kit };
use "std/effects" { Delay };
use "std/signals" { signal };
let drums = AudioTrack("drums");
drums.set_instrument(Sampler(Kit("CR-78")));
drums << [bd sd bd sd];
let delay = Delay("delay", 0.25, 0.4);
drums.set_effects(#[delay]);
delay.parameter("Feedback") << [0.1 0.3 0.5 0.3];
drums.volume << [-6 0 -6 0];
PLAY;

The pattern plays exactly as it would on a track. A nested step keeps its place in the cycle, <...> takes one turn per cycle, and a transform such as .degrade() changes the steps every cycle:

delay.parameter("Feedback") << [0.1 <0.3 [0.5 0.6]>];

A rest leaves the parameter where the last step put it, so [0.1 ~ 0.5 ~] moves twice per cycle. Before the first step has played, the parameter already has its value. Where two events overlap, the one that started last holds.

For values you compute, signal(#[...]) steps through an array, dividing the cycle evenly among them:

delay.parameter("Time") << signal(#[0.1, 0.2, 0.35, 0.15]);

A jump can click or zipper. .smooth(ms) on a signal rounds off each jump; a longer time rounds it more:

delay.parameter("Time") << signal(#[0.1, 0.2, 0.35, 0.15]).smooth(10);

Start around 10 ms, and raise it until the clicks go.