Skip to main content

Crate moont_web

Crate moont_web 

Source
Expand description

WebAssembly wrapper for the 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

With the bundle-rom feature (ROMs embedded in the WASM binary):

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

await init();
const synth = new CM32LWeb();

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

Without bundle-rom, 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

FeatureDescription
bundle-romEmbed pre-parsed ROMs in the WASM binary (enables the new() constructor)
CrateDescription
moontCore CM-32L synthesizer library
moont-renderRender .mid files to .wav
moont-liveReal-time ALSA MIDI sink

Structs§

CM32LWeb
CM-32L synthesizer with Web Audio output.