VOICEVOX CORE Rust Bindings
VOICEVOX COREのRust向けFFIラッパーです。 VOICEVOX COREを呼び出すための高レベルなAPIを提供します。 また、VOICEVOX COREにより提供されるffiを直接呼び出す低レベルなAPIを提供します。
サンプルの実行方法
必要なもの
以下の方法でVOICEVOX COREをダウンロードしておいてください。 https://github.com/VOICEVOX/voicevox_core#%E7%92%B0%E5%A2%83%E6%A7%8B%E7%AF%89
ビルド方法
以下のコマンドでサンプルコードをビルドします。
cargo build --example simple-tts
ビルドに必要なファイルがあるディレクトリに実行ファイルを移動します。
mv target/debug/examples/simple-tts voicevox_core
実行
以下のコマンドで実行します。voicevox_coreディレクトリ内にaudio.wavが生成されます。
(export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH && cd voicevox_core && ./simple-tts)
テスト
(export LD_LIBRARY_PATH=./voicevox_core:$LD_LIBRARY_PATH && cargo test -- --test-threads=1)
対応状況
以下の関数は、高レベルなAPIとして利用可能です。 高レベルAPIにおいては、初期化関数やfree関数はRAIIにより実行されるため実装されません。 また、すべての関数はapiモジュール内でunsafeな関数として参照できます。
- voicevox_make_default_initialize_options
-
voicevox_initialize - voicevox_get_version
- voicevox_load_model
- voicevox_is_gpu_mode
- voicevox_is_model_loaded
-
voicevox_finalize - voicevox_get_metas_json
- voicevox_get_supported_devices_json
- voicevox_predict_duration
-
voicevox_predict_duration_data_free - voicevox_predict_intonation
-
voicevox_predict_intonation_data_free - voicevox_decode
-
voicevox_decode_data_free - voicevox_make_default_audio_query_options
- voicevox_audio_query
- voicevox_make_default_synthesis_options
- voicevox_synthesis
- voicevox_make_default_tts_options
- voicevox_tts
-
voicevox_audio_query_json_free -
voicevox_wav_free - voicevox_error_result_to_message