Skip to content

Track Methods

Audio tracks are the mixer channels of Resonon: each one holds an instrument, an effect chain, faders, and routing. Tracks are created with AudioTrack(); the master bus is the built-in master value. Most methods return the track itself, so calls chain freely: drums.volume(-3).pan(-0.2).load_effect(Delay(0.25, 0.5));.

MethodApplies toReturnsMeaning
load_instrument(inst)AudioTrackAudioTrackAttach an instrument
get_instrument()AudioTrackInstrument / NulRetrieve the loaded instrument
velocity(v)AudioTrackAudioTrackDefault note velocity (number, signal, or pattern)
delete()AudioTrackNulDelete the track
volume(db)bothsame receiverSet volume in dB
pan(position)bothsame receiverSet stereo pan (-1 to 1)
load_effect(effect)bothsame receiverAdd or replace an effect
load_effects(array)bothsame receiverLoad several effects at once
effects()bothArrayEffects in processing order
get_effect(name)bothEffectEffect by slot name
swap_effects(i, j)bothsame receiverSwap two effects by index
remove_effect(i)bothEffectRemove effect at index
clear_effects()bothsame receiverRemove all effects
send_to(dest, amount)AudioTrackAudioTrackAdditive aux send
xsend_to(dest, amount)AudioTrackAudioTrackCrossfade send (wet + dry = 1)
send_level(dest)AudioTrackSendParamModulatable handle to a send level
routing()AudioTrackNulPrint the track’s routing table
reset_routing()AudioTrackAudioTrackRestore the default master route
delay(ms?)AudioTrackNumber / AudioTrackGet or set output delay in ms
input(source)AudioTrackAudioTrackSet the audio input source
arm() / disarm()AudioTrackAudioTrackArm or disarm for recording
monitor(mode)AudioTrackAudioTrackInput monitoring: “off”, “in”, “auto”
is_armed() / is_recording()AudioTrackBooleanQuery recording state
take()AudioTrackRecordedAudio / NulRetrieve the current recording
save(filename)AudioTrackAudioTrackSave the recording to a WAV file
punch(in, out)AudioTrackAudioTrackPunch-in/out recording window
punch_in(cycle) / punch_out(cycle)AudioTrackAudioTrackSet a single punch point
clear_punch() / is_punched()AudioTrackAudioTrack / BooleanClear or query punch points
tuning(bend_range?)AudioTrackAudioTrackEnable microtonal pitch bend
mpe(bend_range?, zone_lo?, zone_hi?)AudioTrackAudioTrackEnable MPE mode
scale(scale, root)AudioTrackAudioTrackApply a per-track tuning scale

Creates a new audio track, default-routed to master. The name identifies the track in logs and routing output; duplicate names are auto-numbered. AudioTrack is built into the language — no import needed.

use "std/instruments" { Sampler, Kit };
use "std/effects" { Delay, Lowpass };
use "std/signals" { Sine };
let drums = AudioTrack("drums");
let bus = AudioTrack("fx_bus");

The master bus is the built-in master value — every track routes to it by default. It supports the fader and effect-chain methods below, but has no instrument, routing, recording, or tuning methods.

master.volume(-1);

Two operators connect patterns and tracks; both are statements, not methods.

track << pattern assigns a pattern to a track (replacing the previous one). The same operator modulates fader properties: drums.volume << Sine(4).range(-6, 0);.

source >> dest sets the track’s main output route exclusively — it replaces the previous route. Chains read left to right, and master may only appear at the end. For additive sends that keep the dry signal, use send_to() instead.

drums.load_instrument(Sampler(Kit("CR-78")));
drums << [bd sd bd sd];
drums >> bus;
bus >> master;

Set the track’s volume in decibels: 0 is unity, -70 is silence, +6 is the maximum boost. Clears any volume modulation set via track.volume << signal.

drums.volume(-3);

Set the stereo pan position from -1.0 (hard left) through 0.0 (center) to 1.0 (hard right). Clears any pan modulation.

drums.pan(-0.3);

Attach an instrument to the track, replacing any previous one. Accepts a Sampler, SamplerMelodic, or plugin Instrument (CLAP/VST3). A track holds exactly one instrument.

let lead = AudioTrack("lead");
lead.load_instrument(Sampler(Kit("CR-78")));

Return the instrument loaded on this track — the same value passed to load_instrument() — or NUL if none is loaded. Mutations through the returned reference affect the live instrument.

let inst = drums.get_instrument();

Set the default velocity (0–127) for all notes on this track. Also accepts a Signal or Pattern for velocity modulation. Per-note @ velocity in mini-notation always takes precedence.

