Skip to content

Live Coding Workflow

On this page you rehearse a short live set: start a beat, change it, recover from a mistake, and rebuild it from saved code.

Finish Getting Started. Open your project’s src/main.non in VSCode. These exercises run live; do not use resonon run for them. Check the RESONON status item to see which server will receive your code.

Begin with an empty session. Evaluate this line by itself, then remove it from the file:

RESET;

RESET discards the session. Code selected after it in the same evaluation does not run. Keep reset and setup as separate evaluations throughout these tutorials.

Replace the file with this block, save it, select the whole block, and press Cmd+Enter (Ctrl+Enter on Windows and Linux):

use "std/instruments" { Sampler, Kit };
use "std/effects" { Delay };
set_bpm(120);
let drums = AudioTrack("drums");
drums.set_instrument(Sampler(Kit("CR-78")));
drums.volume << -6;
drums.set_effects(#[Delay("echo", 0.25, 0.3)]);
drums << [bd _ sd _, hh*8];
PLAY;

You hear drums and echoes. Open View → Output, choose RESONON, and keep it visible. The saved block is your starting point if you need to rebuild the set.

Add this line below the block. Put the cursor on it, with nothing selected, and press Cmd+Enter:

drums << [bd bd sd _, hh*8];

The new rhythm starts at the next cycle boundary. Now select just the following two lines and evaluate them together:

drums.volume << -9;
drums.pan << 0.25;

The level and pan change without restarting the beat. RESONON: Evaluate File, in the command palette, evaluates everything in the file into the current session. Try it once: it reruns the starting block and your changes. It keeps the named track; it does not start an empty session.

Evaluate this deliberately misspelled line on its own:

drumz << [bd sd];

The Output and Problems panels report an undefined name. The last good beat keeps playing. Correct the name to drums and evaluate the line again:

drums << [bd sd];

You hear the correction on the next downbeat. A parse error runs none of the selection. A runtime error stops at the failing statement; earlier statements may already have changed the session. When fixing a multi-line change, inspect what ran and reevaluate the corrected change.

Click the resonon icon in the activity bar. In Views, open Mixer, then Routing. Find drums and master in the mixer and check that drums route to master in the routing view. Open Scope to see the master waveform, and Console to see server output. Return focus to src/main.non before using the transport keys.

Press F5 to pause. Wait, then press it again: playback resumes from the same position. Press Shift+F5 to stop: the playhead returns to the beginning, but echoes ring out. Press F5 to play from the beginning.

While it plays, press Shift+F5 three times in a row. The third stop cuts remaining sound, including delay and reverb tails. Press F5: the saved tracks and patterns still play. You can also evaluate transport statements:

PAUSE;
PLAY;
STOP;
STOP;
STOP;

Evaluate RESET; by itself again. The sound stops and your variables and tracks are gone. Select only the saved starting block and evaluate it. The beat returns with the original rhythm, level and pan. To keep a change for the next set, edit it into that starting block and save.