I have a situation using Cartesia TTS in Livekit C...
# ask-ai
h
I have a situation using Cartesia TTS in Livekit Cloud in my agent. and since my agent streams audio and text in sync, sometimes, specially in longer paragraphs, the voice comes through entirely, but the last 1 or 2 words are not coming through and not showing in the UI. I have the speed of the voice at 1.1. What do you recommend to fix this issue?
t
Thanks for reaching out, Rodrigo. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I hear you’re seeing the final 1–2 words get lost in audio+text when using Cartesia TTS at speed 1.1. Here are concise, prioritized steps to fix and debug this: 1. Enable TTS-aligned transcripts ◦ Set
use_tts_aligned_transcript=True
on your AgentSession to get word-level alignment between audio and displayed text. 1. Ensure transcription sync is on ◦ Confirm
sync_transcription=True
so text advances in lockstep with audio playback. 1. Reduce TTS speed for testing ◦ Lower
speed
to
1.0
or
0.95
temporarily. Faster rates (1.1+) compress timing and often cause the final words to arrive too late for the UI. 1. Verify you’re not closing the stream early ◦ Call
.end_input()
only after the final text chunk is pushed so the TTS pipeline processes the complete input. 1. Add a transcription_node to inspect timings (debug) ◦ Log
TimedString
start/end times to check whether the last words are emitted by TTS but arriving late to the UI. 1. Increase audio buffering if using a custom AudioSource ◦ Use a larger queue (example:
queue_size_ms=2000
) to avoid dropped frames under load. Start with steps 1–3 (enable aligned transcripts, ensure sync, and lower speed). If you’d like, share the AgentSession snippet or the transcription_node logs and I’ll help interpret them. Sources: Text and transcriptions | LiveKit docs | Cartesia TTS plugin guide | LiveKit docs | Resolving "InvalidState - failed to capture frame" errors in AudioSource | Text-to-speech (TTS) models | LiveKit Docs