Skip to main content
Generate speech from text and save it as a WAV file.

Prerequisites

For this tutorial, you need a Cartesia API key in your shell environment. Get your API key at https://play.cartesia.ai/keys, then run this command or add it to your .bashrc or .zshrc:

Generate a WAV file

1

Install the SDK

2

Generate speech

generate_speech.py
3

Run it

The voice used above can be found on the playground. Browse more voices at play.cartesia.ai/voices.

What’s next

Text-to-Speech Quickstart

Pipe LLM output to TTS in real time using WebSocket streaming.

Choose a Voice

Browse voices and learn how to pick the right one for your use case.

TTS output audio format

Pick the right output format, sample rate, and encoding for your use case.