what are the benefits of use_tts_aligned_transcrip...
# ask-ai
g
what are the benefits of use_tts_aligned_transcript being true? i am using deepgram flux for my turn detection setup purely what are the end user benefits of this flag being true?
t
Thanks for reaching out, Ryan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm glad you asked about the
use_tts_aligned_transcript=True
setting! When you enable this, it helps improve the synchronization between the transcription output and the actual speech timing you see in the frontend. This means the transcribed text matches up more closely with the audio, making your experience much smoother and more natural. For TTS providers like Cartesia or ElevenLabs, it even supports word-level synchronization, while for others like LiveKit Inference, it offers sentence-level alignment. Just a quick heads-up: depending on the TTS provider you’re using, turning on this feature might cause a little loss in the original text formatting. But overall, it’s designed to give you a more cohesive and enjoyable experience. If you have any questions or need help with this, feel free to reach out—I’m here to help! Sources: ElevenLabs TTS plugin guide | LiveKit Docs | Text and transcriptions | LiveKit docs | Cartesia TTS plugin guide | LiveKit Docs
g
what does this alignment mean? can you expand on how this gets sent to the LLM?
t
Let me walk you through how TTS-aligned transcription alignment works—it’s all about making sure the transcribed text matches up perfectly with the timing of the synthesized speech you hear. This way, each word or sentence in the transcript shows up exactly when it’s spoken in the audio. Some providers like Cartesia and ElevenLabs offer word-level alignment, while others, such as LiveKit Inference, provide sentence-level alignment. When you enable
use_tts_aligned_transcript=True
, the TTS system creates a synchronized stream of
TimedString
objects. These contain the text along with start and end timestamps, replacing the original LLM-generated text in the output pipeline. Here’s how it works step-by-step: • The LLM generates a response as a text stream. • This text is sent to the TTS system for audio synthesis. • If alignment is turned on, the TTS system returns both the audio stream and the timestamped text. • The timestamped text then goes through the
transcription_node
, which can process or transform it before sending it to the frontend. • The original LLM-generated text is not shown on the display but may still be used internally to manage the chat context. It’s important to know that the aligned transcription isn’t sent back to the LLM. Instead, it’s forwarded to the frontend at the same time as the audio is generated, ensuring everything stays perfectly in sync in real-time. This really helps improve the user experience by matching the displayed text exactly with the audio playback. Sources: Text and transcriptions | LiveKit docs | Cartesia TTS plugin guide | LiveKit Docs | ElevenLabs TTS plugin guide | LiveKit Docs | examples/voice_agents/structured_output.py | Pipeline nodes and hooks | LiveKit docs