Quick Reference
This content is for v0.7. Switch to the latest version for up-to-date documentation.
Pattern Syntax
Section titled “Pattern Syntax”| Syntax | Name | Description |
|---|---|---|
[a b c] | Sequential | Elements play one after another |
[[a b] c] | Nested | Inner group subdivides time slot |
[a, b] | Parallel | Elements play simultaneously (chord) |
<a b c> | Alternating | One element per cycle, rotating |
[C4 D4 E4] // C4 then D4 then E4[[C4 D4] E4] // C4-D4 in first half, E4 in second[C4, E4, G4] // C major chord<C4 D4 E4> // Cycle 1: C4, Cycle 2: D4, Cycle 3: E4Compact Notation
Section titled “Compact Notation”| Modifier | Name | Description |
|---|---|---|
*n | Fast | Repeat n times within slot |
@n | Weight | Extend duration to n slots |
!n | Replicate | Create n separate slots |
(k,n) | Euclidean | k hits distributed over n steps |
(k,n,r) | Euclidean rotated | Rotated by r steps |
[bd*4] // Four kicks in one slot (16ths)[C4@2 D4] // C4 gets 2/3 time, D4 gets 1/3[C4!4] // Equivalent to [C4 C4 C4 C4][bd(3,8)] // 3 kicks spread over 8 steps[sd(5,8,2)] // 5 snares over 8 steps, rotated by 2Pattern Methods
Section titled “Pattern Methods”| Method | Description |
|---|---|
.length() | Number of elements |
.reverse() | Reverse order |
.rotate(n) | Shift left (positive) or right (negative) |
.transpose(n) | Pitch shift by n semitones |
.concat(pat) | Append another pattern |
.fast(n) | Speed up by factor n |
.slow(n) | Slow down by factor n |
.stack(pat) | Layer with another pattern |
.degrade(p) | Randomly drop notes (0.0-1.0) |
.nudge(offsets) | Per-step timing offsets |
.swing(amount) | Swing timing feel |
.humanize(amount) | Deterministic timing variation |
[C4 D4 E4].reverse() // [E4 D4 C4][C4 D4 E4].transpose(12) // Up one octave[C4 D4].concat([E4 F4]) // [C4 D4 E4 F4]Commands
Section titled “Commands”| Command | Description |
|---|---|
PLAY | Start or resume playback |
PAUSE | Pause playback (resume with PLAY) |
STOP | Full stop (resets position, mutes audio) |
RECORD | Start playback and record on armed tracks |
SEEK expr | Jump to a cycle position |
PRINT expr | Print value with newline |
PUT expr | Print value without newline |
let x = value | Declare variable |
x = value | Reassign variable |
Tracks
Section titled “Tracks”// MIDI track (channel 1-16, optional velocity 0-127)let track = MidiTrack(1);let track = MidiTrack(10, 100); // Channel 10, velocity 100
// Audio track with samplerlet drums = AudioTrack("drums");drums.load_instrument(Sampler(Kit("cr78")));
// Retrieve loaded instrument for parameter tweakinglet kit = drums.get_instrument();
// Send pattern to tracktrack << [C4 D4 E4];drums << [bd sd bd sd];Routing
Section titled “Routing”| Method / Operator | Description |
|---|---|
<< | Send pattern to track |
>> | Route audio between tracks |
.send_to(dest, amount) | Additive send (dry stays at 1.0) |
.xsend_to(dest, amount) | Crossfade send (dry = 1.0 - amount) |
.send(amount) | Create Send value for >> chains |
.send_level(dest) | Send param ref for automation |
.reset_routing() | Clear routes, restore default master route |
.routing() | Print track routing info |
routing() | Print full routing graph |
drums >> master;drums.send_to(reverb_bus, 0.3);drums >> reverb_bus.send(0.3) >> master;Effects
Section titled “Effects”Effect constructors are part of the prelude and available globally — no import needed.
| Constructor | Description |
|---|---|
Delay(time, feedback) | Delay (0.25s, 0.5) |
Lowpass(cutoff, resonance) | Low-pass filter |
Highpass(cutoff, resonance) | High-pass filter |
Bandpass(cutoff, resonance) | Band-pass filter |
Notch(cutoff, resonance) | Band-reject filter |
Allpass(cutoff, resonance) | Phase-shift filter |
Peak(cutoff, resonance) | Bell/EQ filter |
Reverb(room, damp, width, mix) | Freeverb reverb |
PlateReverb(size, damp, diff, pre, mix) | Dattorro plate reverb |
Overdrive(drive, tone) | Tube-style soft clipping |
Distortion(drive, tone) | Transistor-style hard clipping |
drums.load_effect(Delay(0.25, 0.7));drums.load_effect(Lowpass(800));Effect Management
Section titled “Effect Management”| Method | Description |
|---|---|
.load_effect(fx) | Add effect to track chain |
.load_effects(#[...]) | Add multiple effects |
.effects() | List loaded effects |
.swap_effects(i, j) | Swap effect order |
.remove_effect(i) | Remove and return effect |
.clear_effects() | Remove all effects |
drums.load_effect(Reverb(0.5, 0.3));drums.load_effects(#[Lowpass(800), Delay(0.25, 0.5)]);drums.swap_effects(0, 1);CR-78 Kit Samples
Section titled “CR-78 Kit Samples”| Short | Sample | Short | Sample |
|---|---|---|---|
bd | Bass drum | cb | Cowbell |
sd | Snare | ma | Maracas |
hh | Hi-hat | tb | Tambourine |
cy | Cymbal | gu | Guiro |
cp | Clap | hb | High bongo |
rs | Rimshot | lb | Low bongo |
me | Metal beat | lc | Low conga |
cl | Clave |
Sample Methods
Section titled “Sample Methods”Velocity:
| Method | Velocity | Description |
|---|---|---|
.vel(v) | Custom | Set velocity (0 to infinity) |
.ghost() | 0.3 | Ghost note (quiet) |
.soft() | 0.5 | Soft hit |
.accent() | 1.0 | Accented hit |
.loud() | 1.2 | Loud hit |
Transformations:
| Method | Description |
|---|---|
.slice(start, end) | Play portion of sample (0-1 range) |
.reverse() | Play sample backwards |
.pitch(semitones) | Pitch shift sample |
.pan(position) | Stereo position (-1.0 to 1.0) |
drums << [bd.loud sd.soft];drums << [bd.pan(-1) sd.pan(1)];drums << [bd.pitch(12) sd.reverse()];Notes use scientific pitch notation: C4 is middle C.
- Range:
C-1toG9 - Sharps:
C#4,D#4,F#4, etc. - Flats:
Db4,Eb4,Bb4, etc. - Rest:
_(underscore)
Control Flow
Section titled “Control Flow”if condition { }if condition { } else { }
loop { break; }do 5 { }for x in Array(1, 2, 3) { }for i in range(5) { }Functions
Section titled “Functions”fn name(param1, param2) { return value;}
// Anonymous functionlet double = fn(x) { return x * 2; };
// Higher-orderarr.map(fn(x) { return x * 2; });arr.filter(fn(x) { return x > 0; });arr.reduce(fn(acc, x) { return acc + x; }, 0);Dictionaries
Section titled “Dictionaries”let d = #{"key": value, 200: "OK"};d["key"] // Accessd.get("key") // Access (NUL if missing)d.set("new", val) // Mutated.keys() // Array of keysd.merge(other) // New merged dictmatch value { 1 => "one", n if n > 10 => "big", _ => "other",}Streams & Script Patterns
Section titled “Streams & Script Patterns”stream(initial, fn(prev, cycle) { ... })markov(states, transitions, initial)
class MyPattern { fn new() { ... } fn query(cycle) { ... } // Script pattern}Iterators
Section titled “Iterators”Lazy (return iterator):
| Method | Description |
|---|---|
.take(n) | First n elements |
.skip(n) | Skip first n elements |
.step_by(n) | Every nth element |
.enumerate() | Yield [index, value] pairs |
.zip(iter) | Pair elements from two iterators |
.chain(iter) | Concatenate two iterators |
Eager (consume iterator):
| Method | Description |
|---|---|
.next() | Next element or NUL |
.collect() | Gather into array |
.find(fn) | First match or NUL |
.any(fn) | True if any match |
.all(fn) | True if all match |
let nums = Array(1, 2, 3, 4, 5);nums.iter().skip(1).take(3).collect(); // [2, 3, 4]nums.iter().any(fn(x) { return x > 4; }); // trueRandomness
Section titled “Randomness”rand(seed) // Deterministic [0, 1)choose(seed, array) // Deterministic pickchoose_weighted(seed, arr, weights) // Weighted pickrand_true() // Non-seekablechoose_true(array) // Non-seekableMusic Theory
Section titled “Music Theory”Scale("major") // Built-in scale valueScale(#[0, 2, 4, 5, 7, 9, 11]) // Custom scale from semitoness.mode(2) // Rotate to nth modes.intervals() // Interval arrays.contains(7) // Check interval membershipscale(C4, "major") // Array of scale notesscale(C4, my_scale) // Also accepts Scale valuesscale_degree(C4, "major", 5) // G4Key(C4, "major") // Key from stringKey(C4, Scale("major")) // Key from Scale valuechord(C4, "min7") // Array of chord noteschord(C4, "major", 1) // First inversioninterval(C4, "P5") // G4Signals
Section titled “Signals”| Constructor | Range | Description |
|---|---|---|
Sine(n) / Sine2(n) | 0-1 / -1 to 1 | Sine wave |
Saw(n) / Saw2(n) | 0-1 / -1 to 1 | Sawtooth wave |
Tri(n) / Tri2(n) | 0-1 / -1 to 1 | Triangle wave |
Square(n) / Square2(n) | 0-1 / -1 to 1 | Square wave |
Rand(n) | 0-1 | Random noise |
Perlin(n) | 0-1 | Smooth Perlin noise |
All accept: no arg (1 cycle/cycle), number (N cycles/cycle), or hz(n) (absolute frequency).
| Method | Description |
|---|---|
.range(min, max) | Linear mapping to [min, max] |
.range_exp(min, max) | Exponential mapping (for frequencies) |
.retrigger(mode) | Phase reset: "cycle", "beat", "free" |
.smooth(time_ms) | One-pole lowpass smoothing |
Signal Algebra
Section titled “Signal Algebra”| Operator | Example | Description |
|---|---|---|
+ | Sine(1) + Saw(3) | Sum signals |
- | Sine(1) - Tri(2) | Subtract signals |
* | Sine(1) * 0.5 | Scale / ring mod |
/ | Sine(1) / Saw(2) | Divide signals |
- (unary) | -Sine(1) | Negate |
Sine(4).range(0.2, 0.8) // LFO with rangeSine(1).range_exp(20, 20000) // Exponential for freq(Sine(1) + Saw(3)) * 0.5 // Mix two LFOsSine(2) * 0.3 + 0.5 // Scale + offsetCc(74).smooth(50) // MIDI CC signalAutomation Curves
Section titled “Automation Curves”| Curve | Description |
|---|---|
"linear" | Straight line (default) |
"step" | Instant jump |
"exp" | Exponential curve |
"smooth" | Smooth interpolation |
"ease-in" | Slow start, fast end |
"ease-out" | Fast start, slow end |
"ease-in-out" | Slow start and end |
"ease" | CSS-style ease |
"bezier(x1,y1,x2,y2)" | Custom cubic bezier |
automation(#[0, 0], #[2, 1.0, "exp"], #[4, 0])d.Feedback.modulate(#[0, 0.3], #[4, 0.9]);Microtiming
Section titled “Microtiming”pattern.nudge([0, 0.25, 0, -0.1]) // Per-step offsets (step-relative)pattern.swing(0.25) // Swing feelpattern.humanize(0.1) // Human touchArrangements
Section titled “Arrangements”| Call | Description |
|---|---|
timeline(length) | Create a fixed-length timeline |
.at(start, duration) | Create a slot at cycle offset |
.length() | Get timeline length in cycles |
.entries() | Get number of entries |
let t = timeline(16);t.at(0, 8) << [bd _ sd _]; // Verset.at(8, 8) << [bd*4]; // Chorusdrums << t; // Assign to trackRendering
Section titled “Rendering”| Call | Output |
|---|---|
render(cycles) | Master mix |
render(track, cycles) | Single track |
render(#[tracks], cycles) | Multiple tracks |
render(#[drums, bass, master], 4);Audio Input
Section titled “Audio Input”| Method / Command | Description |
|---|---|
.input(device) | Route audio input device to track |
.arm() / .disarm() | Arm/disarm track for recording |
.monitor("in"/"off") | Enable/disable input monitoring |
RECORD | Start playback and record armed tracks |
.take() | Retrieve last recording |
.duration() / .samples() | Recording info |
.save("path") | Save recording to WAV |
let mic = AudioTrack("mic");mic = mic.input("MacBook Pro Microphone");mic = mic.arm().monitor("in");RECORD;// ... perform ...PAUSE;mic.take().save("recording.wav");Project & Tempo
Section titled “Project & Tempo”| Function | Description |
|---|---|
setbpm(bpm) | Set tempo (4 beats per cycle) |
setbpm(bpm, beats) | Set tempo with custom beats per cycle |
project_title(title) | Set project title |
project_artist(artist) | Set artist name |
project_bpm(bpm) | Set project BPM |
MIDI Input/Export
Section titled “MIDI Input/Export”midi_input_connect("port", "alias")track.input("alias").monitor("in")midi_export(pattern, 4) // Export to MIDI fileMIDI Clock
Section titled “MIDI Clock”| Function | Description |
|---|---|
midi_clock_send(bool) | Enable/disable master clock output (24 PPQ) |
midi_clock_follow(alias) | Sync to external clock on input port |
midi_clock_offset(ms) | Clock-only timing offset |
midi_delay(ms) | Global MIDI output delay |
midi_clock_send(true);midi_delay(15);Plugins
Section titled “Plugins”plugin_scan()plugin_list()let fx = Effect("name")fx.params() // prints parameter tablefx.set_param("Cutoff", 2000) // set by actual valuefx.set_param_norm("Cutoff", 0.5) // set by normalized 0-1 valuefx.save_state("preset.preset")CLI Reference
Section titled “CLI Reference”| Subcommand | Description |
|---|---|
| (none) | Start REPL or run a .non file |
server | Start WebSocket server for remote execution |
view <name> | Launch TUI view (console, mixer, routing, midi_monitor) |
version | List, show, or switch installed versions |
plugin | Scan or list CLAP plugins |
pkg | Install, list, or inspect packages |
resonon server --server-port 6000resonon view mixerresonon plugin scanConfiguration
Section titled “Configuration”Config file: ~/.config/resonon/config.toml
| Section | Key options |
|---|---|
| Top-level | lib_paths, kit_paths, cycle_time, viz_resolution |
[audio] | output_device, input_device, sample_rate, master_channels |
[midi] | output_port, input_port |
[[midi.outputs]] | alias, port (named output ports) |
[[midi.inputs]] | alias, port (named input ports) |
See Configuration Reference for full details.
Package Management
Section titled “Package Management”resonon pkg install gh:user/reporesonon pkg listresonon pkg inspect nameVSCode Shortcuts
Section titled “VSCode Shortcuts”| Shortcut | Action |
|---|---|
Cmd+Enter | Execute selection or line |
Cmd+Shift+Enter | Execute entire file |
See Also
Section titled “See Also”- Examples - Copy-paste ready code
- Functions Reference - Built-in functions
- Pattern Methods - Method details
- Effects Reference - Effects, routing, and modulation
- Signal Methods - Signals and automation
- Arrangements - Timelines and song structure
- Rendering - WAV export
- Audio Input - Live recording
- Configuration - Config file and CLI
- Iterators - Iterator method reference