Saltar al contenido principal

Cantar con la Engine API

El modo Engine API también ofrece los endpoints de canciones compatibles con el motor oficial de VOICEVOX.
Para la configuración básica de la Engine API, revisa antes Engine API: Talk.

Preparación

Como se usa el modelo de voz cantada, comprueba que s0.vvm esté incluido en core.vvms de config/voicevox.php (viene incluido por defecto).
VOICEVOX_CORE_PATH=/path/to/voicevox_core/

Arranca el motor versión Laravel

php artisan serve --port=50513

Generar audio de canto

1. Crear el sing_frame_audio_query

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
En speaker indica el style ID de tipo sing o singing_teacher (por ejemplo, 6000).

2. Sintetizar el audio con 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
En speaker indica el style ID de tipo sing o frame_decode (por ejemplo, 3001).

Uso desde el cliente Laravel

Puedes usar Voicevox::song() apuntando al motor versión Laravel.
// 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');

Endpoints de ajuste de F0 y volumen

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
Si actualizas F0 y volumen por separado, ejecútalo siempre en el orden F0 → volumen.

Estado de compatibilidad relacionado con Song

EndpointVersión LaravelFallbackNotas
POST /sing_frame_audio_query
POST /frame_synthesis
POST /sing_frame_f0
POST /sing_frame_volumeActualizar en orden f0 → volume
GET /singers
GET /singer_infoRequiere instalar recursos

Siguientes páginas

Detalle de Score y Note

Revisa los detalles de Score / Note que se usan en la Song API.

Engine API: Talk

Revisa cómo usar los endpoints de síntesis de voz desde texto.

Cliente: Song

Revisa el modo que envía la misma partitura directamente al motor oficial.
Última modificación el 13 de julio de 2026