pub mod audio;
pub mod config;
pub mod device;
pub mod error;
pub mod layers;
pub mod mel;
pub mod models;
pub mod tensor_utils;
pub mod tokenizer;
pub mod traits;
#[cfg(feature = "download")]
pub mod download;
pub use audio::{AudioSamples, DenoiseOptions};
pub use config::{
preferred_runtime_choice, preferred_runtime_choices, DType, ModelAsset, ModelAssetBundle,
ModelAssetDir, ModelFiles, RuntimeChoice, TtsConfig,
};
pub use device::DeviceSelection;
pub use error::TtsError;
pub use mel::{MelConfig, MelSpectrogram};
pub use models::{ModelAssetRequirement, ModelType};
pub use traits::{
ModelInfo, ReferenceAudio, SynthesisRequest, TtsModel, VoiceCloning, VoiceEmbedding,
};
pub fn load_model(config: TtsConfig) -> Result<Box<dyn TtsModel>, TtsError> {
match config.model_type {
#[cfg(feature = "kokoro")]
ModelType::Kokoro => {
let model = models::kokoro::KokoroModel::load(config)?;
Ok(Box::new(model))
}
#[cfg(feature = "omnivoice")]
ModelType::OmniVoice => {
let model = models::omnivoice::OmniVoiceModel::load(config)?;
Ok(Box::new(model))
}
#[cfg(feature = "qwen3-tts")]
ModelType::Qwen3Tts => {
let model = models::qwen3_tts::Qwen3TtsModel::load(config)?;
Ok(Box::new(model))
}
#[cfg(feature = "vibevoice")]
ModelType::VibeVoice => {
let model = models::vibevoice::VibeVoiceModel::load(config)?;
Ok(Box::new(model))
}
#[cfg(feature = "vibevoice")]
ModelType::VibeVoiceRealtime => {
let model = models::vibevoice_realtime::VibeVoiceRealtimeModel::load(config)?;
Ok(Box::new(model))
}
#[cfg(feature = "voxtral")]
ModelType::Voxtral => {
let model = models::voxtral::VoxtralModel::load(config)?;
Ok(Box::new(model))
}
#[allow(unreachable_patterns)]
_ => Err(TtsError::UnsupportedModel(format!(
"Model type {:?} is not enabled. Enable the corresponding feature flag.",
config.model_type
))),
}
}