Skip to main content

kokoroxide/
lib.rs

1//! # kokoroxide
2//!
3//! A high-performance Rust implementation of Kokoro TTS (Text-to-Speech) synthesis,
4//! leveraging ONNX Runtime for efficient neural speech generation.
5//!
6//! ## Example
7//!
8//! ```no_run
9//! use kokoroxide::{KokoroTTS, TTSConfig, load_voice_style};
10//!
11//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
12//! // Configure and initialize Kokoro TTS
13//! let config = TTSConfig::new("path/to/model.onnx", "path/to/tokenizer.json");
14//! let tts = KokoroTTS::with_config(config)?;
15//!
16//! // Load a voice style
17//! let voice = load_voice_style("path/to/voice.bin")?;
18//!
19//! // Generate speech
20//! let audio = tts.speak("Hello, world!", &voice)?;
21//!
22//! // Save to file
23//! audio.save_to_wav("output.wav")?;
24//! # Ok(())
25//! # }
26//! ```
27
28// Internal modules - not exposed to library users
29mod espeak;
30#[allow(dead_code)]
31mod interactive;
32#[allow(dead_code)]
33mod playback;
34#[allow(dead_code)]
35mod test;
36
37// Public API modules
38/// Kokoro TTS synthesis engine and related types
39pub mod kokoro;
40
41// Re-export main types for convenience
42pub use kokoro::{load_voice_style, GeneratedAudio, KokoroTTS, TTSConfig, VoiceStyle};
43
44// Re-export ONNX GraphOptimizationLevel for configuration
45pub use ort::GraphOptimizationLevel;