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

# synthesize()

> Turn text into audio

```ts theme={"theme":"css-variables"}
// Get the audio back
const audio = await RunAnywhere.tts.synthesize('Hello from RunAnywhere')

// Play it
const handle = RunAnywhere.tts.speak('Hello from RunAnywhere')
```

## Signatures

```ts theme={"theme":"css-variables"}
synthesize(text: string, options?: TtsOptions): Promise<Audio>
synthesizeStream(text: string, options?: TtsOptions): AsyncIterable<AudioChunk>
speak(text: string, options?: TtsOptions): SpeechHandle
stop(): Promise<void>
voices(): Promise<Voice[]>
```

> [!NOTE]
>
> `speak` is **synchronous** on React Native and returns the handle immediately. `stop` is async.
> The pairing is the reverse of the Web SDK.

## Options

```ts theme={"theme":"css-variables"}
const audio = await RunAnywhere.tts.synthesize('Hello', {
  voice: 'en_US-amy-medium',
  speed: 1.1,
})
```

| Field | Type | Default |
| - | - | - |
| `voice` | `string` | none, model default |
| `language` | `string` | proto default |
| `speed` | `number` | proto default |
| `pitch` | `number` | proto default |
| `format` | `AudioFormat` | proto default |
| `sampleRate` | `number` | proto default |

## Stopping

```ts theme={"theme":"css-variables"}
await RunAnywhere.tts.stop()
```

Stops whatever is speaking.

## Audio session

On iOS, playing audio while another app is playing needs the right audio session category.
The SDK's playback path handles the common case, but if your app already configures an audio
session, configure it before speaking rather than after.

## Saving to a file

```ts theme={"theme":"css-variables"}
const audio = await RunAnywhere.tts.synthesize('Save me')
// audio.samples is a Uint8Array; write it with your filesystem library of choice
```


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