The JavaScript / WebAssembly (@csound/browser) implementation allows Csound 7.0.0 to run directly in a web browser via WebAudio and AudioWorklet, with zero native installation required. Both the Csound Web IDE and the Csound FLOSS Manual use @csound/browser to synthesize audio in real time.
Quick Start (@csound/browser@7.0.0)
You can import @csound/browser directly as an ES module from jsDelivr or npm:
const csoundUrl = "https://cdn.jsdelivr.net/npm/@csound/browser@7.0.0/dist/csound.js";
async function playCsound() {
const { Csound } = await import(csoundUrl);
const csound = await Csound();
await csound.setOption("-odac");
await csound.compileOrc(`
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
instr 1
aSig = poscil(0.2, 440)
outall(aSig)
endin
schedule(1, 0, 2)
`);
await csound.start();
}
Tutorials & Documentation
- Live Browser Examples on csound.com — Inspect and run Pling, Waveguide, Vibes, and Vocoder with
@csound/browser@7.0.0. - Steven Yi and Hlöðver Sigurðsson — Csound on the Web (ICSC 2022)
- Victor Lazzarini’s Vanilla Guide to WebAudio Csound