Skip to content

Save and open a session

Save the current tracks, mixer, arrangement and plugin state in the active project, and open them again later, as you save and open a set in a DAW. Saving evaluates no code. Opening restores the saved session, then runs the project’s entry file.

In VSCode, run Resonon: Save Project Session from the Command Palette. To copy external samples into the project too, run Resonon: Collect and Save Project Session.

In the main Resonon window, press Command-S. When the Editor has the keyboard, Command-S saves the file it shows instead.

From a terminal connected to the same server:

Terminal window
resonon save
resonon save --collect

The server saves into its active project’s session/ directory. Commit this directory with the project to keep the text document and binary plugin state together. Collect and Save copies external sample assets into samples/ and writes project-relative references. Missing samples are reported and their references are retained.

In the main Resonon window, select File > Open Project…, or select File > Reset Project to open the current project again. See Open Resonon as an app.

In VSCode, run RESONON: Reset Project from the Command Palette. It opens the project that the active file belongs to again, from its files. In Neovim, use :Resonon reset. From a terminal:

Terminal window
resonon open
resonon open path/to/project

Opening replaces the running session. It calls fn teardown() of the current session, resets the session, and restores what was saved. Tracks, routing, sends, faders, mute and solo, inputs, tempo and device chains come back. Installed plugins are loaded with their saved state. Then it runs the entry file: fn setup(), then the rest of the top level. The transport stays stopped. The steps are in The entry file’s lifecycle.

The entry file brings back the parts of a session that only code can define:

  • Patterns.
  • Custom dsp effects and instruments.
  • Sections and timelines.

Code finds the opened tracks and devices by name, so a plugin that is already loaded is kept, with its state. A rebuilt dsp effect takes the saved parameter values before the code’s own values are written. A saved dsp device that the entry file does not place stays in the chain as waiting for code. It passes audio through, or stays silent.

A plugin that is not installed opens as a placeholder. It passes audio through, keeps its saved state and is reported as not installed. Saving again keeps the state, so nothing is lost when you open the project on a machine without the plugin.

Opening loses the changes made since the last save. When UI edits or code have changed the session since the last save, the window, VSCode and Neovim ask before they reset. resonon open refuses with this message:

The session has changes since the last save. Save them, or confirm to lose them.

Save the session first, or add --discard-changes to lose the changes:

Terminal window
resonon open --discard-changes

A track, its mixer settings and its plugins are saved. The code that created them can run once, and then you can delete it. Put patterns at the top level, so that each open attaches them again. Put settings that need no variable in fn setup().

use "std/instruments" { Sampler, Kit };
fn setup() {
set_bpm(120);
session.create_track("drums");
}
let drums = session.track("drums");
drums.set_instrument(Sampler(Kit("CR-78")));
drums << [bd sd bd sd];

resonon run opens the project the same way, without a window. See File Runs.

Use --host and --port to select another server. resonon save and resonon open wait for the server’s result. Exit status is 0 on success, 1 if the session could not be saved or opened, and 2 if the connection failed. Use --message-format json for machine-readable results.

When a client renames a track, existing handles continue to refer to the same track. Opening the project again asks first if a track constructor in the entry file still uses an old name. Choose Update and Open in the window, Save, Update Names and Reset in VSCode, or Update Names and Reset in Neovim. Resonon saves the live session, updates the literal track names in the entry file, and opens the project. Cancel leaves the source and session unchanged. Comments and unrelated strings are not changed. resonon open refuses with Tracks were renamed.; update the names from an editor.