Singen lassen über die Engine-API
Der Engine-API-Modus bietet auch Song-Endpunkte, die mit der offiziellen VOICEVOX-Engine kompatibel sind.
Für die grundlegende Einrichtung der Engine-API prüfen Sie zuerst Engine-API: Talk.
Vorbereitung
Damit das Gesangsmodell verwendet werden kann, prüfen Sie, dass s0.vvm in core.vvms in config/voicevox.php enthalten ist (standardmäßig enthalten).
VOICEVOX_CORE_PATH=/path/to/voicevox_core/
Laravel-Version der Engine starten
php artisan serve --port=50513
Gesangsaudio generieren
1. sing_frame_audio_query erstellen
curl -s -X POST "http://127.0.0.1:50513/sing_frame_audio_query?speaker=6000" \
-H "Content-Type: application/json" \
-d '{
"notes": [
{"id": "a", "key": null, "frame_length": 15, "lyric": ""},
{"id": "b", "key": 60, "frame_length": 94, "lyric": "ド"},
{"id": "c", "key": 62, "frame_length": 94, "lyric": "レ"},
{"id": "d", "key": 64, "frame_length": 187, "lyric": "ミ"},
{"id": "e", "key": null, "frame_length": 2, "lyric": ""}
]
}' \
> frame_audio_query.json
Für speaker geben Sie eine Style-ID vom Typ sing oder singing_teacher an (z. B. 6000).
2. Sprachsynthese mit frame_synthesis
curl -s -X POST "http://127.0.0.1:50513/frame_synthesis?speaker=3001" \
-H "Content-Type: application/json" \
-d @frame_audio_query.json \
> song.wav
Für speaker geben Sie eine Style-ID vom Typ sing oder frame_decode an (z. B. 3001).
Verwendung aus einem Laravel-Client
Sie können Voicevox::song() auf die Laravel-Version der Engine ausrichten.
// config/voicevox.php
'client' => [
'url' => env('VOICEVOX_URL', 'http://127.0.0.1:50513'),
],
use Revolution\Voicevox\Song\Note;
use Revolution\Voicevox\Song\Score;
use Revolution\Voicevox\Voicevox;
$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 = Voicevox::song($score, teacher: 6000)->generate(id: 3001);
$response->storeAs('engine', 'song.wav');
Endpunkte für F0- und Lautstärke-Anpassung
curl -s -X POST "http://127.0.0.1:50513/sing_frame_f0?speaker=6000" \
-H "Content-Type: application/json" \
-d '{"score": {...}, "frame_audio_query": {...}}' \
> f0.json
curl -s -X POST "http://127.0.0.1:50513/sing_frame_volume?speaker=6000" \
-H "Content-Type: application/json" \
-d '{"score": {...}, "frame_audio_query": {...}}' \
> volume.json
Wenn Sie F0 und Lautstärke einzeln aktualisieren, führen Sie es unbedingt in der Reihenfolge F0 → Lautstärke aus.
Unterstützungsstatus der Song-Endpunkte
| Endpunkt | Laravel-Version | Fallback | Hinweise |
|---|
POST /sing_frame_audio_query | ✅ | ✅ | |
POST /frame_synthesis | ✅ | ✅ | |
POST /sing_frame_f0 | ✅ | ✅ | |
POST /sing_frame_volume | ✅ | ✅ | Aktualisierung in der Reihenfolge f0 → volume |
GET /singers | ✅ | ✅ | |
GET /singer_info | ✅ | ✅ | Ressourceninstallation erforderlich |
Nächste Seiten
Score- und Note-Details
Details zu Score und Note, die in der Song-API verwendet werden.
Engine-API: Talk
Verwendung der Endpunkte zur Text-Sprachsynthese.
Client: Song
Modus, der dieselbe Partitur direkt an die offizielle Engine sendet.
Zuletzt geändert am 13. Juli 2026