Open andrewjhogue opened 1 month ago
Haven't had this issue on chrome + macbook. WebRTC echo cancellation is typically pretty good. What browser/device are you testing on?
Am running this on the latest Chrome x macbook (Ventura 13).
Haven't had it happen much on our live site yet - seems to be sporadic + happening locally, usually near the beginning of a session.
When using LiveKit agents, sometimes the agent hears its own TTS output (eg via the laptop speakers) which is then interpreted as speech from the user.
This then creates a feedback loop where the agent will then translate + respond a second time to its own speech output.
This only seems to happen when device volume is above ~25-30% and audio is being played through the device speakers.
To provide a seamless UX though, the user shouldn't have to worry about managing volume level in order to prevent this.
My current approach is:
When instantiating a LiveKit room, enabling audioSuppression and echoCancellation, eg:
Enabling allowInterruptions=True in agent.py, eg:
Muting the user's mic on user_speech_committed + agent_started_speaking events, then unmuting on agent_speech_committed event (eg, after the Agent finishes speaking).
Muting the user's mic is a short-term workaround -- the main limitation being that the user can't interrupt the agent once it starts speaking.
Are there best practices for preventing this feedback loop / is this something LiveKit is working on addressing?