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));.
| Method | Applies to | Returns | Meaning |
|---|---|---|---|
load_instrument(inst) | AudioTrack | AudioTrack | Attach an instrument |
get_instrument() | AudioTrack | Instrument / Nul | Retrieve the loaded instrument |
velocity(v) | AudioTrack | AudioTrack | Default note velocity (number, signal, or pattern) |
delete() | AudioTrack | Nul | Delete the track |
volume(db) | both | same receiver | Set volume in dB |
pan(position) | both | same receiver | Set stereo pan (-1 to 1) |
load_effect(effect) | both | same receiver | Add or replace an effect |
load_effects(array) | both | same receiver | Load several effects at once |
effects() | both | Array | Effects in processing order |
get_effect(name) | both | Effect | Effect by slot name |
swap_effects(i, j) | both | same receiver | Swap two effects by index |
remove_effect(i) | both | Effect | Remove effect at index |
clear_effects() | both | same receiver | Remove all effects |
send_to(dest, amount) | AudioTrack | AudioTrack | Additive aux send |
xsend_to(dest, amount) | AudioTrack | AudioTrack | Crossfade send (wet + dry = 1) |
send_level(dest) | AudioTrack | SendParam | Modulatable handle to a send level |
routing() | AudioTrack | Nul | Print the track’s routing table |
reset_routing() | AudioTrack | AudioTrack | Restore the default master route |
delay(ms?) | AudioTrack | Number / AudioTrack | Get or set output delay in ms |
input(source) | AudioTrack | AudioTrack | Set the audio input source |
arm() / disarm() | AudioTrack | AudioTrack | Arm or disarm for recording |
monitor(mode) | AudioTrack | AudioTrack | Input monitoring: “off”, “in”, “auto” |
is_armed() / is_recording() | AudioTrack | Boolean | Query recording state |
take() | AudioTrack | RecordedAudio / Nul | Retrieve the current recording |
save(filename) | AudioTrack | AudioTrack | Save the recording to a WAV file |
punch(in, out) | AudioTrack | AudioTrack | Punch-in/out recording window |
punch_in(cycle) / punch_out(cycle) | AudioTrack | AudioTrack | Set a single punch point |
clear_punch() / is_punched() | AudioTrack | AudioTrack / Boolean | Clear or query punch points |
tuning(bend_range?) | AudioTrack | AudioTrack | Enable microtonal pitch bend |
mpe(bend_range?, zone_lo?, zone_hi?) | AudioTrack | AudioTrack | Enable MPE mode |
scale(scale, root) | AudioTrack | AudioTrack | Apply a per-track tuning scale |
Creating Tracks
Section titled “Creating Tracks”AudioTrack(name?)
Section titled “AudioTrack(name?)”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");master
Section titled “master”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);Routing Statements
Section titled “Routing Statements”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;Faders
Section titled “Faders”volume(db)
Section titled “volume(db)”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);pan(position)
Section titled “pan(position)”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);Instruments
Section titled “Instruments”load_instrument(instrument)
Section titled “load_instrument(instrument)”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")));get_instrument()
Section titled “get_instrument()”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();velocity(v)
Section titled “velocity(v)”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()
Section titled “delete()”Delete the track and free its resources. Any further method call on a deleted track is an error.
let temp = AudioTrack("temp");temp.delete();Effect Chain
Section titled “Effect Chain”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.
load_effect(effect)
Section titled “load_effect(effect)”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_effects(array)
Section titled “load_effects(array)”Load several effects at once — equivalent to calling load_effect() for each element.
bus.load_effects(#[Lowpass(2000), Delay(0.5, 0.3)]);effects()
Section titled “effects()”Return the track’s effects as an Array, in processing order.
let chain = drums.effects();PRINT chain.length();get_effect(name)
Section titled “get_effect(name)”Return the effect with the given slot name. Errors if no such effect is loaded.
let dly = drums.get_effect("Delay");swap_effects(i, j)
Section titled “swap_effects(i, j)”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 delayremove_effect(i)
Section titled “remove_effect(i)”Remove the effect at the given index and return it.
let removed = drums.remove_effect(1);clear_effects()
Section titled “clear_effects()”Remove all effects from the chain.
bus.clear_effects();Sends & Routing
Section titled “Sends & Routing”send_to(dest, amount)
Section titled “send_to(dest, amount)”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.0–1.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 sendxsend_to(dest, amount)
Section titled “xsend_to(dest, amount)”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% drysend_level(dest)
Section titled “send_level(dest)”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);routing()
Section titled “routing()”Print the track’s current routing table (destinations and send levels).
drums.routing();reset_routing()
Section titled “reset_routing()”Clear all sends and send modulations, restoring a single route to master at unity gain.
drums.reset_routing();delay(ms?)
Section titled “delay(ms?)”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
Section titled “Recording”Recording needs a hardware input, so these examples are not runnable headless. Recording starts with the RECORD transport statement and only affects armed tracks.
input(source)
Section titled “input(source)”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() / disarm()
Section titled “arm() / disarm()”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();monitor(mode)
Section titled “monitor(mode)”Set input monitoring: "off", "in" (always hear the input), or "auto" (hear it only while armed).
vocals.monitor("auto");is_armed() / is_recording()
Section titled “is_armed() / is_recording()”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"; }take()
Section titled “take()”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(filename)
Section titled “save(filename)”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");punch(in_cycle, out_cycle)
Section titled “punch(in_cycle, out_cycle)”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 onlyvocals.punch_in(8);vocals.punch_out(16);vocals.clear_punch();if vocals.is_punched() { PRINT "punch active"; }Tuning
Section titled “Tuning”tuning(bend_range?)
Section titled “tuning(bend_range?)”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);mpe(bend_range?, zone_lo?, zone_hi?)
Section titled “mpe(bend_range?, zone_lo?, zone_hi?)”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);scale(scale, root)
Section titled “scale(scale, root)”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);See Also
Section titled “See Also”- 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