Skip to content

Instruments & Effects

Effects process a track’s audio; instruments generate it. Both are loaded onto tracks with load_effect / load_instrument and share the same parameter, preset, and GUI methods. Import the built-in effect constructors from std/effects:

use "std/effects" { Delay, Lowpass, Highpass, Bandpass, Notch, Allpass, Peak, Reverb, PlateReverb, Overdrive, Distortion };
ConstructorMeaning
Delay(time?, feedback?, name?)Echo with feedback
Lowpass(cutoff?, resonance?, name?)Attenuate above cutoff
Highpass(cutoff?, resonance?, name?)Attenuate below cutoff
Bandpass(cutoff?, resonance?, name?)Pass a band around the center
Notch(cutoff?, resonance?, name?)Remove a band around the center
Allpass(cutoff?, resonance?, name?)Phase shift at cutoff (phaser building block)
Peak(cutoff?, resonance?, name?)Bell-shaped boost at the center (EQ)
Reverb(room?, damp?, width?, mix?, name?)Freeverb-style reverb
PlateReverb(size?, damping?, diffusion?, predelay?, mix?, name?)Dattorro plate reverb
Overdrive(drive?, tone?, name?)Symmetrical tube-style soft clipping
Distortion(drive?, tone?, name?)Asymmetrical transistor-style clipping
Effect(plugin_name, plugin_id?)External CLAP/VST3 effect
Instrument(plugin_name, plugin_id?)External CLAP/VST3 instrument

All constructor arguments are optional and fall back to the defaults in the parameter tables below. The trailing name argument sets the effect slot name for idempotent loading.

Echo with feedback.

use "std/effects" { Delay };
let slap = Delay(0.1, 0.3);
let dub = Delay(0.5, 0.7);
ParameterRangeDefaultDescription
Time0.001–2.00.25Delay time in seconds
Feedback0.0–0.990.5Feedback amount
Mix0.0–1.01.0Dry/wet balance (0 = dry, 1 = wet)

Six state-variable filter modes share one interface: Type(cutoff?, resonance?).

use "std/effects" { Lowpass, Highpass, Bandpass, Notch, Allpass, Peak };
let warm = Lowpass(800); // smooth rolloff above 800 Hz
let resonant = Lowpass(1000, 5); // resonant peak at the cutoff
let thin = Highpass(500); // remove lows
let vocal = Bandpass(800, 8); // narrow resonant band
let dehum = Notch(60); // remove 60 Hz hum
let phasey = Allpass(1000); // phase shift only
let boost = Peak(2000, 4); // bell boost at 2 kHz
ParameterRangeDefaultDescription
Cutoff20–200001000Cutoff/center frequency in Hz
Resonance0.1–300.707Filter Q (0.707 = Butterworth, flat passband)

Freeverb-algorithm stereo reverb.

use "std/effects" { Reverb };
let hall = Reverb(0.8, 0.3);
let subtle = Reverb(0.4, 0.6, 1.0, 0.2);
ParameterRangeDefaultDescription
Room0.0–1.00.5Room size (higher = longer decay)
Damp0.0–1.00.5High-frequency damping
Width0.0–1.01.0Stereo width (0 = mono)
Mix0.0–1.00.33Dry/wet balance

Dattorro-algorithm plate reverb — lusher and more diffuse than Reverb.

use "std/effects" { PlateReverb };
let lush = PlateReverb(0.7, 0.4, 0.8);
let dark = PlateReverb(0.8, 0.9, 0.7, 0.02, 0.3);
ParameterRangeDefaultDescription
Size0.0–1.00.5Tank size (higher = longer decay)
Damping0.0–1.00.5High-frequency damping
Diffusion0.0–1.00.7Diffusion density
PreDelay0.0–1.00.0Pre-delay before the reverb tail
Mix0.0–1.00.33Dry/wet balance

Symmetrical tanh soft clipping (tube-style warmth, mostly even harmonics) with a tone control and DC blocker.

use "std/effects" { Overdrive };
let gentle = Overdrive(0.3);
let warm = Overdrive(0.6, 0.8);
ParameterRangeDefaultDescription
Drive0.0–1.00.5Distortion intensity
Tone0.0–1.00.7Post-distortion brightness
Level0.0–1.00.5Output level
Mix0.0–1.01.0Dry/wet balance

Asymmetrical clipping (transistor-style crunch, even and odd harmonics) with the same controls as Overdrive.

use "std/effects" { Distortion };
let crunch = Distortion(0.7, 0.5);
let fuzz = Distortion(1.0, 0.3);
ParameterRangeDefaultDescription
Drive0.0–1.00.5Distortion intensity
Tone0.0–1.00.7Post-distortion brightness
Level0.0–1.00.5Output level
Mix0.0–1.01.0Dry/wet balance

