wavekat_tts/lib.rs
1//! Unified text-to-speech for voice pipelines.
2//!
3//! Provides a clean abstraction over TTS engines — both local models and
4//! cloud APIs — behind common Rust traits. Same pattern as
5//! [`wavekat-vad`](https://github.com/wavekat/wavekat-vad) and
6//! [`wavekat-turn`](https://github.com/wavekat/wavekat-turn).
7//!
8//! All backends produce [`AudioFrame<'static>`](wavekat_core::AudioFrame)
9//! from `wavekat-core`, keeping audio abstract across the WaveKat ecosystem.
10//!
11//! # Architecture
12//!
13//! ```text
14//! wavekat-vad → "is someone speaking?"
15//! wavekat-turn → "are they done speaking?"
16//! wavekat-tts → "synthesize the response"
17//! │ │ │
18//! └───────────────────┴─────────────────────┘
19//! │
20//! AudioFrame (wavekat-core)
21//! ```
22//!
23//! # Feature flags
24//!
25//! ## Backends
26//!
27//! | Feature | Backend | Multilingual | Requires |
28//! |---------|---------|-------------|----------|
29//! | `qwen3-tts` | Qwen3-TTS (ONNX) | 10 languages | ONNX model download |
30//! | `cosyvoice` | CosyVoice (ONNX) | Yes | ONNX model download |
31//!
32//! ## Execution providers
33//!
34//! Composable with any backend feature. Selects the inference hardware at build time.
35//!
36//! | Feature | Provider | Platform |
37//! |---------|----------|----------|
38//! | `cuda` | NVIDIA CUDA | Linux / Windows |
39//! | `tensorrt` | NVIDIA TensorRT | Linux / Windows |
40//! | `coreml` | Apple CoreML | macOS / iOS |
41//!
42//! # Quick start
43//!
44//! ```toml
45//! [dependencies]
46//! wavekat-tts = { version = "0.0.1", features = ["qwen3-tts"] }
47//! ```
48//!
49//! ```ignore
50//! use wavekat_tts::{TtsBackend, SynthesizeRequest};
51//! use wavekat_tts::backends::qwen3_tts::Qwen3Tts;
52//!
53//! let tts = Qwen3Tts::new("path/to/model.onnx")?;
54//! let request = SynthesizeRequest::new("我觉得这个方案");
55//! let audio = tts.synthesize(&request)?;
56//! // audio: AudioFrame<'static> at 24kHz
57//! ```
58
59mod error;
60mod traits;
61mod types;
62
63pub mod backends;
64
65pub use error::TtsError;
66pub use traits::{StreamingTtsBackend, TtsBackend};
67pub use types::{Gender, SynthesizeRequest, VoiceInfo};
68
69// Re-export AudioFrame so users don't need to depend on wavekat-core directly.
70pub use wavekat_core::AudioFrame;