Crates.io | vvcore |
lib.rs | vvcore |
version | 0.0.2 |
source | src |
created_at | 2023-04-03 09:10:41.424009 |
updated_at | 2023-04-03 10:47:56.169943 |
description | FFI bindings for VOICEVOX CORE |
homepage | |
repository | https://github.com/iwase22334/voicevox-core-rs |
max_upload_size | |
id | 828972 |
size | 50,302 |
This is an unofficial Rust FFI wrapper for VOICEVOX CORE. It provides a high-level API for calling VOICEVOX CORE. It also provides a low-level API for directly calling the ffi provided by VOICEVOX CORE.
Please download VOICEVOX CORE using the following method. https://github.com/VOICEVOX/voicevox_core#%E7%92%B0%E5%A2%83%E6%A7%8B%E7%AF%89
use std::io::Write;
use vvcore::*;
fn main() {
let dir = std::ffi::CString::new("open_jtalk_dic_utf_8-1.11").unwrap();
let vvc = VoicevoxCore::new_from_options(AccelerationMode::Auto, 0, true, dir.as_c_str()).unwrap();
let text: &str = "こんにちは";
let speaker: u32 = 1;
let wav = vvc.tts_simple(text, speaker).unwrap();
let mut file = std::fs::File::create("audio.wav").unwrap();
file.write_all(&wav.as_slice()).unwrap();
}
Please note that the files inside the downloaded voicevox_core directory are required at runtime, so please place the built binary file in the downloaded voicevox_core directory and execute it.
The following functions are available as high-level APIs. In the high-level API, initialization functions and free functions are implemented by RAII. Also, all functions can be referenced as unsafe functions in the api module.
Note that it can only be executed in a single thread.
## Clone repository
git clone https://github.com/iwase22334/voicevox-core-rs
cd voicevox-core-rs
## Download voicevox core
binary=download-linux-x64
curl -sSfL https://github.com/VOICEVOX/voicevox_core/releases/latest/download/${binary} -o download
chmod +x download
./download
## Run test
(export LD_LIBRARY_PATH=./voicevox_core:$LD_LIBRARY_PATH && cargo test -- --test-threads=1)