pub struct WasmVoice { /* private fields */ }Expand description
WASM-compatible voice synthesizer. Loads model from bytes rather than file paths.
Implementations§
Source§impl WasmVoice
impl WasmVoice
Sourcepub fn load_from_bytes(
model_bytes: &[u8],
config_json: &str,
) -> Result<Self, PiperError>
pub fn load_from_bytes( model_bytes: &[u8], config_json: &str, ) -> Result<Self, PiperError>
Load from in-memory model and config data.
§Arguments
model_bytes- ONNX model file contentsconfig_json- config.json file contents as string
Sourcepub fn synthesize_ids(
&mut self,
phoneme_ids: &[i64],
speaker_id: Option<i64>,
language_id: Option<i64>,
noise_scale: f32,
length_scale: f32,
noise_w: f32,
) -> Result<WasmSynthesisResult, PiperError>
pub fn synthesize_ids( &mut self, phoneme_ids: &[i64], speaker_id: Option<i64>, language_id: Option<i64>, noise_scale: f32, length_scale: f32, noise_w: f32, ) -> Result<WasmSynthesisResult, PiperError>
Synthesize from pre-computed phoneme IDs (no G2P needed). This is the primary API for WASM since G2P may not be available.
Sourcepub fn config(&self) -> &VoiceConfig
pub fn config(&self) -> &VoiceConfig
Get the loaded config
Sourcepub fn has_speaker_id(&self) -> bool
pub fn has_speaker_id(&self) -> bool
Whether the model accepts a speaker ID input
Sourcepub fn has_language_id(&self) -> bool
pub fn has_language_id(&self) -> bool
Whether the model accepts a language ID input
Sourcepub fn has_prosody(&self) -> bool
pub fn has_prosody(&self) -> bool
Whether the model accepts prosody features input
Sourcepub fn capabilities(&self) -> &WasmModelCapabilities
pub fn capabilities(&self) -> &WasmModelCapabilities
Get model capabilities
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WasmVoice
impl !RefUnwindSafe for WasmVoice
impl Send for WasmVoice
impl Sync for WasmVoice
impl Unpin for WasmVoice
impl UnsafeUnpin for WasmVoice
impl !UnwindSafe for WasmVoice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more