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

# Aan de slag - VOICEVOX for Laravel

> Een overzicht van de basisconcepten van VOICEVOX for Laravel, een vergelijking van de drie modi, een snelstart (clientmodus) en de belangrijkste functies.

VOICEVOX for Laravel is een pakket om de spraaksynthesefuncties van VOICEVOX te gebruiken in Laravel. Je kunt Japanse spraak genereren uit tekst.

<Tip>
  Begin met de clientmodus voor de kortste installatie. In een omgeving waar FFI beschikbaar is, kun je later stapsgewijs overstappen naar de native modus of de engine-API-modus.
</Tip>

## Drie gebruiksmodi

| Modus            | Uitvoeringswijze                                 | FFI        | Geschikt voor                                                   | Gids                                                                                                                |
| ---------------- | ------------------------------------------------ | ---------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| Clientmodus      | HTTP-verbinding met de officiële VOICEVOX-engine | Niet nodig | Eerste kennismaking, Docker-omgevingen, omgevingen zonder FFI   | [Client Talk](/nl/packages/laravel-voicevox/client-talk) / [Client Song](/nl/packages/laravel-voicevox/client-song) |
| Native modus     | VOICEVOX CORE rechtstreeks aanroepen via PHP FFI | Vereist    | Betere prestaties, offline uitvoering, integratie met CLI-tools | [Native Talk](/nl/packages/laravel-voicevox/native-talk) / [Native Song](/nl/packages/laravel-voicevox/native-song) |
| Engine-API-modus | Laravel biedt een VOICEVOX-compatibele API       | Vereist    | Een API-server openstellen, koppeling met meerdere clients      | [Engine Talk](/nl/packages/laravel-voicevox/engine-talk) / [Engine Song](/nl/packages/laravel-voicevox/engine-song) |

## Snelstart

De stappen voor de clientmodus.

<Steps>
  <Step title="Pakket installeren">
    ```shell theme={null}
    composer require revolution/laravel-voicevox
    ```

    Zie [Installatie en configuratie](/nl/packages/laravel-voicevox/installation) voor meer details.
  </Step>

  <Step title="De officiële engine starten">
    ```shell theme={null}
    docker pull voicevox/voicevox_engine:cpu-latest
    docker run --rm -p '127.0.0.1:50021:50021' voicevox/voicevox_engine:cpu-latest
    ```
  </Step>

  <Step title="Spraaksynthese proberen">
    ```php theme={null}
    use Revolution\Voicevox\Voicevox;

    $response = Voicevox::talk('こんにちは、Laravel です。', id: 1)->generate(id: 1);
    $response->storeAs('output.wav');
    ```
  </Step>
</Steps>

## Belangrijkste functies

### Spraaksynthese (Talk)

```php theme={null}
use Revolution\Voicevox\Client\TalkAudioQuery;
use Revolution\Voicevox\Voicevox;

$response = Voicevox::talk('こんにちは', id: 1)
    ->tap(function (TalkAudioQuery $talk) {
        $talk->audioQuery['speedScale'] = 1.2;
        $talk->audioQuery['pitchScale'] = 0.05;
        $talk->audioQuery['intonationScale'] = 1.5;
        $talk->audioQuery['volumeScale'] = 1.0;
    })
    ->generate(id: 1);
```

### Zangsynthese (Song)

```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(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),
]);

$response = Voicevox::song($score)->generate(id: 3001);
```

### Gebruikerswoordenboek en presets

In de clientmodus gebruik je de `Voicevox`-facade om het gebruikerswoordenboek en de presets aan de kant van de officiële engine te beheren.

```php theme={null}
use Revolution\Voicevox\Voicevox;

$uuid = Voicevox::addWord(
    surface: 'Laravel',
    pronunciation: 'ララベル',
    accentType: 3,
);

$presetId = Voicevox::addPreset([
    'id' => 0,
    'name' => 'ゆっくり丁寧',
    'speaker_uuid' => '7ffcb7ce-00ec-4bdc-82cd-45a8889e43ff',
    'style_id' => 1,
    'speedScale' => 0.8,
    'pitchScale' => 0.0,
    'intonationScale' => 1.2,
    'volumeScale' => 1.0,
    'prePhonemeLength' => 0.1,
    'postPhonemeLength' => 0.1,
]);
```

### Laravel AI SDK-integratie

```php theme={null}
use Laravel\Ai\Audio;

$audio = Audio::of('こんにちは、Laravel です。')
    ->voice('ずんだもん')
    ->generate();

$audio->storeAs('output.wav');
```

## Volgende stappen

* [Installatie en configuratie](/nl/packages/laravel-voicevox/installation)
* [Configuratiereferentie](/nl/packages/laravel-voicevox/configuration)
* [Client Talk](/nl/packages/laravel-voicevox/client-talk)
* [Client Song](/nl/packages/laravel-voicevox/client-song)
* [Clientmodus - gebruikerswoordenboek](/nl/packages/laravel-voicevox/client-user-dict)
* [Clientmodus - presets](/nl/packages/laravel-voicevox/client-presets)
* [Native Talk](/nl/packages/laravel-voicevox/native-talk)
* [Engine Talk](/nl/packages/laravel-voicevox/engine-talk)
* [Native modus - gebruikerswoordenboek](/nl/packages/laravel-voicevox/native-user-dict)
* [Native modus - presets](/nl/packages/laravel-voicevox/native-presets)
* [AI SDK-integratie](/nl/packages/laravel-voicevox/ai-sdk)


## Related topics

- [Aan de slag met Laravel-testen in Pest PHP](/nl/blog/pest-introduction.md)
- [Aan de slag - GitHub Copilot SDK voor Laravel](/nl/packages/laravel-copilot-sdk/getting-started.md)
- [Mappenstructuur](/nl/directory-structure.md)
- [Eloquent accessors, mutators en casts](/nl/eloquent-mutators.md)
- [Databaseconfiguratie](/nl/database.md)
