Skip to main content

Crate rust_tts_wrapper

Crate rust_tts_wrapper 

Source
Expand description

§rust-tts-wrapper

Cross-platform TTS (Text-to-Speech) wrapper with a C ABI. Mirrors js-tts-wrapper and SwiftTTSWrapper, supporting 21 engines: system (speech-dispatcher), Sherpa-ONNX (191 local models), and 19 cloud providers.

§Quick start (C)

tts_ctx* ctx = tts_create("system", NULL);
tts_speak(ctx, "Hello world");
tts_destroy(ctx);

Modules§

engine
Core TTS engine trait.
factory
Engine factory: create engines by ID and list all registered engines.
types
Shared types used across the crate.

Structs§

tts_ctx

Functions§

tts_create
Create a new TTS engine instance.
tts_destroy
Destroy a TTS context and free all associated resources.
tts_free_bytes
Free a byte buffer returned by tts_synth_to_bytes.
tts_free_engine_info
Free an engine info array previously returned by tts_get_engines.
tts_free_voices
Free a voice array previously returned by tts_get_voices.
tts_get_engine_count
Return the number of registered engines.
tts_get_engines
Write engine descriptors into a caller-allocated array.
tts_get_last_error
Return the last error message as a C string, or null if none.
tts_get_voices
Retrieve the list of available voices for the engine.
tts_pause
Pause in-progress speech.
tts_resume
Resume paused speech.
tts_set_on_audio
Set the callback for streaming audio chunks.
tts_set_on_boundary
Set the callback for word boundary events.
tts_set_pitch
Set the speech pitch (1.0 = normal).
tts_set_rate
Set the speech rate (1.0 = normal).
tts_set_voice
Set the voice for subsequent speak calls.
tts_set_volume
Set the speech volume (1.0 = normal).
tts_speak
Speak text asynchronously using the engine in ctx.
tts_speak_sync
Speak text synchronously (blocks until complete).
tts_stop
Stop any in-progress speech.
tts_synth_to_bytes
Synthesize text to audio bytes without playback. Writes a heap-allocated buffer to *out_bytes and its length to *out_len. Caller must free with tts_free_bytes. Returns 0 on success, -1 on failure.

Type Aliases§

CAudioCb
Opaque context holding an engine instance and its per-instance settings.
CBoundaryCb