Files
siprouter/rust/vendor/kokoro-tts/examples/synth_directly_v10.rs

22 lines
586 B
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
use {
kokoro_tts::{KokoroTts, Voice},
voxudio::AudioPlayer,
};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let tts = KokoroTts::new("kokoro-v1.0.int8.onnx", "voices.bin").await?;
let (audio, took) = tts
.synth(
"Hello, world!你好我们是一群追逐梦想的人。我正在使用qq。",
Voice::ZfXiaoxiao(1.2),
)
.await?;
println!("Synth took: {:?}", took);
let mut player = AudioPlayer::new()?;
player.play()?;
player.write::<24000>(&audio, 1).await?;
Ok(())
}