MoonBit DSP audio engine
Dependencies
NEW_MOON_MOD=0 moon check && NEW_MOON_MOD=0 moon test # type-check + run tests
NEW_MOON_MOD=0 moon build --target wasm-gc # build for browser
NEW_MOON_MOD=0 moon run cmd/main # run CLI entry point
scripts/build-clap-prototype.sh # build Linux CLAP prototype shared object
scripts/smoke-clap-prototype.sh # dlopen/process smoke test for the prototype
scripts/validate-clap-prototype.sh # build + run clap-validator for the prototype///|
fn[T : FilterSym] exit_deliverable() -> T {
let lfo = DspSym::oscillator(ArithSym::constant(2.0), Waveform::Sine)
let freq = range(lfo, 200.0, 400.0)
let carrier = DspSym::oscillator(freq, Waveform::Sine)
let filtered = T::biquad(carrier, BiquadMode::LowPass, 800.0, 1.0)
DspSym::output(DspSym::gain(filtered, 0.3))
}// C major triad played twice per cycle
sequence([note_name("c3"), note_name("e3"), note_name("g3")]).fast(Rational::from_int(2))Pattern Engine DSP Engine
Pat.query(arc) CompiledDsp.process(ctx, buf)
| |
v v
Array[Event[ControlMap]] BoundVoicePool.process(ctx, L, R)
| ^
+-- { note: 60, cutoff: 800 } -----+
PatternScheduler.process_block./ Library public API facade (`moondsp.mbt` re-exports from dsp/, graph/, voice/, identity/)
dsp/ DSP primitives, tagless algebra, pan math
graph/ Compiled graph runtime, topology editing, hot-swap, control binding
voice/ Polyphonic voice pool with priority stealing
identity/ Stable ID wrappers and revision tokens for incremental editing
pattern/ Pattern engine: rational time, combinators, control maps, authoring docs
mini/ Mini-notation parser: text → Pat[ControlMap]
song/ Long-form section scaffold with identity TimeScope
scheduler/ Pattern scheduler: bridges pattern events to voice pool
browser/ AudioWorklet integration (wasm-gc/js exports)
browser_test/ Browser-integration test wrapper
clap_engine/ Native CLAP synth engine core (MoonBit host-facing wrapper)
clap_host/ Primitive handle bridge for the C CLAP shim
clap_plugin/ CLAP prototype payload package and C ABI shim
web/ Browser demo UI (HTML + AudioWorklet processor)
cmd/main/ CLI entry point
docs/ Architecture blueprint, technical reference, performance snapshotsNEW_MOON_MOD=0 moon check --target all --deny-warn # type-check all targets, fail on warnings
NEW_MOON_MOD=0 moon test --target all --deny-warn # run all tests on all targets
NEW_MOON_MOD=0 moon test -p dowdiness/moondsp # root facade integration tests
NEW_MOON_MOD=0 moon test -p pattern # pattern-engine tests
NEW_MOON_MOD=0 moon info && NEW_MOON_MOD=0 moon fmt # regenerate interfaces + format
NEW_MOON_MOD=0 moon bench --release -p dowdiness/moondsp/graph -f graph_benchmark.mbt
npm run test:browser # Playwright browser-integration tests (builds wasm-gc first)| Phase | Status | Summary |
|---|---|---|
| 0 — Platform proof | Complete | MoonBit wasm-gc runs in browser AudioWorklet |
| 1 — DSP primitives | Complete | Oscillators, filters, envelopes, delay, gain, mix, clip, pan |
| 2 — Graph compiler | Complete | Compiled graphs, hot-swap, topology editing, stereo |
| 3 — Voice management | Complete | 32+ voice pool with priority stealing and stereo mixdown |
| 4 — Pattern engine | Complete | Rational time, 8 combinators, ControlMap output |
| 5 — Pattern × DSP | Complete | scheduler/ + mini/ wire pattern events to voice allocation |
| 6 — incr integration | In progress | Stable identity plus initial pattern/song authoring groundwork |
| 7+ — UI, native, collab | Prototype | Browser live UI and CLAP prototype available; collaboration planned |
fn is_finite(value : Double) -> Boolfn is_finite_positive(value : Double) -> Boolfn[T : ArithSym] lin_map(input : T, in_lo : Double, in_hi : Double, out_lo : Double, out_hi : Double) -> Tfn pan_left_gain(position : Double) -> Doublefn pan_right_gain(position : Double) -> Doublefn[T : ArithSym + DspSym + FilterSym + DelaySym + StereoSym + StereoFilterSym + StereoDelaySym] replay(nodes : Array[DspNode]) -> T?fn stereo_shape() -> IntInstall
Download zipMoonBit DSP audio engine
Dependencies