Draw an Automation Curve
automation() is a curve through breakpoints, placed in cycles; signal_ramp() is a straight line.
Both are in std/signals, and either can drive anything you set with <<.
Signals & Time explains how a signal keeps time.
Place the breakpoints
Section titled “Place the breakpoints”Give automation() #[time, value] breakpoints, with the time in cycles:
use "std/instruments" { Sampler, Kit };use "std/effects" { Lowpass };use "std/signals" { automation, signal_ramp };
let drums = AudioTrack("drums");drums.set_instrument(Sampler(Kit("CR-78")));drums << [bd sd bd sd];
let filter = Lowpass("lowpass", 800);drums.set_effects(#[filter]);
let sweep = automation(#[0, 0.0], #[2, 1.0], #[4, 0.3], #[6, 0.0]);filter.parameter("Cutoff") << sweep.range_exp(200, 4000);
PLAY;The first value holds before the first breakpoint, and the last after the last one. Breakpoint
times are counted in the signal’s timebase: for times in seconds, add .set_timebase(seconds(1)); for
beats, .set_timebase(beats(1)).
Shape each segment
Section titled “Shape each segment”A third element sets the curve of the segment that starts at that breakpoint:
let shaped = automation( #[0, 0.0, "smooth"], #[2, 1.0, "ease-out"], #[4, 0.3, "step"], #[6, 0.0]);filter.parameter("Cutoff") << shaped.range_exp(200, 4000);The curve names are listed under automation.
Draw a straight ramp
Section titled “Draw a straight ramp”signal_ramp(start, end) rises in a line over one cycle and repeats; a third argument stretches it
over several cycles:
filter.parameter("Cutoff") << signal_ramp(0, 1, 4).range_exp(200, 4000);Running the line again restarts the ramp at the next cycle boundary.
Related
Section titled “Related”- Signals —
automation,signal_rampand the curve names - Automate a Song — place automation at a point in a song
- Sweep a Parameter with an LFO — a shape that loops