Crates.io | voicevox-dyn |
lib.rs | voicevox-dyn |
version | 0.3.0 |
source | src |
created_at | 2023-09-18 13:07:08.587092 |
updated_at | 2023-10-13 03:53:11.345878 |
description | dynamically load and run voicevox from rust |
homepage | |
repository | https://github.com/chronicl/voicevox-dyn |
max_upload_size | |
id | 975896 |
size | 37,364 |
Downloads VOICEVOX CORE and dynamically loads it at runtime.
This crate makes it as easy as possible to use voicevox in rust, in particular, it is possible to distribute a single binary that sets up voicevox itself and is also able to run it.
use voicevox_dyn::{AccelerationMode, VoiceVox};
const SPEAKER_ID: u32 = 4;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let threads = std::thread::available_parallelism()?.get() as u16;
let mut vv = VoiceVox::load()?;
vv.init(AccelerationMode::Auto, threads, false)?;
vv.load_model(SPEAKER_ID)?;
let wav = vv.tts("こんにちは", SPEAKER_ID, Default::default())?;
std::fs::write("audio.wav", wav.as_slice())?;
Ok(())
}
If you prefer to dynamically link voicevox instead, I recommend using vvcore.