Skip to main content

Module wasm

Module wasm 

Source
Expand description

WASM-compatible synthesis API

Provides an API that works without filesystem access, suitable for WebAssembly (wasm32) targets. Model and config data are passed as byte slices instead of file paths.

This module is available on all platforms but is designed primarily for WASM. On native platforms, prefer PiperVoice::load() for convenience.

Structs§

WasmModelCapabilities
Model capabilities detected from ONNX input/output node names.
WasmSynthesisResult
WASM-friendly synthesis result (no file I/O)
WasmVoice
WASM-compatible voice synthesizer. Loads model from bytes rather than file paths.

Functions§

parse_config
Parse config JSON string into VoiceConfig
samples_i16_to_f32
Convert i16 PCM samples to f32 normalized audio (-1.0 to 1.0)
samples_to_wav_bytes
Convert f32 audio to WAV bytes (in-memory, no filesystem)