Koda
Koda is the language a patch is written in; the same text runs on desktop, in a plugin, in the browser and on the headless node.
Koda describes a patch as chips and the wires between them, plus the code inside a chip when you want to write your own. You can write a whole patch in it, or never see it and work in the graph.
One text compiles for each place it runs: machine code on desktop, WebAssembly in the browser, and a bytecode interpreter where generating machine code is not allowed. We chose one language over a separate format per target so that a patch you share is the patch that plays.
audio output
A patch plays through your sound card on desktop, through the host inside a VST3 plugin, and through ALSA on the headless node.
Audio output is where a patch leaves the app. On desktop it opens your system audio device. Inside a DAW, the plugin hands its buffer to the host instead, so the host owns the clock.
A device can be held exclusively, and a patch can be given a range of its channels. Both are saved with the setup, so the next launch opens the same outputs.
web audio library
Put a Koda patch inside your own web page: the library runs it in the tab, and your page's own controls play it.
The web audio library is the engine without the app: a WebAssembly bundle with a TypeScript API. Your page hands it a patch, then sets its parameters and reads its meters and scopes from your own buttons, sliders and canvases. The sound is computed in the tab from an AudioWorklet, not streamed from a server.
For React pages there are bindings: a provider component, plus hooks for the engine and for each parameter, so a patch's controls are ordinary JSX. The demo on the front page is built this way: plain HTML sliders driving a Koda patch.
- Precompiled
- Zero-latency standard library, already native before you opened the app.
- JIT
- Native speed, millisecond compiles, hot reload on save.
- WASM
- Near-native in the browser. Same engine, no install.
- Bytecode VM
- The fallback for iOS and anywhere a JIT is not allowed.
metro; `metro bpm; 120.0 // voice chain: k=8 (512 samples) — engine handles it plaits; `plaits_voice frequency; hz engine; 'modal // vocal chain: k=1 (64 samples) — stays fast mic @in; `hardware_source channels; 1 output @out; `mix ; 0.6, plaits ; 1.0, mic