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

```kotlin theme={"theme":"css-variables"}
// Get the audio back
val audio = RunAnywhere.tts.synthesize("Hello from RunAnywhere")

// Play it
val handle = RunAnywhere.tts.speak("Hello from RunAnywhere")
```

## Signatures

```kotlin theme={"theme":"css-variables"}
suspend fun synthesize(text: String, options: TtsOptions? = null): Audio
fun synthesizeStream(text: String, options: TtsOptions? = null): Flow<AudioChunk>
fun speak(text: String, options: TtsOptions? = null): SpeechHandle
suspend fun stop()
suspend fun voices(): List<Voice>
```

`synthesize` returns audio to save or feed elsewhere. `speak` plays it and returns a handle.
`speak` is **not** suspending; it returns immediately.

## Options

```kotlin theme={"theme":"css-variables"}
val audio = RunAnywhere.tts.synthesize(
    "Hello",
    TtsOptions(voice = "en_US-amy-medium", speed = 1.1f)
)
```

| Field | Type | Default |
| - | - | - |
| `voice` | `String?` | none, model default |
| `language` | `String` | `DEFAULT_LANGUAGE` |
| `speed` | `Float` | `DEFAULT_SPEED` |
| `pitch` | `Float` | `DEFAULT_PITCH` |
| `format` | `AudioFormat` | `DEFAULT_FORMAT` |
| `sampleRate` | `Int` | `DEFAULT_SAMPLE_RATE` |

All five defaults are public constants on `TtsOptions`, read from the proto defaults.

## Stopping

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

Stops whatever is speaking, without needing the handle.

## Saving to a file

```kotlin theme={"theme":"css-variables"}
val audio = RunAnywhere.tts.synthesize("Save me")
File(context.filesDir, "out.wav").writeBytes(audio.samples)
```


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