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

# Prise en main - VOICEVOX for Laravel

> Concepts de base de VOICEVOX for Laravel, comparaison des 3 modes, démarrage rapide (mode client) et fonctionnalités principales.

VOICEVOX for Laravel est un package pour utiliser les fonctionnalités de synthèse vocale de VOICEVOX depuis Laravel. Il permet de générer de la voix en japonais à partir de texte.

<Tip>
  Commencer par le mode client offre la mise en place la plus rapide. Dans un environnement où FFI est disponible, vous pourrez ensuite migrer progressivement vers le mode natif ou le mode API du moteur.
</Tip>

## Trois modes d'utilisation

| Mode               | Mode d'exécution                           | FFI        | Cas d'usage                                                     | Guide                                                                                                               |
| ------------------ | ------------------------------------------ | ---------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| Mode client        | Connexion HTTP au moteur officiel VOICEVOX | Non requis | Premier essai, environnement Docker, environnement sans FFI     | [Client Talk](/fr/packages/laravel-voicevox/client-talk) / [Client Song](/fr/packages/laravel-voicevox/client-song) |
| Mode natif         | Appel direct de VOICEVOX CORE via PHP FFI  | Requis     | Performance, exécution hors ligne, intégration à des outils CLI | [Native Talk](/fr/packages/laravel-voicevox/native-talk) / [Native Song](/fr/packages/laravel-voicevox/native-song) |
| Mode API du moteur | Laravel expose une API compatible VOICEVOX | Requis     | Exposition d'une API, intégration multi-clients                 | [Engine Talk](/fr/packages/laravel-voicevox/engine-talk) / [Engine Song](/fr/packages/laravel-voicevox/engine-song) |

## Démarrage rapide

Procédure en mode client.

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

    Pour les détails, consultez [Installation et configuration](/fr/packages/laravel-voicevox/installation).
  </Step>

  <Step title="Démarrer le moteur officiel">
    ```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="Essayer la synthèse vocale">
    ```php theme={null}
    use Revolution\Voicevox\Voicevox;

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

## Fonctionnalités principales

### Synthèse vocale (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);
```

### Synthèse chantée (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);
```

### Dictionnaire utilisateur et presets

En mode client, utilisez la Facade `Voicevox` pour manipuler le dictionnaire utilisateur et les presets côté moteur officiel.

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

### Intégration Laravel AI SDK

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

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

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

## Prochaines étapes

* [Installation et configuration](/fr/packages/laravel-voicevox/installation)
* [Référence de configuration](/fr/packages/laravel-voicevox/configuration)
* [Client Talk](/fr/packages/laravel-voicevox/client-talk)
* [Client Song](/fr/packages/laravel-voicevox/client-song)
* [Mode client - Dictionnaire utilisateur](/fr/packages/laravel-voicevox/client-user-dict)
* [Mode client - Presets](/fr/packages/laravel-voicevox/client-presets)
* [Native Talk](/fr/packages/laravel-voicevox/native-talk)
* [Engine Talk](/fr/packages/laravel-voicevox/engine-talk)
* [Mode natif - Dictionnaire utilisateur](/fr/packages/laravel-voicevox/native-user-dict)
* [Mode natif - Presets](/fr/packages/laravel-voicevox/native-presets)
* [Intégration AI SDK](/fr/packages/laravel-voicevox/ai-sdk)


## Related topics

- [Créer un starter kit Laravel](/fr/advanced/starter-kit-creation.md)
- [Installation et configuration - VOICEVOX for Laravel](/fr/packages/laravel-voicevox/installation.md)
- [MongoDB](/fr/mongodb.md)
- [Attributs PHP](/fr/advanced/php-attributes.md)
- [VOICEVOX for Laravel](/fr/packages/laravel-voicevox/index.md)
