Prerequisites
The following example requires thecartesia library and an API key.
Example
Advanced Example: Translation and Voice Localization
This example demonstrates how to translate text, analyze emotion, localize a new voice, and generate a voice note using CartesiaTools.Toolkit Params
| Parameter | Type | Default | Description | 
|---|---|---|---|
| api_key | str | None | The Cartesia API key for authentication. If not provided, uses the CARTESIA_API_KEYenv variable. | 
| model_id | str | sonic-2 | The model ID to use for text-to-speech. | 
| default_voice_id | str | 78ab82d5-25be-4f7d-82b3-7ad64e5b85b2 | The default voice ID to use for text-to-speech and localization. | 
| text_to_speech_enabled | bool | True | Enable text-to-speech functionality. | 
| list_voices_enabled | bool | True | Enable listing available voices functionality. | 
| voice_localize_enabled | bool | False | Enable voice localization functionality. | 
Toolkit Functions
| Function | Description | 
|---|---|
| list_voices | List available voices from Cartesia. | 
| text_to_speech | Converts text to speech. | 
| localize_voice | Create a new localized voice. |