Your First Sound
On this page you make a project, play a drum beat from VSCode, and change it while it plays.
You need resonon and the VSCode extension installed — see Installation.
Before you start
Section titled “Before you start”Check resonon --version and that the extension is enabled. Use a new hello project for this page.
If you already have a live session, evaluate RESET; on its own before the first beat, then remove
that line. The session should be silent.
Make a project
Section titled “Make a project”A piece lives in a project: a folder with a resonon.toml in it. Open a terminal and make one:
resonon new helloOpen the hello folder in VSCode, and open src/main.non. Delete what is in it. You write
everything on this page into that file.
Run a line
Section titled “Run a line”Write this line, put the cursor on it, and press Cmd+Enter:
print("Hello, RESONON!");The first time, the extension starts a resonon server and connects to it. The RESONON item in the
status bar shows the server it is connected to. The text appears in the Output panel: press
Cmd+Shift+U and pick RESONON.
Cmd+Enter runs the lines you select. With nothing selected, it runs the line the cursor is on.
Play a beat
Section titled “Play a beat”Write these lines under the first one, select them, and press Cmd+Enter:
use "std/instruments" { Sampler, Kit };
let drums = AudioTrack("drums");drums.set_instrument(Sampler(Kit("CR-78")));
drums << [bd sd bd sd];
PLAY;You hear a kick and a snare, looping.
usebringsSamplerandKitin from the standard library.AudioTrack("drums")makes a track, like a channel on a mixer. Its sound goes to the master output.Sampler(Kit("CR-78"))is a drum sampler loaded with the CR-78 kit, which comes with resonon..set_instrument()puts it on the track.[bd sd bd sd]is a pattern: bass drum, snare, bass drum, snare.<<sends it to the track. The pattern fills one cycle — one bar — and repeats.PLAY;starts the transport.
Change the beat
Section titled “Change the beat”The server keeps everything you run, so drums is still there. Send it a new pattern:
drums << [bd _ sd _, hh hh hh hh];_ is a rest. The comma plays two patterns at the same time: the kick and snare, and four hi-hats
over them. You did not stop the music and you did not make the track again. This is live coding:
change a line, run it, listen.
STOP;The beat stops, and the play head goes back to the start. Shift+F5 does the same from the keyboard.
Press F5 and the beat plays again from the start.
Next steps
Section titled “Next steps”- Patterns, Tracks & Effects — the next tutorial: more patterns, a second track, and an effect chain
- Sessions & Servers — why the session keeps what you run