I use multiple fallback providers, how can I confi...
# ask-ai
g
I use multiple fallback providers, how can I configure the TTS node to respect all providers, since they use different SSML rules
t
Thanks for reaching out, Aumesh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Let’s work together to configure the TTS node so it respects multiple fallback providers, each with their own SSML rules. Here’s a friendly overview of how you might approach this: • Extend the
FallbackAdapter
to keep track of which provider is active and dynamically apply the SSML rules specific to that provider. • Create a custom wrapper for each TTS provider to handle the SSML transformations before sending the text along to the provider. • Use these wrappers within your fallback configuration to make sure each provider gets the SSML formatted just right. If you don’t mind sharing which TTS providers you’re working with and the kinds of SSML transformations you need, I’d be happy to offer more tailored advice to help you out. Sources: Cartesia TTS plugin guide | LiveKit Docs | Agent speech and audio | LiveKit Docs | livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/tts.p... | ElevenLabs TTS plugin guide | LiveKit Docs | Google Cloud TTS integration guide | LiveKit Docs
g
I am using Cartesia and Rime
t
I'd be happy to help you configure SSML rules for Cartesia and Rime in your TTS node! Here are some approaches you can try: • Cartesia: It supports standard SSML tags like
<phoneme>
and
<speak>
, which you can use to control pronunciation. Simply wrap your text with these tags before sending it to the TTS engine. • Rime: This one uses bracket notation (for example,
[phonetic]
) for custom pronunciations, but make sure the
phonemizeBetweenBrackets
parameter is enabled. This way, you can directly define phonetic strings within your text. To put this into practice in your TTS node, you might want to create some custom logic that applies different transformations depending on which provider is active. Here's a little example to illustrate:
Copy code
def custom_tts_node(agent, original_tts):
    async def tts_node(text: str):
        if isinstance(original_tts, CartesiaTTS):
            text = f"<speak>{text}</speak>"
        elif isinstance(original_tts, RimeTTS):
            text = text.replace("LiveKit", "[ˈlaɪvkɪt]")
        return await original_tts.synthesize(text)
    return tts_node
If you have any questions or need a hand with the implementation or specific SSML rules, please don’t hesitate to reach out—I’m here to help! Sources: Cartesia TTS plugin guide | LiveKit Docs | livekit-agents/livekit/agents/inference/tts.py | plugins/cartesia/src/tts.test.ts | Rime TTS plugin guide | LiveKit Docs | Agent speech and audio | LiveKit Docs