📚 react-agents docsGenerative AI
<TTS>
Add text-to-speech support to your agent.
Import
Usage
The TTS component adds text-to-speech capabilities to your agent, allowing it to speak messages using a specified voice endpoint.
-
Add the component to your agent:
-
Use the
say
action in your agent's responses:Or, simply chat with the agent to get them to speak.
Props
- voiceEndpoint (string, optional)
- Endpoint for the text-to-speech
- Format is
provider:voiceName:voiceId
- If not provided, will use a default voice
Custom voices
You can create and use custom voices with the USDK CLI. The voice commands allow you to manage custom voices for your agents.
Available Commands
-
List voices
- Command:
voice list
- Shows all voices associated with your account
- Displays voice IDs and names for use in voiceEndpoint prop
- Command:
-
Create a voice
- Command:
voice create <name> <audioFile>
- Requirements:
- Audio sample of the voice to clone
- Supported formats: MP3, WAV
- Parameters:
<name>
: Desired name for your voice<audioFile>
: Path to your audio sample
- Command:
-
Test a voice
- Command:
voice play <voiceName> "Your test message"
- Lets you hear how your created voice sounds
- Command:
Using Custom Voices
Once created, use your custom voice in the TTS component by setting the voiceEndpoint prop: