Skip to main content

Singing in native mode

Native-mode singing synthesis calls VOICEVOX CORE directly through PHP FFI. Score and Note structures are shared with client mode.

Prerequisites

  1. Complete Installation and Configuration
  2. Set up VOICEVOX Core for PHP
  3. Set VOICEVOX_CORE_PATH in .env
VOICEVOX_CORE_PATH=/path/to/voicevox_core/
For singing models, confirm s0.vvm is included in core.vvms in config/voicevox.php.

Create Score and Note

use Revolution\Voicevox\Song\Note;
use Revolution\Voicevox\Song\Score;

$score = Score::make([
    Note::make(length: 15),
    Note::make(length: Note::len(ticks: 480, bpm: 120), lyric: 'ド', key: 60),
    Note::make(length: Note::len(480, 120), lyric: 'レ', key: 62),
    Note::make(length: Note::len(960, 120), lyric: 'ミ', key: 64),
    Note::make(length: 2),
]);

Basic usage

use Revolution\Voicevox\Song\Note;
use Revolution\Voicevox\Song\Score;
use function Revolution\Voicevox\song;

$score = Score::make([
    Note::make(length: 15),
    Note::make(length: Note::len(480, 120), lyric: 'ド', key: 60),
    Note::make(length: Note::len(480, 120), lyric: 'レ', key: 62),
    Note::make(length: Note::len(960, 120), lyric: 'ミ', key: 64),
    Note::make(length: 2),
]);

$response = song($score, teacher: 6000)
    ->generate(id: 3001);

$response->storeAs('native', 'song.wav');
The same Score can be reused in both client and native modes.

Re-sync F0 and volume with tap()

tap() is useful in native song mode as well. Tune SongAudioQuery, then continue to generate().
use Revolution\Voicevox\Song\SongAudioQuery;
use function Revolution\Voicevox\song;

$response = song($score, teacher: 6000)
    ->tap(function (SongAudioQuery $song) {
        $song->sync();
    })
    ->generate(id: 3001);
If updating separately, always run in this order:
->tap(function (SongAudioQuery $song) {
    $song->updateF0();
    $song->updateVolume();
})

Difference from client mode

ItemClient SongNative Song
Engine processRequiredNot required
FFINot requiredRequired
Entry APIVoicevox::song()song()
Score / NoteSharedShared
For FFI fundamentals, see PHP FFI. For standalone core flow, see VOICEVOX Core for PHP Usage.

Next pages

Score and Note Deep Dive

See practical patterns for building and managing song chart data.

Client Song

Compare with HTTP client mode using the same score.

VOICEVOX for Laravel Overview

Review all modes and related pages in one place.
Last modified on May 23, 2026