What is the use of streaming=True in tts capabilit...
# ask-ai
a
What is the use of streaming=True in tts capabilities?
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.
The
streaming=True
attribute in TTS capabilities indicates whether a Text-to-Speech (TTS) service supports streaming, typically using websockets. If a TTS implementation does not support streaming, attempting to use the
stream()
method will result in a
NotImplementedError
. This allows you to determine if streaming functionality is available for a specific TTS service. Sources: livekit.agents.tts API documentation
a
How is it different from normal TTS streaming?
t
Hey there! Let me break down the
streaming=True
magic for you in a friendly way 😊 The
streaming=True
attribute in TTS (Text-to-Speech) is like having a real-time audio translator that works as you're speaking. Instead of waiting for the whole message to be processed, it starts generating audio chunks right away. Think of it like subtitles appearing while someone is still talking - cool, right? This method uses websockets to send audio frames bit by bit, along with partial text results through the
delta_text
field. The neat part is tracking these pieces with
segment_id
, so you know exactly where in the conversation each audio bit belongs. Fields like
is_final
help signal when a complete thought has been synthesized. Basically, it means you get audio generation happening live, in real-time, as the text is being processed. No more waiting around for the entire script to be ready - you get instant, dynamic audio synthesis! 🎉 Sources: GitHub::livekit::agents | livekit-agents/livekit/agents/tts/tts.py | GitHub::livekit::livekit_composite | livekit/agents/livekit-agents/livekit/...