Crates.io | voicevox-rs |
lib.rs | voicevox-rs |
version | 0.4.7 |
source | src |
created_at | 2023-08-22 14:02:05.200435 |
updated_at | 2023-08-29 06:53:41.944714 |
description | voicevox client library for Rust |
homepage | https://crates.io/crates/voicevox-rs |
repository | https://github.com/nomissbowling/voicevox-rs |
max_upload_size | |
id | 951070 |
size | 21,784 |
VOICEVOX Client library for Rust
let vvc = VVClient::new();
vvc.display_speakers().unwrap(); // show all speaker characters
let Some(id) = vvc.speaker("ずんだもん", "ノーマル") else { panic!("id") };
let qs = vvc.query("ずんだもんなのだ。", id).unwrap();
let dat = vvc.synth(qs, id).unwrap();
vvc.speak(dat, 3).unwrap(); // always 3 seconds
let vvc = VVClient::new();
let characters: Vec<(&str, &str)> = vec![
("雨晴はう", "ノーマル"),
("春日部つむぎ", "ノーマル"),
("四国めたん", "ノーマル"),
("四国めたん", "あまあま"),
("ずんだもん", "ノーマル"),
("小夜/SAYO", "ノーマル"),
("猫使アル", "ノーマル"),
("猫使アル", "おちつき"),
("猫使アル", "うきうき"),
("猫使ビィ", "ノーマル"),
("猫使ビィ", "おちつき"),
("猫使ビィ", "人見知り")];
for chara in characters {
let Some(id) = vvc.speaker(chara.0, chara.1) else { panic!("id") };
let qs = vvc.query(format!("{}です{}なのです",
chara.0, chara.1).as_str(), id).unwrap();
let mut ps = vvc.phrases(&qs).unwrap();
let dat = vvc.synth(qs, id).unwrap();
vvc.speak(dat, 0).unwrap(); // append to buffer
ps.speedScale = 1.5;
let dat = vvc.synth(vvc.phrases_to_str(&ps).unwrap(), id).unwrap();
vvc.speak(dat, 0).unwrap(); // append to buffer
}
vvc.speak_flush().unwrap(); // must call it after speak 0
MIT