conversation_item_added event sometimes doesn't ha...
# ask-ai
f
conversation_item_added event sometimes doesn't have the right timestamps so the audio and transcript appear out of sync. how to fix this. I'm using that event to generate a transcript of the call.
t
Thanks for reaching out, Amjad. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I understand how frustrating the timestamp issues in the
conversation_item_added
event can be, especially when it affects your audio and transcript sync. Don’t worry, we can work through this together! Here’s a friendly guide to help you resolve it: 1. Try setting
use_tts_aligned_transcript=True
in your
AgentSession
configuration. This step helps ensure that the transcription output matches the actual speech timing more closely. 2. Make sure your TTS provider supports aligned transcripts. You can check this in the plugin documentation or confirm that audio output is enabled in the TTS settings. 3. When you use
playback_ev.synchronized_transcript
from
audio_output.wait_for_playout()
, it provides a transcript that’s correctly timed, which is especially helpful after interruptions. If you still notice issues after these steps, it’s a good idea to double-check that: • Your frontend listener is properly consuming the
conversation_item_added
event. • There aren’t any delays or lost transcription events happening on the backend. • Audio playout hooks are working as expected, and that network latency or any configuration mismatches aren’t causing delays. Please feel free to reach out if you’d like me to walk you through any of these steps or if you have any other questions. I’m here to help! Sources: plugins/openai/src/realtime/realtime_model.ts | Events and error handling | LiveKit docs | Text and transcriptions | LiveKit docs | livekit-agents/livekit/agents/voice/agent_activity.py