revolution/voicevox-core in the Muse Linux VM to turn Japanese text received in a chat into an audio file.
VOICEVOX Core supports Japanese speech synthesis only. The input text in this guide must be Japanese, so the examples keep their Japanese text as is.
Tested environment
This procedure was tested with the following combination.Prepare a PHP build for FFI
The default PHP in Muse is built withstatic-php-cli, so it may not include ext-ffi. Instead of replacing the default PHP, extract a separate PHP 8.3 for FFI into your home directory.
~/workspace/tools/bin/php83-ffi.
class_exists("FFI") returns true.
Place the VOICEVOX Core files
The official downloader may not get through the Muse proxy, so download the parts the downloader would fetch one by one and place them in the same directory layout.C API and ONNX Runtime
OpenJTalk dictionary and voice model
--no-same-owner to tar, because Muse does not allow changing file ownership.
The examples on this page use Zundamon’s style ID 3 (Normal), which is included in 0.vvm. VVM file numbers do not map one to one to speakers, so check the style ID to use in the VVM metadata.
Install the package
Run Composer with the FFI PHP as well.Synthesize speech from Japanese text
Createzundamon.php. To make it easy to run from a Muse conversation, it takes the input text as the first argument and the output file as the second. Without arguments, it uses the sample text and zundamon.wav.
render(), see Usage and the API Reference.
Results and notes
On a shared-CPU Muse VM, the example above generated a WAV of about 7.67 seconds (24 kHz / 16 bit / mono). Processing took about 9 seconds.- The Muse VM can be recreated, so keep PHP and the libraries in a persistent location such as
~/workspace/. - This package is CLI only. To run it from a web server, plan the
ext-ffisettings and the PHP binary setup separately. - The terms of use of VOICEVOX and each voice library apply to the generated audio. When you use Zundamon, you must credit it as
VOICEVOX:ずんだもん.