2 releases

0.4.7 Aug 29, 2023
0.4.6 Aug 26, 2023
0.3.5 Aug 25, 2023
0.2.4 Aug 23, 2023
0.1.0 Aug 22, 2023

#646 in Audio

46 downloads per month

MIT license

21KB
369 lines

voicevox-rs

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

Requirements

License

MIT

Dependencies

~6–41MB
~627K SLoC