Skip to main content

Instruments

Define named instruments with INSTRUMENT name: followed by indented properties. Two types: SYNTH (melodic) and DRUM (percussive).

Synth Instrument

INSTRUMENT lead:
TYPE SYNTH
WAVE SAW
ADSR 10 50 200 100
VOLUME 180

Drum Instrument

INSTRUMENT kick:
TYPE DRUM
WAVE SIN
FREQ 60
DECAY 80
VOLUME 255

Properties

PropertyRequiredValuesDescription
TYPEyesSYNTH, DRUMMelodic synth or drum hit
WAVEyesSIN, SAW, SQUARE, TRIANGLE, NOISE, PLUCK, HANDPAN, BELLOscillator waveform
ADSRnoattack decay sustain release (all in ms)Envelope shape (SYNTH only)
VOLUMEno0255 (default: 200)Channel volume
FREQnointeger HzFixed frequency (DRUM only)
DECAYnointeger msDecay time (DRUM only)
CUTOFFno2020000 HzLow-pass filter cutoff frequency
RESONANCEno0255 (default: 0)Filter resonance / Q factor
REVERBno0255 (default: 0) [DECAY ms] [ROOM 0.0–1.0]Reverb wet/dry mix, with optional decay time and room size
DELAYnotime_ms feedback (0–2000, 0–255)Echo delay time and feedback
GLIDEno01000 ms (default: 0)Portamento / pitch slide time
PANno0255 (default: 127)Stereo pan (0=left, 127=center, 255=right)
LFOnorate depth VOLUME|PITCH|CUTOFF|PANLow Frequency Oscillator
VOICESno14 (default: 1)Number of detuned oscillator voices (unison)
DETUNEno0100 cents (default: 0)Detune spread between voices
CHORUSno0255 (default: 0)Chorus effect wet/dry mix
LEGATOnoflag (no value)Consecutive notes overlap instead of cutting previous note. SYNTH only
POLYPHONYno18 (default: 1)Max simultaneous notes per instrument

Waveforms

NameDescription
SINSine wave — pure, clean tone
SAWSawtooth — bright, buzzy, good for bass and lead
SQUARESquare wave — hollow, retro
TRIANGLETriangle — softer than square, mellow
NOISEWhite noise — percussion, hi-hats, snares
PLUCKKarplus-Strong string — guitar, harp, pizzicato
HANDPANStruck metal membrane — additive synthesis (fundamental + octave + octave-fifth + noise transient). SYNTH only. Attack always 1ms, sustain always 0. Default envelope: ADSR 1 600 0 200. Use DECAY to control ring time.
BELLBell — sine with fast-decaying upper harmonics, clean attack transient. SYNTH only. Suggested envelope: ADSR 1 400 0 600.
tip

Start with SIN for clean tones, SAW for bass, and NOISE for percussion. PLUCK gives instant guitar-like sounds without complex ADSR tuning.

ADSR Envelope

ADSR attack_ms decay_ms sustain_ms release_ms
  • Attack — time to rise from silence to peak
  • Decay — time to fall from peak to sustain level
  • Sustain — time held at sustain level
  • Release — time to fade to silence after note ends
PresetADSRCharacter
Fast pluckADSR 2 80 0 60Instant attack, quick decay, no sustain
Slow padADSR 300 100 400 500Gradual swell, long release
General purposeADSR 10 50 200 100Balanced all-rounder

LFO

LFO (Low Frequency Oscillator) adds slow modulation to an instrument parameter. Each instrument can have one LFO per target — up to four simultaneous LFOs (VOLUME + PITCH + CUTOFF + PAN).

INSTRUMENT wobble_bass:
TYPE SYNTH
WAVE SAW
CUTOFF 2000
ADSR 5 40 300 120
VOLUME 200
LFO 4.0 120 VOLUME # 4 Hz tremolo, depth 120
LFO 2.0 30 PITCH # 2 Hz vibrato, depth 30 cents
LFO 1.5 800 CUTOFF # filter sweep ±800 Hz at 1.5 Hz

LFO Syntax

LFO <rate> <depth> <target>
ParameterRangeDescription
rate0.1–20.0 HzOscillation speed (>10 Hz approaches audio range)
depth0–255Modulation intensity
targetVOLUME, PITCH, CUTOFF, or PANWhat the LFO modulates
  • VOLUME LFO — tremolo effect. Depth controls amplitude swing (255 = full 0-to-max)
  • PITCH LFO — vibrato effect. Depth is in cents (100 cents = 1 semitone)
  • CUTOFF LFO — sweeps the low-pass filter ("wah-wah" / acid bass). Depth is in Hz. Instrument must have CUTOFF set
  • PAN LFO — auto-pans across stereo field. Depth is swing range (0–255). Instrument must have PAN set. ESP32 with I2S DAC only — won't compile on AVR
danger

LFO PAN requires ESP32 with I2S DAC. Using it on AVR targets will cause a compilation error, not just a warning.

Unison / Detune / Chorus

Stack multiple detuned copies of an oscillator for a thick, wide sound.

INSTRUMENT supersaw:
TYPE SYNTH
WAVE SAW
VOICES 3
DETUNE 20
CHORUS 80
ADSR 10 50 200 100
VOLUME 180
PropertyRangeDefaultDescription
VOICES1–41Number of oscillator copies
DETUNE0–1000Spread between voices in cents
CHORUS0–2550Short modulated delay for width
  • VOICES > 2 warns about RAM usage on AVR targets
  • DETUNE > 0 requires VOICES > 1 (otherwise error)
  • DETUNE > 50 warns about potentially out-of-tune results
  • VOICES and DETUNE have no effect on DRUM instruments

Extended REVERB Syntax

The REVERB property supports optional DECAY and ROOM parameters:

INSTRUMENT pad:
TYPE SYNTH
WAVE SIN
REVERB 180 DECAY 3000 ROOM 0.7
ADSR 50 100 300 200
VOLUME 180
ParameterRangeDefaultDescription
mix0–2550Reverb wet/dry mix (required)
DECAY100–10000 msReverb tail length
ROOM0.0–1.0Room size (0 = small, 1 = cathedral)

All three apply per-instrument independently. Per-note REVERB:value overrides still control mix only.

LEGATO

Boolean flag — its presence enables legato mode. Consecutive notes overlap rather than cutting the previous note.

INSTRUMENT lead:
TYPE SYNTH
WAVE SAW
LEGATO
ADSR 10 50 200 100
VOLUME 180
  • Only valid on SYNTH instruments — warning if used on DRUM
  • Interacts with POLYPHONY: if both set, POLYPHONY controls max simultaneous voices
tip

Combine LEGATO with GLIDE for smooth, connected melodic lines where notes slide into each other.

POLYPHONY

Controls how many notes from a single instrument can sound at the same time.

INSTRUMENT pad:
TYPE SYNTH
WAVE SAW
POLYPHONY 4
LEGATO
ADSR 50 100 300 200
VOLUME 180
PropertyRangeDefaultDescription
POLYPHONY1–81Max simultaneous notes per instrument
  • Default 1 = monophonic (each new note cuts the previous)
  • Warning if total polyphony across all instruments exceeds 8 (AVR RAM)
danger

High polyphony values consume significant RAM. On AVR targets (Arduino Uno), keep total polyphony across all instruments at 8 or below.