Your First Project
So far you’ve been evaluating code line by line in VSCode. This is great for exploration and live coding, but when you want to save a piece, share it, or run it from the command line, you need a project.
Two Ways to Work
Section titled “Two Ways to Work”Create a Project
Section titled “Create a Project”Use resonon new to scaffold a project:
resonon new my_songOutput:
Created resonon.toml Created src/ Created src/main.non Created README.md Created LICENSE Initialized git repository
Project 'my_song' initialized.This creates a my_song/ directory with everything you need.
Project Structure
Section titled “Project Structure”my_song/├── resonon.toml # Project manifest├── src/│ └── main.non # Entry point├── README.md├── LICENSE└── .gitignoreresonon.toml
Section titled “resonon.toml”The manifest describes your project:
[package]name = "my_song"version = "0.1.0"authors = ["Your Name <email>"]resonon = "0.7.0"
[dependencies]# example = { source = "gh:user/repo", version = "v1.0" }| Field | Description |
|---|---|
name | Project name |
version | Your project’s version |
authors | List of authors |
resonon | Minimum Resonon version required |
[dependencies] | External packages (empty by default) |
src/main.non
Section titled “src/main.non”The entry point. The scaffolded template looks like this:
// Entry point — run with `resonon run`
project_title("my_song");project_bpm(120);
fn greet(name) { PRINT f"Hello from {name}!";}
greet("my_song");project_title and project_bpm set metadata for the project. You’ll replace the template code with your own music.
Run the Project
Section titled “Run the Project”From inside the project directory (or any subdirectory), run:
cd my_songresonon runResonon finds resonon.toml by searching upward from the current directory, then executes src/main.non.
You can also run any .non file directly without a project:
resonon my_script.nonAdding Music
Section titled “Adding Music”Replace the template in src/main.non with real music. Here’s a starting point using what you learned in the previous pages:
project_title("my_song");project_bpm(120);
use "std/instruments" { Sampler, Kit };
// Drumslet drums = AudioTrack("drums");drums.load_instrument(Sampler(Kit("cr78")));drums << [bd _ sd _, ch ch ch ch];
// Bass (MIDI — route to your DAW or synth)let bass = MidiTrack(2);bass << [C2 _ C2 G2];
PLAY;Opening in VSCode
Section titled “Opening in VSCode”You can also open the project in VSCode and use select-and-execute to develop interactively. Once you’re happy with the result, save your code in src/main.non so it’s reproducible with resonon run.
Project Variants
Section titled “Project Variants”resonon new accepts flags for different project types:
| Flag | Description |
|---|---|
--lib | Library project (src/lib.non instead of src/main.non) |
--kit | Sample kit project (adds a kits/ directory) |
--native | Native Rust extension project (adds a native/ crate) |
resonon new my_library --lib # Importable libraryresonon new my_drums --kit # Sample kit with kits/ directoryresonon new my_plugin --native # Rust extension with native/ crateYou can also scaffold in the current directory with resonon init:
mkdir my_project && cd my_projectresonon init my_projectNext Steps
Section titled “Next Steps”Continue the quickstart or jump to the reference docs:
- Custom DSP — Write your own effects and synthesizers
- MIDI I/O — MIDI output, input, and learn mapping
- Pattern Basics — Deep dive into time division, pattern types, and looping
- Samplers — Drum kits, melodic samplers, and sample manipulation
- VSCode Extension — Full editor reference with shortcuts and features