moont-web 0.9.2

WebAssembly wrapper for the moont CM-32L synthesizer
Documentation
# moont-web

WebAssembly wrapper for the [moont](https://crates.io/crates/moont) CM-32L
synthesizer. Provides a `CM32LWeb` struct that hooks into the Web Audio API
via `ScriptProcessorNode` for real-time audio output at 32 kHz.


## Usage from JavaScript

Build with `wasm-bindgen --target web`:

    import init, { CM32LWeb } from './moont_web.js';

    await init();
    const synth = new CM32LWeb();  // requires bundle-rom feature

    // Note On: channel 1, note C4, velocity 100.
    synth.play_midi(new Uint8Array([0x90, 60, 100]));

    // Note Off.
    synth.play_midi(new Uint8Array([0x80, 60, 0]));

Without the `bundle-rom` feature, load ROMs dynamically:

    const ctrl = new Uint8Array(await fetch('CM32L_CONTROL.ROM').then(r => r.arrayBuffer()));
    const pcm = new Uint8Array(await fetch('CM32L_PCM.ROM').then(r => r.arrayBuffer()));
    const synth = CM32LWeb.from_rom(ctrl, pcm);


## Features

- **`bundle-rom`** — Bundles the CM-32L ROMs into the WASM binary, enabling
  the `new CM32LWeb()` constructor. Enables `moont/bundle-rom`.


## Building

    cargo build -p moont-web --target wasm32-unknown-unknown --release --features bundle-rom
    wasm-bindgen --target web --out-dir pkg target/wasm32-unknown-unknown/release/moont_web.wasm

A `demo/` directory and `tools/run-web-demo.sh` script are included in the
repository for quick local testing.


## Related Crates

| Crate | Description |
|-------|-------------|
| [moont]https://crates.io/crates/moont | Core CM-32L synthesizer library |
| [moont-render]https://crates.io/crates/moont-render | Render .mid files to .wav |
| [moont-live]https://crates.io/crates/moont-live | Real-time ALSA MIDI sink |


## License

moont-web is distributed under LGPL 2.1+.

> Copyright (C) 2021-2026 Geoff Hill <geoff@geoffhill.org>

This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either [version 2.1 of the License](COPYING.LESSER.txt),
or (at your option) any later version.