-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathtts_vits.rs
24 lines (23 loc) · 846 Bytes
/
tts_vits.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
wget https://huggingface.co/csukuangfj/vits-ljs/resolve/main/vits-ljs.onnx
wget https://huggingface.co/csukuangfj/vits-ljs/resolve/main/lexicon.txt
wget https://huggingface.co/csukuangfj/vits-ljs/resolve/main/tokens.txt
cargo run --example tts_vits --features="tts"
*/
pub use sherpa_rs::tts::{VitsTts, VitsTtsConfig};
fn main() {
let config = VitsTtsConfig {
model: "./vits-ljs.onnx".into(),
lexicon: "./lexicon.txt".into(),
tokens: "./tokens.txt".into(),
length_scale: 1.0,
..Default::default()
};
let mut tts = VitsTts::new(config);
let sid = 0;
let audio = tts
.create("Hello! This audio generated by onnx model!", sid, 1.0)
.unwrap();
sherpa_rs::write_audio_file("audio.wav", &audio.samples, audio.sample_rate).unwrap();
println!("Created audio.wav")
}