Skip to content

Use the REPL

Use the REPL when you want to try code interactively from a terminal.

From a directory containing resonon.toml, or a directory below it, run:

Terminal window
resonon

For a new piece, create the project first with resonon new my-piece, then cd my-piece. Wait for the > prompt.

Enter each line separately and press Enter:

use "std/instruments" { Sampler, Kit };
let drums = AudioTrack("drums");
drums.set_instrument(Sampler(Kit("CR-78")));
drums << [bd sd bd sd];
PLAY;

The prompt retains the variables between lines. Enter drums << [bd hh sd hh]; to replace the pattern at the next cycle boundary. Use the up arrow to recall and edit a previous line.

Keep a function or class definition on one input line; the REPL does not gather multiline input. For larger edits, save code in a project file and evaluate it through VSCode.

Enter STOP; to stop playback. Enter EXIT alone on a line, or press Ctrl+D, to leave the REPL. Use Ctrl+C to discard the current input without leaving.

History lasts only for this REPL session. Save code you want to keep in a .non file; neither history nor save_project() is a source-code backup.

REPL lists the commands and keys.