# Text to Speech

> Generate speech with ElevenLabs using your own vault key, and play the audio through the patch.

Source: https://docs.tune.toys/nodes/media.speech/

Text to Speech turns words into ElevenLabs audio that can feed effects, the mixer and live recordings.

## What it does

Enable ElevenLabs in Settings → Addons, add your API key to the `elevenlabs` vault slot in Settings → Vault, and enter a provider `voice` ID in the node's Properties. The key is injected by the account request proxy; it never enters the Toy or reaches the browser. Generation uses your ElevenLabs quota. The node does not retry paid requests automatically.

Connect a text cable or enter `text` in Properties (1–4096 characters). With `trigger` cabled, a trigger generates the newest text. Without that cable, a new text message generates speech; uncabled text generates when the node starts. A new request replaces this node's current request and audio. `stop` cancels pending work and playback, and wins if both triggers arrive together. Stopping playback or the transport cancels speech. Structural engine changes stop buffered audio. Already submitted provider work may still be billed after cancellation.

The mono voice is duplicated across the resolved `audio` bundle (stereo by default), following ordinary patch routing, processing, mixer levels and live output capture. `bytes` carries the generated mono 24 kHz WAV. The browser decodes and resamples off the audio thread, then transfers a bounded clip to the worklet; the shared engine reads preallocated blocks. Responses are bounded by the proxy's 5 MiB limit; decoded playback is bounded to 4,194,304 samples. Failures appear on `error` and the node status. `busy` covers generation and preparation. `done` fires when the generated clip is ready for playback, rather than when the last sample finishes.

Set `model` to an ElevenLabs model ID, or leave it empty for `eleven_multilingual_v2`. Optional `language` is an ISO language code such as `en` or `fr`; an empty field lets the model detect it. Language enforcement is model-dependent and is unsupported by multilingual v2. Voice and model availability follow your provider account. See the [ElevenLabs speech API](https://elevenlabs.io/docs/api-reference/text-to-speech/convert).

Replay injects recorded status outputs without calling the provider again. Generated bytes are not recorded as take data, so offline take rendering does not recreate this speech. Live output recording includes the routed speech. The native Player and exports do not run host data nodes. Real provider calls require credentials and are not qualified by the fixture suite.

## When to use it

Speak generated words, announce data results, or send spoken material through effects. Connect [LLM chat](https://docs.tune.toys/nodes/ai.chat/) text to read an answer aloud.

## Ports

<!-- ports:start -->

| Port      | Direction | Signal         | Lanes                   |
| --------- | --------- | -------------- | ----------------------- |
| `text`    | Input     | Data (string)  | 1                       |
| `trigger` | Input     | Data (trigger) | 1                       |
| `stop`    | Input     | Data (trigger) | 1                       |
| `audio`   | Output    | Audio          | Inferred from the cable |
| `bytes`   | Output    | Data (bytes)   | 1                       |
| `busy`    | Output    | Data (boolean) | 1                       |
| `done`    | Output    | Data (trigger) | 1                       |
| `error`   | Output    | Data (string)  | 1                       |

<!-- ports:end -->

## Parameters

<!-- parameters:start -->

| Parameter    | Label      | Range      | Default | Unit | Scale  | Notes                                                                                      |
| ------------ | ---------- | ---------- | ------- | ---- | ------ | ------------------------------------------------------------------------------------------ |
| `speed`      | Speed      | 0.7 to 1.2 | 1       |      | linear | Speaking speed; 1 is the normal speed for this voice.                                      |
| `stability`  | Stability  | 0 to 1     | 0.5     |      | linear | Higher values keep the voice more consistent; lower values allow more expression.          |
| `similarity` | Similarity | 0 to 1     | 0.75    |      | linear | How closely generated speech follows the selected voice.                                   |
| `style`      | Style      | 0 to 1     | 0       |      | linear | Style exaggeration for models that support it.                                             |
| `volume`     | Volume     | 0 to 1     | 1       | %    | linear | Playback volume of the generated speech. Stored as a fraction; shown ×100 as a percentage. |

<!-- parameters:end -->

<!-- data:start -->

- `text`: text.
- `voice`: text.
- `model`: text.
- `language`: text.

<!-- data:end -->

`speed` sets speaking speed from 0.7 to 1.2, with 1 normal. `stability` controls consistency; lower values allow more expression. `similarity` controls fidelity to the chosen voice. `style` exaggerates the voice's style where the model supports it. `volume` sets playback level. Settings apply to the next generated clip.

## Tips

- Open the example, set your voice ID, enable ElevenLabs and configure your vault key, then press Play.
- Use a trigger cable to prepare changing text without immediately submitting another paid generation.
- Cable `busy` to an LED and `error` to [Console log](https://docs.tune.toys/nodes/log.console/).

## See also

[Value](https://docs.tune.toys/nodes/data.value/), [LLM chat](https://docs.tune.toys/nodes/ai.chat/), [Gain](https://docs.tune.toys/nodes/std.gain/), [Data cables](https://docs.tune.toys/concepts/data-cables/).