drums.velocity(100);
drums.velocity(Sine(0.5).range(60, 127));

Delete the track and free its resources. Any further method call on a deleted track is an error.

let temp = AudioTrack("temp");
temp.delete();

All effect-chain methods work identically on master. Effects are addressed by slot name (the effect’s name, e.g. "Delay") or by 0-based chain index.

Add an effect to the end of the track’s chain. If an effect with the same slot name already exists, it is replaced in place, keeping its chain position.

drums.load_effect(Delay(0.25, 0.5));
drums.load_effect(Lowpass(800));
master.load_effect(Lowpass(12000));

Load several effects at once — equivalent to calling load_effect() for each element.

bus.load_effects(#[Lowpass(2000), Delay(0.5, 0.3)]);

Return the track’s effects as an Array, in processing order.

let chain = drums.effects();
PRINT chain.length();

Return the effect with the given slot name. Errors if no such effect is loaded.

let dly = drums.get_effect("Delay");

Swap two effects in the chain by 0-based index. Errors if either index is out of bounds.

drums.swap_effects(0, 1); // filter before delay

Remove the effect at the given index and return it.

let removed = drums.remove_effect(1);

Remove all effects from the chain.

bus.clear_effects();

Add an additive aux send to another track or master. The dry route to master stays at unity, so the destination receives a copy. amount is 0.01.0, or a Signal/Pattern for modulated send levels.

let verb = AudioTrack("verb");
drums.send_to(verb, 0.4);
drums.send_to(verb, Sine(0.25).range(0.1, 0.5)); // modulated send

Crossfade send with energy conservation: the wet route gets amount and the dry route to master gets 1.0 - amount. Sending to master is rejected (use volume() instead). Accepts a Signal/Pattern like send_to().

drums.xsend_to(verb, 0.6); // 60% wet, 40% dry

Return a modulatable SendParam handle to an existing send level — useful as an automation target. The route must already exist (created via send_to()).

drums.send_to(verb, 0.3);
let lvl = drums.send_level(verb);

Print the track’s current routing table (destinations and send levels).

drums.routing();

Clear all sends and send modulations, restoring a single route to master at unity gain.

drums.reset_routing();

With an argument, set the track’s output delay in milliseconds (non-negative); other tracks are automatically compensated through the plugin-delay-compensation system. Without an argument, return the current delay.

drums.delay(2.5);
let d = drums.delay();

Recording needs a hardware input, so these examples are not runnable headless. Recording starts with the RECORD transport statement and only affects armed tracks.

Set the track’s audio input source by name — either a named input from your audio configuration or a device name. Starts the hardware input stream on first use.

vocals.input("mic");

Arm the track so RECORD captures its input; requires input() to be set first. disarm() stops capturing while leaving the input configured.

vocals.input("mic").arm();
vocals.disarm();

Set input monitoring: "off", "in" (always hear the input), or "auto" (hear it only while armed).

vocals.monitor("auto");

is_armed() is true while the track is armed or recording; is_recording() only while audio is actively being captured.

if vocals.is_armed() { PRINT "ready"; }

Retrieve the completed recording as a RecordedAudio value, or NUL if none is available. Consumes the buffer — a second take() returns NUL until a new recording is made. If the track is still recording, it is stopped first.

let clip = vocals.take();

Save the current recording to a WAV file (the .wav extension is added if missing). Consumes the recording buffer like take().

vocals.save("takes/vocal_01.wav");

Set a punch window: recording activates at in_cycle and deactivates at out_cycle. punch_in() and punch_out() set one boundary each; clear_punch() removes them; is_punched() queries whether any are set.

vocals.punch(4, 12); // record cycles 4-12 only
vocals.punch_in(8);
vocals.punch_out(16);
vocals.clear_punch();
if vocals.is_punched() { PRINT "punch active"; }

Enable microtonal playback: fractional note values are rendered via pitch bend. bend_range is in semitones (default 2, max 96).

lead.tuning();
lead.tuning(12);

Enable MPE mode, allocating one channel per voice. bend_range defaults to 48 semitones; the member-channel zone defaults to channels 2–16.

lead.mpe();
lead.mpe(48, 2, 16);

Apply a tuning scale to the whole track: every note is retuned to the scale, anchored at the given root note. Takes a Scale value — including microtonal scales with fractional intervals.

lead.scale(Scale(#[0, 1.5, 3.5, 5, 7, 8.5, 10]), C4);
  • Transport — PLAY, PAUSE, STOP, RECORD, SEEK
  • Effects — all built-in effects and their parameters
  • Signals — modulation sources for sends, faders, and velocity
  • Sampler & Sample — instruments to load onto tracks