Revision 1, checked Oct 18, 2026. Installs exactly cartesia 4.2.0, creates the files and adds the key names to your .env. It shows everything first and asks before changing anything.
A short Python script that sends a line of text to Cartesia's Sonic 3.6 text-to-speech model, asks for an excited delivery, and saves the result as output.wav.
The voice ID is Tessa, one of the voices Cartesia lists as having the best emotional response. emotion is a beta control and only works for English. The primary emotions are neutral, calm, angry, content, sad and scared; the full list is on the Volume, Speed, and Emotion page. You can also pass speed (0.6 to 1.5) and volume (0.5 to 2.0) in generation_config.
Test it
Shell
python3 tts_to_file.py
You should see Saved audio to output.wav. Open the file in any audio player, or run ffplay -f wav output.wav if you have FFmpeg.
Not confirmed
The official Generate to File example does not pass generation_config; adding it to generate() comes from the Text-to-Speech (Bytes) API reference and the SDK source, not from a published example.
Cartesia's own quickstart streams audio over a WebSocket and plays it with ffplay; this recipe uses the simpler Generate to File example instead.
The docs say emotion is guidance, not a strict setting, so how strongly "excited" comes through varies by voice and text.
The docs install with pip install --pre cartesia; the pin here is the latest stable PyPI release (4.2.0), while the docs' examples are linked to SDK v4.0.1.
The exact number of free credits per month comes from the cartesia.ai pricing page and may change.