can i use custom open source TTS?
# ask-ai
p
can i use custom open source TTS?
t
Thanks for reaching out, Yasser. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Absolutely, you can use a custom open-source TTS solution with LiveKit! While LiveKit offers handy prebuilt plugins for services like Google, Amazon Polly, and Azure, it’s totally flexible and lets you roll your own custom implementations too. To get started with a custom TTS, you’d extend LiveKit's base
TTS
class and implement the methods needed for text synthesis. Here’s a simple example to give you an idea:
Copy code
from livekit.agents import tts

class CustomTTS(tts.TTS):
    def __init__(self, **kwargs):
        super().__init__(sample_rate=24000, num_channels=1)
        # Set up any custom TTS service configurations here

    async def synthesize(self, text: str) -> tts.ChunkedStream:
        # Add your logic to convert text to speech with your custom TTS
        # Don’t forget to return a ChunkedStream with the audio data
        pass
This way, you have the freedom to plug in any TTS service that works best for you. If you want, I’m here to help walk you through the next steps! Sources: Text-to-speech (TTS) integrations | LiveKit Docs