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

# Native mode: Talk (text-to-speech) - VOICEVOX for Laravel

> How to synthesize speech in VOICEVOX for Laravel's native mode by calling VOICEVOX CORE directly through PHP FFI.

## What is native mode?

Native mode uses [VOICEVOX Core for PHP](/en/packages/voicevox-core-php) to call VOICEVOX CORE directly through PHP FFI.

You can synthesize without starting the official engine, but you need FFI and a local library setup.

<Warning>
  Native mode is not intended for web servers. Use it from a local CLI. FFI limitations are also covered in [PHP FFI](/en/advanced/ffi).
</Warning>

## Prerequisites

1. Complete [installation and setup](/en/packages/laravel-voicevox/installation).
2. Complete the setup for [VOICEVOX Core for PHP](/en/packages/voicevox-core-php).
3. Set `VOICEVOX_CORE_PATH` in `.env`.

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

## Basic usage

In native mode, use the `talk()` helper.

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

$response = talk('This is the native version, na no da', id: 1)
    ->generate(id: 1);

$response->storeAs('native', 'talk.wav');
```

## Specifying a style ID

Set `id` to a style ID contained in a loaded `.vvm`.

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

$response = talk('I am Zundamon, na no da', id: 1)
    ->generate(id: 1);
```

Only models included in `core.vvms` in `config/voicevox.php` can be used.

## Adjusting the Audio Query with `tap()`

`tap()` works the same way in native mode. Note, though, that `TalkAudioQuery` is a different class from the one in client mode.

```php theme={null}
use Revolution\Voicevox\Talk\TalkAudioQuery;
use function Revolution\Voicevox\talk;

$response = talk('I will speak a bit faster, na no da', 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);
```

<Info>
  The `tap()` pattern itself is summarized in [The tap() helper and the Tappable trait](/en/advanced/tap). VOICEVOX for Laravel is a practical example of it.
</Info>

## Using AquesTalk-style kana

Native mode has no `enable_katakana_english`, so it isn't suited to reading input that mixes in English.

Use `kana()` instead to pass AquesTalk-style kana directly.

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

$response = kana("Ne'itibu/BanNaNoDa'", id: 1)
    ->generate(id: 1);

$response->storeAs('native', 'kana.wav');
```

## Differences from client mode

| Item | Client Talk | Native Talk |
| - | - | - |
| Engine start | Required | Not required |
| FFI | Not required | Required |
| Automatic katakana conversion of English | Yes | No |
| API entry point | `Voicevox::talk()` | `talk()` |

## Next pages

<Columns cols={2}>
  <Card title="Native Song" href="/en/packages/laravel-voicevox/native-song" icon="music">
    Work with singing voice models through FFI.
  </Card>

  <Card title="VOICEVOX Core for PHP" href="/en/packages/voicevox-core-php" icon="library">
    Set up the pure PHP wrapper and understand its constraints.
  </Card>
</Columns>


## Related topics

- [Client Mode: Talk (Text-to-Speech) - VOICEVOX for Laravel](/en/packages/laravel-voicevox/client-talk.md)
- [Engine API Mode: Talk (Text-to-Speech) - VOICEVOX for Laravel](/en/packages/laravel-voicevox/engine-talk.md)
- [VOICEVOX for Laravel](/en/packages/laravel-voicevox/index.md)
- [Engine API Mode: Song (Singing Synthesis) - VOICEVOX for Laravel](/en/packages/laravel-voicevox/engine-song.md)
- [VOICEVOX Core for PHP](/en/packages/voicevox-core-php/index.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.