flush audio emitter due to slow audio generation ...
# ask-ai
b
flush audio emitter due to slow audio generation what does this message mean? how i can fix this issue for my TTS
t
Thanks for reaching out, Aleh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You’re seeing the message "flush audio emitter due to slow audio generation" when your TTS is not producing audio fast enough for the playback pipeline, so LiveKit is discarding queued audio to avoid backlog/desync. Below are concise actions to fix it. What it means • TTS inference latency is higher than real-time playback consumption, so pending audio frames are flushed (dropped). How to fix (pick applicable options) • Enable low-latency mode (if your TTS plugin supports it) ◦ Example: for Rime use
reduce_latency=True
to skip slow normalization steps (may affect pronunciation). • Increase speech rate ◦ Use a
speed_alpha
or equivalent parameter (e.g.,
speed_alpha=0.9
) to synthesize faster. • Increase audio buffering ◦ Make the AudioSource queue larger so temporary TTS slowness won’t immediately flush: ▪︎ Example: set
queue_size_ms
to a higher value (e.g., 2000 ms). • Use a faster TTS model or provider ◦ Switch to a lower-latency model or provider settings that prioritize speed over fidelity. • Use efficient sample rate/encoding ◦ Lower sample rates (16kHz/24kHz) or simpler encodings reduce generation/processing time. • Make audio generation non-blocking ◦ Ensure TTS synthesis runs asynchronously/streaming so frames are emitted continuously rather than in large blocking chunks. • Monitor and profile TTS ◦ Measure per-step latencies (preprocessing, inference, postprocessing) to find the bottleneck and apply the targeted change above. If you want, tell me: • which TTS plugin/provider and model you’re using, • your sample rate and
queue_size_ms
(or AudioSource settings), and I’ll recommend the most effective single change to try first. Sources: Debugging Audio/Video Sync Issues in LiveKit Publishing | Rime TTS plugin guide | LiveKit Docs | Resolving "InvalidState - failed to capture frame" errors in AudioSource | LiveKit Docs | Agent speech and audio | LiveKit docs
b
for me tts is
Copy code
tts = TTS.with_azure(
    azure_endpoint=azure_openai_tts_settings.endpoint,
    api_key=azure_openai_tts_settings.api_key,
    model=agent_settings.TTS_MODEL,
    azure_deployment=agent_settings.TTS_MODEL,
    voice=agent_settings.TTS_VOICE,
    speed=agent_settings.TTS_SPEED,
    instructions=vibe_instructions,
)
t
Thanks — you’re using Azure TTS. That helps narrow recommendations to lower TTS latency and avoid the "flush audio emitter" drops. Quick targeted steps to try first • Try a faster deployment/model: use an Azure deployment optimized for low-latency TTS or a lighter model variant (prioritize speed over fidelity). • Increase buffering on your AudioSource: raise
queue_size_ms
(e.g., 1000–2000 ms) so temporary synthesis delays don’t trigger flushes. • Raise speech rate slightly: increase
speed
(or use
speed_alpha
if supported) to shorten synthesis time. • Use lower sample rate/encoding if acceptable (16 kHz or 24 kHz, PCM) to reduce processing overhead. • Stream or async synth if possible: ensure your Azure TTS client emits audio chunks as they’re generated instead of waiting for the whole utterance. Two quick diagnostics to tell me next 1. Which Azure deployment/model name are you using for
agent_settings.TTS_MODEL
? 2. What are your AudioSource settings (sample rate,
queue_size_ms
) and the typical utterance length? With those I’ll recommend the single most effective change to try first.