What is the difference between synthesizestream an...
# ask-ai
a
What is the difference between synthesizestream and chunkstream class?
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 difference between the SynthesizeStream and ChunkedStream classes lies in their purpose and usage: • ChunkedStream: This is used with the
synthesize()
method when you have a complete text to convert to audio at once. It requires
input_text
at initialization and is not tracked in a collection of streams. • SynthesizeStream: This is used with the
stream()
method for ongoing or real-time text-to-speech conversion. It does not require
input_text
at initialization, is added to a collection of streams, and includes a
_segments_ch
attribute for word streams. Both classes handle text-to-speech conversion but are designed for different use cases in the API. Sources: GitHub::livekit::agents | livekit-plugins/livekit-plugins-playai/livekit/pl...
a
does that mean it directly accepts on streaming input tokens and generates audio in realtime
t
Hey there! So, the SynthesizeStream class is pretty cool - it can actually take streaming text and turn it into audio on the fly. Imagine typing something and hearing it spoken almost instantly! It works with Resemble AI's WebSocket API, which basically means it can break down your text into sentences or words and generate audio in real-time. Super neat, right? Sources: GitHub::livekit::livekit_composite | livekit/agents/livekit-plugins/livekit...