Skip to content

Record a Take

A track records from its input when it is armed and the transport is recording. Every method is in the audio reference. Recording & Latency explains the timing model.

Set the interface in ~/.resonon/preferences.toml:

[audio]
input = "Focusrite Scarlett 2i2"

The name matches exactly, then as a case-insensitive substring; with no input, the system default is used. Run reload_preferences() to apply the change without restarting. It is refused while a take is being recorded.

To see the names and channel counts, list the input devices:

for d in audio_input_devices() {
print(d["name"] + " (" + d["channels"] + " inputs)");
}

.set_input() takes channel numbers of the input device, counting from 0 — one for mono, two for a stereo pair:

let vocals = AudioTrack("vocals");
vocals.set_input(0);
let keys = AudioTrack("keys");
keys.set_input(2, 3);

A channel the device doesn’t have is an error that names the device and its channel count.

.arm() readies the track to record. .set_monitor() sets whether you hear the input: "in" always, "auto" while the track is armed or recording, "off" never. Track with "auto":

let mic = AudioTrack("mic");
mic.set_input(0);
mic.set_monitor("auto");
mic.arm();

Set .set_input() before .set_monitor(): choosing an input turns monitoring off.

RECORD;
// ... play or sing ...
STOP;

RECORD starts playback and records every armed track. STOP ends the take, returns to the start, and leaves the track armed for another pass. PAUSE halts the transport without ending the take.

Every pass is kept. .take() returns the oldest one not yet collected, as an AudioClip, or NUL when none is left:

let mic = AudioTrack("mic");
mic.set_input(0).arm();
RECORD;
STOP;
let take = mic.take();
if take != NUL {
show(take.duration()); // seconds
show(take.position()); // the cycle it was performed from
take.save("vocals.wav");
}

A take is recorded in real time, in a live session: evaluate RECORD and STOP as you play. Run in one go, with nothing in between — a file run, or one selection holding both — there is no take, and .take() returns NUL. .save(path) on the track writes its recording straight to a WAV instead.

Arm each one. RECORD records them all, each into its own take:

let vocals = AudioTrack("vocals").set_input(0).set_monitor("auto").arm();
let guitar = AudioTrack("guitar").set_input(1).set_monitor("auto").arm();
RECORD;
// ... perform ...
STOP;
let vocal_take = vocals.take();
let guitar_take = guitar.take();

.disarm() stands a track down.