In this guide, we’ll explore how to experiment with different voices online and implement voice switching in your voice bot. We’ll cover two popular text-to-speech (TTS) services: ElevenLabs and Cartesia TTS.

ElevenLabs

ElevenLabs offers a wide range of high-quality voices that you can try out and customize.

Trying Out Voices Online

  1. Visit the ElevenLabs Voice Library.
  2. Browse through the available voices or use the search function to find specific types of voices.
  3. Click on a voice to hear a sample.
  4. Copy the voice ID, which you’ll need for the next step.

Switching Voices in voice_bot.py

To switch voices in your voice bot, you’ll need to modify the voice_id parameter when initializing the ElevenLabsTTS node. Here’s how to do it:

import outspeed as sp

@sp.App()
class VoiceBot:
    async def setup(self) -> None:
        """
        Initialize the VoiceBot.
        """
        # ... existing code ...
        self.tts_node = sp.ElevenLabsTTS(
            voice_id="your_voice_id_here",
        )
        # ... existing code ...

Cartesia TTS

Cartesia AI offers Sonic, a fast and ultra-realistic generative voice API powered by their next-gen state space model.

Trying Out Voices Online

Cartesia provides a demo page for trying out voices once you’ve logged in:

  1. Visit the Cartesia AI website.
  2. Click on the “Log in” button in the top right corner.
  3. If you don’t have an account, you may need to sign up first.
  4. After logging in, navigate to the Library page (the exact location may vary, but it should be accessible from your dashboard).
  5. Click on Default Voices.
  6. Click on a voice to hear a sample.
  7. Copy the voice ID, which you’ll need for the next step.

Switching Voices in voice_bot.py

To switch voices using Cartesia TTS, you’ll need to update the voice_id parameter when initializing the CartesiaTTS node:

import outspeed as sp

@sp.App()
class VoiceBot:
    async def setup(self) -> None:
        """
        Initialize the VoiceBot.
        """
        # ... existing code ...
        self.tts_node = sp.CartesiaTTS(
            voice_id="your_voice_id_here",
        )
        # ... existing code ...