> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Modo Engine API: Song (síntesis de voz cantada) - VOICEVOX for Laravel

> Explica cómo usar los endpoints de síntesis de voz cantada de la API compatible con el motor VOICEVOX embebida en una app Laravel.

## Cantar con la Engine API

El modo Engine API también ofrece los endpoints de canciones compatibles con el motor oficial de VOICEVOX.

<Info>
  Para la configuración básica de la Engine API, revisa antes [Engine API: Talk](/es/packages/laravel-voicevox/engine-talk).
</Info>

## 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).

```dotenv theme={null}
VOICEVOX_CORE_PATH=/path/to/voicevox_core/
```

## Arranca el motor versión Laravel

```shell theme={null}
php artisan serve --port=50513
```

## Generar audio de canto

### 1. Crear el `sing_frame_audio_query`

```shell theme={null}
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`

```shell theme={null}
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.

```php theme={null}
// config/voicevox.php
'client' => [
    'url' => env('VOICEVOX_URL', 'http://127.0.0.1:50513'),
],
```

```php theme={null}
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

```shell theme={null}
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
```

<Warning>
  Si actualizas F0 y volumen por separado, ejecútalo siempre en el orden **F0 → volumen**.
</Warning>

## Estado de compatibilidad relacionado con Song

| Endpoint                       | Versión Laravel | Fallback | Notas                           |
| ------------------------------ | --------------- | -------- | ------------------------------- |
| `POST /sing_frame_audio_query` | ✅               | ✅        |                                 |
| `POST /frame_synthesis`        | ✅               | ✅        |                                 |
| `POST /sing_frame_f0`          | ✅               | ✅        |                                 |
| `POST /sing_frame_volume`      | ✅               | ✅        | Actualizar en orden f0 → volume |
| `GET /singers`                 | ✅               | ✅        |                                 |
| `GET /singer_info`             | ✅               | ✅        | Requiere instalar recursos      |

## Siguientes páginas

<Columns cols={3}>
  <Card title="Detalle de Score y Note" href="/es/packages/laravel-voicevox/song-score-note" icon="list-music">
    Revisa los detalles de `Score` / `Note` que se usan en la Song API.
  </Card>

  <Card title="Engine API: Talk" href="/es/packages/laravel-voicevox/engine-talk" icon="message-circle">
    Revisa cómo usar los endpoints de síntesis de voz desde texto.
  </Card>

  <Card title="Cliente: Song" href="/es/packages/laravel-voicevox/client-song" icon="music">
    Revisa el modo que envía la misma partitura directamente al motor oficial.
  </Card>
</Columns>


## Related topics

- [Modo nativo: Song (síntesis de voz cantada) - VOICEVOX for Laravel](/es/packages/laravel-voicevox/native-song.md)
- [Modo cliente: Song (síntesis de voz cantada) - VOICEVOX for Laravel](/es/packages/laravel-voicevox/client-song.md)
- [Modo cliente: Talk (síntesis de voz desde texto) - VOICEVOX for Laravel](/es/packages/laravel-voicevox/client-talk.md)
- [Modo nativo: Talk (síntesis de voz desde texto) - VOICEVOX for Laravel](/es/packages/laravel-voicevox/native-talk.md)
- [Modo Engine API: Talk (síntesis de voz desde texto) - VOICEVOX for Laravel](/es/packages/laravel-voicevox/engine-talk.md)
