moont-web 1.0.0

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 `Cm32lSynth` 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`:

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

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

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

// Note Off: MIDI channel 2.
synth.play_midi(new Uint8Array([0x81, 60, 0]));
```

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

```js
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 = Cm32lSynth.from_rom(ctrl, pcm);
```


## Features

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


## Building

```sh
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.