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

# Engine-API-modus: song (zangsynthese) - VOICEVOX for Laravel

> Stappen om de zangsynthese-endpoints te gebruiken van de VOICEVOX-engine-compatibele API in je Laravel-app.

## Laten zingen via de engine-API

De engine-API-modus biedt ook song-endpoints die compatibel zijn met de officiële VOICEVOX-engine.

<Info>
  Bekijk eerst [Engine-API: talk](/nl/packages/laravel-voicevox/engine-talk) voor de basisinstallatie van de engine-API.
</Info>

## Voorbereiding

Controleer of `s0.vvm` is opgenomen in `core.vvms` in `config/voicevox.php`, zodat het zangmodel wordt gebruikt (standaard is dit het geval).

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

## De Laravel-versie van de engine starten

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

## Zang genereren

### 1. Een `sing_frame_audio_query` maken

```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
```

Geef bij `speaker` een stijl-ID van het type `sing` of `singing_teacher` op (bijvoorbeeld 6000).

### 2. Spraak synthetiseren met `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
```

Geef bij `speaker` een stijl-ID van het type `sing` of `frame_decode` op (bijvoorbeeld 3001).

## Gebruik vanuit de Laravel-client

Je kunt `Voicevox::song()` gebruiken tegen de Laravel-versie van de engine.

```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 voor F0- en volumeaanpassing

```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>
  Als je F0 en volume afzonderlijk bijwerkt, doe dat dan altijd in de volgorde **F0 → volume**.
</Warning>

## Ondersteuningsstatus voor song

| Endpoint                       | Laravel-versie | Fallback | Opmerkingen                          |
| ------------------------------ | -------------- | -------- | ------------------------------------ |
| `POST /sing_frame_audio_query` | ✅              | ✅        |                                      |
| `POST /frame_synthesis`        | ✅              | ✅        |                                      |
| `POST /sing_frame_f0`          | ✅              | ✅        |                                      |
| `POST /sing_frame_volume`      | ✅              | ✅        | Bijwerken in de volgorde f0 → volume |
| `GET /singers`                 | ✅              | ✅        |                                      |
| `GET /singer_info`             | ✅              | ✅        | Vereist installatie van resources    |

## Volgende pagina's

<Columns cols={3}>
  <Card title="Score en Note in detail" href="/nl/packages/laravel-voicevox/song-score-note" icon="list-music">
    Bekijk de details van de `Score` / `Note` die je in de Song API gebruikt.
  </Card>

  <Card title="Engine-API: talk" href="/nl/packages/laravel-voicevox/engine-talk" icon="message-circle">
    Bekijk het gebruik van de tekst-naar-spraak-endpoints.
  </Card>

  <Card title="Client: song" href="/nl/packages/laravel-voicevox/client-song" icon="music">
    Bekijk de modus die dezelfde partituur rechtstreeks naar de officiële engine stuurt.
  </Card>
</Columns>


## Related topics

- [Native modus: song (zangsynthese) - VOICEVOX for Laravel](/nl/packages/laravel-voicevox/native-song.md)
- [Clientmodus: song (zangsynthese) - VOICEVOX for Laravel](/nl/packages/laravel-voicevox/client-song.md)
- [Engine-API-modus: talk (tekst-naar-spraak) - VOICEVOX for Laravel](/nl/packages/laravel-voicevox/engine-talk.md)
- [Ontwikkelgids voor apps met de engine-API - VOICEVOX for Laravel](/nl/packages/laravel-voicevox/app-guide.md)
- [VOICEVOX for Laravel](/nl/packages/laravel-voicevox/index.md)
