Two Ways to Run a Piece
A piece is the code in one project, and there are two ways to run it. Live, a session keeps
running and you evaluate the piece into it a fragment at a time, hearing each change as you make it.
As a file run, resonon run evaluates the project’s src/main.non once, from top to bottom,
writes what it renders to disk, and exits. It is the same language and the same patterns in both,
with a different relationship to time — the way one Csound orchestra plays to the speakers or renders
to a file.
A server holds a session, and you send it code from VSCode or the REPL. Playback runs in real time, you drive it with the transport, and a new pattern lands on the next cycle, so edits stay in time. The session remembers everything evaluated into it, so the piece grows by evaluation (The Evaluation Model).
Live is how you hear a piece: performing, composing by ear, exploring, playing an arrangement through. Recording a take, clocking hardware and playing through outboard gear all happen here, because they happen in real time.
File run
Section titled “File run”resonon run evaluates src/main.non from any directory inside the project and exits after its last
statement. There is no session to grow: the file is the program. It writes files only where it asks
to — audio where it calls render(), which runs the audio graph faster than real time, and MIDI where
it calls midi_export().
A file run is how you bounce a piece: a finished mix or stems for a DAW or a collaborator, a render in a script, a check in CI. A render needs no audio device. The transport statements run in a file run as they do live, but the run ends after the last statement, and playback with it, so a file run is not a way to listen.
What differs
Section titled “What differs”| Live | File run | |
|---|---|---|
| How you run it | A server, with VSCode or the REPL | resonon run |
| Session | Lasts across evaluations | Runs once, then exits |
| Time | Real time | Faster than real time, inside render() |
| Output | Sound, on the audio interface and MIDI ports | WAV, PNG and MIDI files |
| Suits | Performing, composing by ear, recording | Bouncing, scripts, CI |
A render is made from the session’s audio graph, so it leaves out what exists only in real time: MIDI tracks, tracks sent to hardware outputs, live inputs, and the round trip through outboard gear. What a render contains lists it all.
render() is not only for file runs. Evaluated in a live session, it bounces the session as it
stands; live output pauses while it runs.
Related
Section titled “Related”- The Evaluation Model — what a live evaluation does
- File Runs — what
resonon runopens, and its exit status - Render a Project —
render(), stems, and where files land