bland-airplane-60910
08/20/2025, 7:45 AMtall-airline-16756
08/20/2025, 7:45 AMtall-airline-16756
08/20/2025, 7:46 AMtts=tts.StreamAdapter(
tts=openai.TTS(),
text_pacing=True, # use the default pacer configuration
)
1. Or, if you want to customize it:
tts=cartesia.TTS(
text_pacing=tts.SentenceStreamPacer(
min_remaining_audio=3.0,
max_text_length=300,
)
)
This method buffers sentences, keeps an eye on how much audio is left, and sends batches when the thresholds are met. It really helps make the TTS output smoother and more efficient.
If you want a hand setting this up or have any questions, just let me know—I’m here to help!
Sources: livekit-agents/livekit/agents/tts/stream_adapter.py | Live Conversations with AI using ChatGPT and WebRTC | Voice Assistants | livekit/livekit_composite | DeepWiki