Example cookbook

The examples are a collection of patches that showcase different ways of implementing audio algorithms and DSP code in Onda. The language guide and standard-library reference cover isolated syntax and APIs.

Examples with built-in sequencing expose an auto_play switch. It defaults to 1; set it to 0 to stop scheduling new notes while existing voices and effect tails decay naturally. Each also exposes a no-argument bang() event that immediately triggers and advances the next sequencer state. Live-input processing and any additional instrument events remain available.

Instruments

Example Description
Additive synth Eight sine partials with independent level, ratio, detune, pan, and mute controls
Acid bassline A resonant 16-step bass line with accents and slides
Drum machine Synthesized kick, snare, and metallic hats
FM bells A spacious polyphonic struck-metal pattern
Formant percussion Vowel-like resonant percussion
Karplus–Strong Warm plucked strings from short delay lines

The polyphonic instruments self-play and also keep their host-facing strike/pluck events where that interaction is part of the instrument.

MIDI and plug-in host surfaces

These patches are shared with onda-plugin. The instruments use the exact canonical MIDI events, so opening either patch with onda run reveals the bottom piano and MIDI Input selector. The computer keyboard is active by default; in the browser, choose Connect MIDI device… for hardware MIDI or play the on-screen keys.

Example Description
MIDI poly saw Eight-voice note on/off and per-channel pitch bend
MIDI FM bells Velocity-sensitive note on/off allocation
Tempo ping-pong DAW tempo in a plug-in; 120 BPM fallback elsewhere
Reactive wavefolder Stereo live input with envelope-driven folding
Transient sculptor Stereo live input with fast/slow envelope separation
Orbit flanger Stereo live input with quadrature modulation

The four effects require a selected audio input or browser microphone. Canonical plugin_host events are hidden but inactive in standalone hosts; a DAW supplies them through the plug-in.

Effects

Example Description
Stereo chorus Fractional-delay ensemble motion
Tape echo Dark saturated repeats with wow and flutter
Live tape looper Capture, varispeed, reverse, and overdub on a virtual tape
Shimmer echo Cross-fed echoes with octave-shifted regeneration
Wavefolder Animated folded harmonics
Compressor Stereo-linked soft-knee compression
Schroeder reverb A bright classic comb-and-allpass room
FDN reverb A dense eight-line matrix tail

Effects audition themselves by default. Set live_input to 1 to process in1 and in2. The Schroeder and FDN wrappers are also compact, musical graph-syntax examples: their graph blocks route the audition/live source, parameters, and stereo outputs declaratively.

Soundscapes and experimental systems

Example Description
Benjolin A Hordijk-inspired eight-bit rungler instrument
Granular cloud A live tape resampled as a stereo grain cloud
Wind chimes Irregular modal chimes over filtered air
Deep-space drone A slowly changing low-frequency chord
Aurora Pad A minor chord spread across a gently detuned stereo field and a slowly opening filter
Orbital FM An evolving phase-modulation drone with detuned carriers, sub-octave body, and orbiting shimmer
Polyphonic saw An eight-voice randomized saw cascade
Neural synth A recurrent nonlinear digital ecosystem
Resonant delay matrix Four nonlinear cross-coupled delays
Diffuse delay matrix A soft, slowly evolving resonant cloud
Chaotic delay matrix Burst-driven unstable resonances

Advanced DSP and graph syntax

Example Description
Spectral delay A 1024-point streaming FFT, per-bin delay frames, spectral feedback, and stereo IFFT resynthesis
Spectral freeze Phase-coherent spectral capture, smear, transpose, and overlap-add resynthesis
PaulStretch A host-bound recording with normalized scrubbing, stretched through an event/delegate chain carrying structured time, magnitude, and complex-spectrum frames
Cybernetic feedback graph Cross-coupled graph cycles made causal with >>[1] delayed edges
Dual FM oscillator, 8× A compact musical use of local oversampling and feedback phase modulation

Self-contained projects

Use .ondaproject when data is part of a patch’s identity:

Project Description
Wavetable Garden Four inline wavetables and a local oscillator module
Score-driven Resonator Typed note, timing, velocity, and pan buffers
Embedded Room A file-backed stereo impulse.wav cooperatively transformed into zero-latency convolution kernels, with an explicit FFT size and a configurable loading duration (0.5 seconds by default)

These links open the repository because the hosted ?example= catalog contains source workspaces, not .ondaproject manifests and their buffer assets. To open a showcase in the browser playground, download or clone the repository, ZIP the complete project contents, and select the ZIP with Open project. The browser picker does not accept a bare .ondaproject: selecting only the manifest would not give the page access to its referenced code/ and assets/ files.

For example:

cd examples/projects/embedded_room
zip -r embedded-room.zip embedded-room.ondaproject code assets

The native CLI and run hosts have filesystem access and can open the manifest directly:

onda run examples/projects/embedded_room/embedded-room.ondaproject

See Onda projects for the manifest format.

Host integration