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

# Streaming TTS

> Start speaking before the whole text is synthesized

`synthesizeStream` emits `AudioChunk` values as they are produced, so playback starts on the
first chunk instead of the last.

```ts theme={"theme":"css-variables"}
for await (const chunk of RunAnywhere.tts.synthesizeStream(longText)) {
  player.enqueue(chunk)
}
```

## Signature

```ts theme={"theme":"css-variables"}
synthesizeStream(text: string, options?: TtsOptions): AsyncIterable<AudioChunk>
```

## When it is worth it

For a sentence, `speak` is simpler and the difference is invisible. For a paragraph, or for a
model reply being streamed as it generates, streaming synthesis is what keeps the gap between
"the model finished" and "the user hears something" short.

## Pairing it with a streaming completion

Speak each sentence as the model finishes it:

```ts theme={"theme":"css-variables"}
let sentence = ''

for await (const event of RunAnywhere.llm.generateStream(prompt)) {
  if (event.type !== 'textDelta') continue
  sentence += event.text

  if (/[.!?]/.test(event.text)) {
    RunAnywhere.tts.speak(sentence)
    sentence = ''
  }
}

if (sentence) RunAnywhere.tts.speak(sentence)
```

For a full conversation rather than one reply, use the [voice session](https://docs.runanywhere.ai/react-native/voice-agent.md),
which handles turn-taking and interruption.

## AudioPlaybackManager

`@runanywhere/core` exports `AudioPlaybackManager`, which wraps the native playback path the
voice session uses. Prefer it over hand-rolling a player from chunks: it already handles the
audio session and the scheduling.

```ts theme={"theme":"css-variables"}
import { AudioPlaybackManager } from '@runanywhere/core'
```

## Stopping

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


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