voicevox-rs

Crates.iovoicevox-rs
lib.rsvoicevox-rs
version0.4.7
sourcesrc
created_at2023-08-22 14:02:05.200435
updated_at2023-08-29 06:53:41.944714
descriptionvoicevox client library for Rust
homepagehttps://crates.io/crates/voicevox-rs
repositoryhttps://github.com/nomissbowling/voicevox-rs
max_upload_size
id951070
size21,784
nomissbowling (nomissbowling)

documentation

https://docs.rs/voicevox-rs/

README

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

Commit count: 10

cargo fmt