Does TTS only send response when it has received a...
# ask-ai
a
Does TTS only send response when it has received all the text response?
t
Thanks for reaching out, Aditya. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
LiveKit TTS does not wait to receive the entire text response before sending audio. Instead, it supports streaming audio as soon as portions of the text become available. You can push text incrementally to the TTS engine, and audio is generated and streamed back in real-time, often by sentence. This allows users to hear the start of a response while the full text is still being processed, which reduces latency and improves conversational flow. The
SynthesizeStream
class enables this by letting you push text chunks and immediately receive corresponding audio frames as they are synthesized, rather than batching all text first. For TTS providers that do not natively support streaming, LiveKit can also use a
StreamAdapter
to break text into sentences and convert them into audio incrementally, simulating a streaming experience. This streaming approach is used extensively in agent pipelines and real-time conversational AI, ensuring low-latency audio playback as text is generated. Sources: 2d2365ca-8c5f-4f37-910b-28649bb0738d, ec3eed99-8a8c-43e5-8e45-f2058270ce02, fc1fb25e-5944-40df-9860-c42008df9f79 Sources: Live Conversations with AI using ChatGPT and WebRTC | TTS | LiveKit Agents | agents/src/pipeline/agent_output.ts | StreamAdapter | LiveKit Agents
a
It is not sending the text chunks as soon as it is received
t
Hey there! I'd love to help you troubleshoot this. Could you tell me which text-to-speech service you're using right now? Whether it's Google, Deepgram, OpenAI, Cartesia, or Inworld, knowing this will help us pinpoint whether we're dealing with a provider-specific issue or something in the setup. Sources: Speech & Audio Processing | livekit/livekit_composite | DeepWiki | livekit-plugins/livekit-plugins-inworld/livekit/plugins/inworld/tts.py | Live Conversations with AI using ChatGPT and WebRTC