Installation
Install the Stream Cartesia plugin withExample
Check out our Cartesia example to see a working code sample using the plugin, or read on for some key details.Initialisation
The Cartesia plugin for Stream exists in the form of theTTS
class:
To initialise without passing in the API key, make sure the
CARTESIA_API_KEY
is available as an environment variable.
You can do this either by defining it in a .env
file or exporting it directly in your terminal.Parameters
These are the parameters available in the CartesiaTTS plugin for you to customise:Name | Type | Default | Description |
---|---|---|---|
api_key | str or None | None | Your Cartesia API key. If not provided, the plugin will look for the CARTESIA_API_KEY environment variable. |
model_id | str | "sonic-2" | ID of the Cartesia STT or TTS model to use. |
voice_id | str or None | "f9836c6e-a0bd-460e-9d3c-f7299fa60f94" | ID of the voice to use for TTS responses. |
sample_rate | int | 16000 | Sample rate (in Hz) used for audio processing. |
Functionality
Send text to convert to speech
Thesend()
method sends the text passed in for the service to synthesize.
The resulting audio is then played through the configured output track.