proud-lawyer-39815
02/24/2026, 1:46 PM<break in python sdk. Also send me a link to the oficial documentationtall-airline-16756
02/24/2026, 1:46 PMtall-airline-16756
02/24/2026, 1:47 PM<break> SSML tag with LiveKit’s Python SDK and point you to the official docs.
Acknowledging your request: you want an example of using <break> in Python and the link to the LiveKit documentation.
Quick facts
• The <break> tag is part of SSML and inserts a pause in synthesized speech.
• Use <break time="Xms"> (milliseconds) or <break time="Xs"> (seconds) inside an SSML <speak> block.
• SSML support depends on the TTS provider/plugin you’ve configured (e.g., Azure, Google, Amazon Polly). Ensure your chosen TTS plugin accepts SSML.
Example usage in Python
1. Prepare an SSML string with `<break>`:
ssml = '<speak>Hello there. <break time="500ms"/> This is a pause of 500 milliseconds.</speak>'
1. Send that SSML to the TTS input the SDK or your configured tts_node expects. The exact call depends on how your app supplies TTS input to LiveKit (for example, overriding a tts_node or sending SSML to the plugin). Conceptually:
# Pseudo-code: adapt to your app's TTS flow
from livekit import TTSClient # replace with your actual import
tts = TTSClient(...)
response_audio = tts.synthesize(ssml=ssml, voice="en-US-Wavenet-D")
# play or stream response_audio into LiveKit
If your app uses a LiveKit TTS plugin or tts_node, provide the ssml string as that node’s input or configuration so the provider receives SSML directly.
What to check if it doesn’t work
• Confirm your TTS provider supports SSML and the <break> tag.
• Make sure you’re sending SSML (not plain text) and the provider is configured to parse SSML.
• Validate the SSML structure (wrap with <speak>).
Official documentation
• LiveKit docs on customizing pronunciation and SSML: https://docs.livekit.io/agents/build/audio/#customizing-pronunciation
If you’d like, tell me:
• Which TTS provider/plugin you’re using (Azure, Google, Amazon, or another), and
• How you’re feeding TTS into LiveKit (direct synth call, tts_node, or plugin configuration),
and I’ll give a concrete code snippet tailored to that setup.
Sources: Agent speech and audio | LiveKit Documentationproud-lawyer-39815
02/24/2026, 1:48 PMtall-airline-16756
02/24/2026, 1:48 PM<speak> tag (used in SSML) was introduced.
The <speak> element is part of the Speech Synthesis Markup Language (SSML). SSML version 1.0 was published as a W3C recommendation on September 7, 2004 — that recommendation is when <speak> became part of the standardized SSML spec.
If you meant something different — for example, when LiveKit’s Python SDK or a specific LiveKit TTS plugin began accepting SSML/`<speak>` — tell me which TTS provider or plugin you’re using (Google, Azure, Amazon Polly, Speechify, Cartesia, etc.) and whether you’re using a tts_node or calling a synth API directly. I’ll then give a concrete, version-specific example or confirmation.
Sources: Agent speech and audio | LiveKit Documentation | Speechify TTS plugin guide | LiveKit Documentation | Cartesia TTS plugin guide | LiveKit Documentation | Modifying LLM output before TTS | LiveKit Documentation | Google Cloud TTS integration guide | LiveKit Documentationproud-lawyer-39815
02/24/2026, 1:49 PMtall-airline-16756
02/24/2026, 1:49 PM<speak> + <break> SSML with Azure Speech in a LiveKit Python flow and show a concrete example.
Before I give code, quick check so I tailor the snippet correctly:
• Are you sending SSML to Azure by configuring a LiveKit `tts_node`/plugin, or are you synthesizing audio with the Azure Speech SDK locally and then streaming the resulting audio into LiveKit?
• Which audio format do you need for LiveKit ingestion (PCM16, opus, etc.), or do you want me to include an example that converts/streams audio?
If you want a quick example right away, here’s a common approach where you synthesize SSML with Azure Speech SDK in Python and then send the audio into LiveKit:
1) Example SSML with a break
• SSML root must be `<speak>`; use <break time="500ms"/> (or "1s") to insert pauses.
<speak>
Hello there. <break time="500ms"/> This is a 500 millisecond pause.
</speak>
2) High-level Python flow (Azure Speech SDK -> audio buffer -> LiveKit)
• Use Azure Speech SDK to synthesize SSML into audio bytes.
• Convert or ensure the audio format LiveKit expects (commonly PCM16 or Opus).
• Stream or publish that audio into your LiveKit room.
Pseudo/illustrative Python (adapt to your project and audio/streaming code):
from azure.cognitiveservices.speech import SpeechConfig, SpeechSynthesizer, AudioDataStream, SpeechSynthesisOutputFormat
from azure.cognitiveservices.speech.audio import AudioOutputConfig
speech_key = "YOUR_AZURE_KEY"
region = "YOUR_AZURE_REGION"
speech_config = SpeechConfig(subscription=speech_key, region=region)
# Choose an output format you can ingest into LiveKit; e.g., raw 16kHz PCM:
speech_config.set_speech_synthesis_output_format(SpeechSynthesisOutputFormat.Riff16Khz16BitMonoPcm)
ssml = """
<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">
Hello there. <break time="500ms"/> This is a 500 millisecond pause.
</speak>
"""
# Use in-memory audio if available; otherwise write to a temp file then read bytes
audio_config = AudioOutputConfig(use_default_speaker=False) # adjust for in-memory if supported
synthesizer = SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)
result = synthesizer.speak_ssml_async(ssml).get()
if result.reason == result.Reason.SynthesizingAudioCompleted:
# get audio data - example using AudioDataStream to save/read bytes
stream = AudioDataStream(result)
stream.save_to_wav_file("output.wav")
# Read "output.wav" bytes, convert if necessary, then send into LiveKit
else:
print("TTS failed:", result.reason)
3) Notes and checks
• Azure Speech supports SSML and `<break>`; use speak_ssml or speak_ssml_async to send SSML.
• Ensure the output audio format matches what LiveKit expects. If LiveKit requires Opus, you’ll need to transcode PCM to Opus before publishing.
• If you configure a LiveKit tts_node plugin that forwards SSML to Azure, pass the SSML string as the node input so the plugin sends SSML directly to Azure (confirm the plugin is set to accept SSML).
Documentation links
• LiveKit docs on SSML/pronunciation: https://docs.livekit.io/agents/build/audio/#customizing-pronunciation
• Azure Speech SSML reference (for tag details including <break>): https://learn.microsoft.com/azure/cognitive-services/speech-service/speech-synthesis-markup
Next steps I can do for you
• Provide a complete, runnable example that:
◦ synthesizes SSML with Azure to PCM in Python, then converts to Opus and publishes to LiveKit; or
◦ shows how to configure a LiveKit tts_node to forward SSML to Azure (if that’s your setup).
• Help with audio format conversion (PCM -> Opus) code snippets.
Which of the next steps would you like me to provide? Also confirm whether you’re using a tts_node plugin or synthesizing locally so I give the right example.proud-lawyer-39815
02/24/2026, 1:50 PMtall-airline-16756
02/24/2026, 1:50 PM<speak> and <break> fit into LiveKit flows, point to the most relevant resources, and offer practical next steps so you can get this working with Azure Speech.
Acknowledgement
• You’re right: LiveKit’s docs don’t enumerate SSML tags like <speak> and <break> line-by-line. LiveKit expects TTS plugins or your own code to send SSML to the underlying TTS provider, so SSML support and exact tag behavior come from the TTS provider (Azure, Google, Amazon, Cartesia), not LiveKit itself.
Key points you can rely on
• <speak> is the SSML root element; it was introduced as part of the W3C SSML 1.0 recommendation (published Sep 7, 2004).
• <break time="500ms"/> or <break time="1s"/> inserts a pause. This is handled by the TTS engine (Azure Speech supports SSML and <break>).
• LiveKit will accept synthesized audio from any TTS provider or plugin. LiveKit itself doesn’t transform SSML — you must send SSML to the provider (either via a LiveKit TTS plugin that forwards SSML, or by synthesizing locally and streaming the resulting audio into LiveKit).
Relevant docs
• LiveKit: Customizing pronunciation / audio agents — https://docs.livekit.io/agents/build/audio/#customizing-pronunciation
• Azure Speech SSML reference (includes <speak> and <break> usage) — https://learn.microsoft.com/azure/cognitive-services/speech-service/speech-synthesis-markup
Concrete next steps I can provide (choose one)
• Option A — A focused, runnable Python example that:
a. Uses Azure Speech SDK to synthesize SSML (with <speak> + <break>) into PCM WAV bytes.
b. Converts or encodes those bytes to the format LiveKit needs (if you tell me which format — PCM16 vs Opus).
c. Publishes the audio into a LiveKit room (using your existing producer/publisher flow).
• Option B — A snippet showing how to pass SSML directly to a LiveKit `tts_node`/plugin (if you use a plugin that forwards SSML to Azure). I’ll show the payload shape you’d send to the node.
• Option C — Troubleshooting checklist and short examples for common failure modes (SSML not parsed, wrong audio format, plugin config issues).
Quick example (Azure Speech SDK -> SSML)
• Example SSML:
<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">
Hello. <break time="500ms"/> This pauses for half a second.
</speak>
• Use Azure’s speak_ssml (or speak_ssml_async) in the SDK to send that string; the Azure engine will synthesize the pause. Then take the returned audio bytes and publish them into LiveKit.
Tell me which option you want and a couple details so I give exactly what you need:
• Are you synthesizing locally with the Azure SDK or using a LiveKit TTS plugin that should forward SSML to Azure?
• What audio format does your LiveKit ingestion expect (PCM16, 16kHz WAV, Opus)?
• If you want a runnable example, do you have an existing LiveKit publisher snippet I should integrate with, or should I provide a minimal end-to-end example?
I’ll prepare the exact code and steps based on your answers.proud-lawyer-39815
02/24/2026, 1:50 PMproud-lawyer-39815
02/24/2026, 1:51 PMtall-airline-16756
02/24/2026, 1:52 PM.say and how it relates to STT vs TTS in your setup (Azure Speech for STT, Cartesia for TTS).
Short answer
• .say is used for TTS (text-to-speech). It tells the system to speak text (or SSML) aloud.
• STT (speech-to-text, e.g., Azure Speech) handles converting spoken audio into text; it does not use .say.
How they fit together in a typical LiveKit flow
• TTS (.say): Your app or a TTS node/plugin receives text (or SSML like `<speak>`/`<break>`) and calls the TTS provider (Cartesia or Azure TTS). The provider returns synthesized audio, and that audio is published into a LiveKit room.
• STT: Audio from a participant is captured and sent to the STT provider (Azure Speech) to produce transcripts. STT is a separate path and doesn’t invoke .say — rather, your app may use STT results to decide whether to call .say (for example, to read back a response).
Example: combining Azure STT + Cartesia TTS conceptually
1. Participant speaks in the LiveKit room.
2. Your app forwards that audio to Azure Speech for STT and receives a transcript.
3. Your app generates a response text (based on transcript, business logic, or an LLM).
4. Your app calls .say (TTS) with the response text or SSML (e.g., with <speak> and <break>), which uses Cartesia to synthesize audio.
5. The synthesized audio is published into the LiveKit room so participants hear it.
Notes and tips
• If you want pauses or prosody control in TTS, send SSML (wrap with <speak>...</speak> and use <break time="500ms"/>) to the TTS provider. Cartesia must accept SSML for that to work.
• If you previously used Cartesia and later switched the TTS provider, ensure whichever TTS plugin/node you use supports SSML and that .say sends the SSML payload (not plain text) when you need SSML behavior.
• Confirm how .say is implemented in your code or plugin: it should forward the text/SSML to the TTS provider and publish the returned audio into LiveKit.
If you want, I can:
• Show a concrete Python example that:
◦ Sends microphone audio to Azure for STT, and
◦ Uses Cartesia via .say (with SSML <speak> + <break>) to synthesize and publish audio back to LiveKit.
• Or show the exact payload shape your .say call should use if you’re invoking a LiveKit tts_node or plugin.
Which would help you most?proud-lawyer-39815
02/24/2026, 1:52 PMtall-airline-16756
02/24/2026, 1:52 PM<speak> because of LiveKit. <speak> is part of SSML (the standard XML wrapper for speech markup) and is required by TTS engines that accept SSML, like Cartesia — not by LiveKit itself.
• LiveKit just transports or plays audio. The TTS provider (Cartesia) expects SSML when you want markup (breaks, prosody, pronunciation). That’s why you send <speak> to Cartesia if you want to use tags like <break>.
Why <speak> matters
• <speak> is the SSML root element that tells the TTS engine “this input is SSML.” Without it, the provider may treat the input as plain text and ignore tags like <break>, <prosody>, or <say-as>.
• Cartesia (and other TTS providers) parse and apply SSML rules. LiveKit does not parse SSML — it only receives audio produced by the TTS provider or audio you push into a room.
Practical implication for your flow
• If you want pauses or other speech controls with Cartesia, wrap your text in <speak>...</speak> and include tags like <break time="500ms"/>.
• Then either:
◦ Send that SSML string to your Cartesia TTS plugin/node so Cartesia synthesizes audio from the SSML and returns audio to publish into LiveKit, or
◦ Synthesize locally with the Cartesia API/SDK (passing SSML) and stream the returned audio into LiveKit.
Example SSML (works with Cartesia if the provider accepts SSML): <speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"> Hello there. <break time="500ms"/> This pauses for half a second. </speak>
Checks to run if things don’t behave as expected
• Confirm Cartesia accepts SSML input and that your .say or TTS-node call is sending SSML (not stripping tags).
• Verify the payload shape your plugin expects (some plugins require a field like ssml vs. text).
• If using a LiveKit TTS plugin, confirm the plugin forwards the raw SSML to Cartesia rather than converting to plain text.
If you want, I can:
• Show the exact payload you should send to Cartesia (or the tts_node) for SSML, or
• Provide a short Python snippet that calls Cartesia with SSML and then publishes the resulting audio into LiveKit.
Which would be most helpful?