Load an external CLAP or VST3 effect plugin by bundle name. Resolution searches CLAP bundles first, then VST3 (or per your configured format preference), matching the filename and then the registry display name; .clap/.vst3 extensions are added automatically. Pass plugin_id to disambiguate multi-plugin bundles.

let verb = Effect("resonon-reverb"); // bundled CLAP plugin
let verb_explicit = Effect("resonon-reverb", "com.resonon.reverb");
let room = Effect("ValhallaRoom");
let eq = Effect("ReaEQ", "com.cockos.reaeq");

Load an external CLAP or VST3 instrument plugin; same name resolution as Effect(). Attach it to a track with load_instrument.

let synth = Instrument("Vital");
let track = AudioTrack("lead");
track.load_instrument(synth);

Effect parameters accept << with a number (static set), a signal (continuous modulation), or breakpoint arrays (automation):

use "std/effects" { Delay };
use "std/signals" { Sine };
use "std/instruments" { Sampler, Kit };
let drums = AudioTrack("drums");
drums.load_instrument(Sampler(Kit("CR-78")));
drums << [bd sd bd sd];
let d = Delay(0.25, 0.5);
drums.load_effect(d);
d.param("Time") << 0.1; // static value
d.param("Time") << Sine(2).range(0.1, 0.4); // signal modulation
d.param("Feedback").set(#[0, 0.3], #[4, 0.9]); // automation breakpoints

Use .range_exp() when modulating frequency parameters. Breakpoints take an optional curve: #[time, value, "exp"] — see the curve table in the Signals reference.

These methods apply to built-in effects, external plugin effects, and external instruments alike (exceptions noted). Parameter names match case-insensitively.

MethodReturnsMeaning
name()StringSlot name
set_name(name)same receiverRename the slot (for idempotent loading)
param(name)EffectParamParameter reference for << / get / set
param_get(name)NumberRead a parameter value
param_set(name, value)same receiverSet a parameter in its native range
param_set_norm(name, value)same receiverSet a parameter from a normalized 0–1 value
params(filter?)NulPrint the parameter table, optionally filtered
backend()String"dsp", "clap", or "vst3"
connect_input(port, track)same receiverFeed a track into a sidechain port (effects only)
supports_gui()BooleanWhether the plugin has a native GUI
show_gui() / hide_gui()NulOpen / close the plugin GUI
save_state(path) / load_state(path)same receiverSave / restore plugin state
programs()ArrayList factory program names (VST3)
set_program(index)same receiverSelect a factory program (VST3)

param(name) / param_get(name) / param_set(name, value)

Section titled “param(name) / param_get(name) / param_set(name, value)”

param() returns a parameter reference with get(), set(...), and set_norm(value) methods — set accepts a number, a signal, or breakpoint arrays, exactly like <<. param_get/param_set are direct shortcuts; param_set chains.

use "std/effects" { Delay };
let d = Delay()
.param_set("Time", 0.4)
.param_set("Feedback", 0.3);
let t = d.param("Time").get();
d.param("Time").set_norm(0.5); // halfway through the 0.001–2.0 range

Print all parameters with their range, default, and current value; pass a substring to filter.

use "std/effects" { Delay };
Delay().params();
Delay().params("time");

Rename the effect’s slot before loading. Slots make load_effect idempotent: re-loading the same slot replaces instead of stacking.

use "std/effects" { Reverb };
use "std/instruments" { Sampler, Kit };
let drums = AudioTrack("drums");
drums.load_instrument(Sampler(Kit("CR-78")));
drums.load_effect(Reverb(0.5).set_name("my_verb"));
let verb = drums.get_effect("my_verb");

Feed another track’s audio into a named sidechain port — the declared input of a custom DSP effect, or a plugin’s sidechain bus. Mono ports auto-downmix stereo sources. Effects only.

comp.connect_input("sidechain", bass);

Persist and restore the full plugin state as a preset file (chainable).

let verb = Effect("resonon-reverb");
verb.param_set("Room", 0.4).save_state("/tmp/my_verb.preset");
let verb2 = Effect("resonon-reverb");
verb2.load_state("/tmp/my_verb.preset");

Open a plugin’s native editor window. Built-in DSP effects have no GUI.

let synth = Instrument("Vital");
if synth.supports_gui() {
synth.show_gui();
}
synth.hide_gui();

List and select factory programs on VST3 plugins.

let synth = Instrument("MySynth");
PRINT synth.programs();
synth.set_program(3);

Define your own compiled effects with the dsp effect block — params, state, buffers, multi-port I/O, and per-sample code running in the audio engine. Instances behave like built-in effects: every method on this page applies. See DSP Effects for the block syntax and DSP Reference for the built-in functions available inside.