can i use SSML with google studio TTS plugin and a...
# ask-ai
b
can i use SSML with google studio TTS plugin and a stream response?
t
Thanks for reaching out, Antonio. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I understand that you’re looking to use SSML with the Google Cloud TTS plugin in LiveKit during streaming responses. Currently, SSML isn’t supported in streaming mode with this plugin—it works great for non-streaming synthesis, but if you try to enable SSML while streaming, it will unfortunately raise an error. If SSML with streaming is important for your project, you might want to explore other TTS providers like ElevenLabs or Amazon Polly, which do support SSML in streaming scenarios. I hope this helps, and please feel free to reach out if you have any more questions or need further guidance! Sources: livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/tts.p... | Google Cloud TTS integration guide | LiveKit Docs | ElevenLabs TTS plugin guide | LiveKit Docs | Amazon Polly TTS plugin guide | LiveKit Docs
b
how can i implement it in elevenlabs?
t
I'm happy to guide you through implementing SSML with the ElevenLabs TTS plugin in LiveKit. Just follow these simple steps: 1. Install the ElevenLabs Plugin: You can use the package manager that works best for you:
uv add "livekit-agents[elevenlabs]~=1.2"
(Python)
pnpm add @livekit/agents-plugin-elevenlabs@1.x
(Node.js) 2. Set Authentication: Make sure to provide your ElevenLabs API key by setting the
ELEVEN_API_KEY
environment variable in your
.env
file. This helps keep your credentials safe! 3. Enable SSML Parsing: When you create the TTS instance, just set
enable_ssml_parsing=True
(Python) or
enableSsmlParsing: true
(Node.js). Here's how it looks: Python: `from livekit.plugins import elevenlabs tts_instance = elevenlabs.TTS( voice_id="ODq5zmih8GrVes37Dizd", model="eleven_multilingual_v2", enable_ssml_parsing=True )`*Node.js:*
Copy code
import * as elevenlabs from '@livekit/agents-plugin-elevenlabs';

const ttsInstance = new elevenlabs.TTS({
    voice: { id: "ODq5zmih8GrVes37Dizd" },
    modelID: "eleven_multilingual_v2",
    enableSsmlParsing: true
});
4. Use SSML in Text Input: Simply include SSML tags like
<prosody>
,
<break>
, or
<emphasis>
in your text. The plugin will beautifully interpret these to enhance the speech output. If you have any questions or need a hand with anything else, please don’t hesitate to reach out. I’m here to help! Sources: ElevenLabs TTS plugin guide | LiveKit Docs | livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/__ini... | README.md