I have an audio problem
# ask-ai
c
I have an audio problem
t
Thanks for reaching out, Joshua. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m sorry you’re having audio trouble. To help quickly, can you tell me: • Where is the problem happening? (browser web app, iOS/Android app, ESP32 device, or server-side agent) • Symptom: no sound out, no mic in, silence warnings, glitches/echo, or sync drift? • When did it start and any recent changes (browser, device, network)? • Any error messages or console logs you see (copy/paste)? • If on hardware: model (ESP32-S3?), speaker/mic connections, GPIO or I2C codec details. With those details I’ll suggest the most relevant troubleshooting steps. Sources: Understanding "silence detected on local audio track" warning | Building a voice agent frontend on custom ESP32 hardware | LiveKit | Building a voice agent frontend on custom ESP32 hardware | LiveKit | Why You Shouldn’t Build Real-Time Voice Agents Directly on Model APIs | Liv... | Build Your First AI Voice Agent in Python: Complete Tutorial | LiveKit, with interactive elements
c
So i am havving audio issues with my AI agents on telephony. It keeps missing user words here and there but then there is this one small difference that I do see in this particular agent. It misses words, sometimes whole sentences and also sometimes after tool calls it does not capture wht the user said. I want to know if this could be the cause of the issues or not it exists in other prod agents that seem to be doing find but sometimes if the caller is on speaker phone its not picking up on what theyre saying and so on agent_session_config (map) discard_audio_if_uninterruptible true (boolean) max_endpointing_delay 1.5 (double) min_consecutive_speech_delay 0 (double) min_endpointing_delay 0.5 (double) min_interruption_duration 0.3 (double) preemptive_generation true (boolean) user_away_timeout 15
t
Thanks — I understand you’re seeing missed words/sentences and failures to capture speech after tool calls for telephony AI agents. I reviewed the
agent_session_config
you shared and this is what’s likely happening and what to try next. What’s likely causing the missed speech • discard_audio_if_uninterruptible = true — when the agent is speaking or a tool call is running and cannot be interrupted, incoming user audio is dropped instead of buffered. This will cause missed words or whole utterances (especially during long TTS/tool responses). • max_endpointing_delay = 1.5s — shorter than the typical default (6s). On telephony or speakerphone calls with longer/hesitant pauses, a short max endpointing delay can cause premature end-of-turn detection and truncated user speech. • preemptive_generation = true and interruption settings — preemptive LLM generation based on interim transcripts can lead to the agent continuing to generate/speak while newer user audio arrives; combined with discarding behavior, that audio can be lost. • min_interruption_duration = 0.3s — low enough to treat brief sounds as interruptions; in combination with the above settings it can create false interruption behavior or missed capture—but it’s less likely to be the primary cause. Recommended quick changes to test 1. Set discard_audio_if_uninterruptible → false to ensure user speech is buffered while the agent/tool is speaking. 2. Increase max_endpointing_delay → 4.0–6.0s to allow for natural pauses on phone and speakerphone calls. 3. Keep preemptive_generation if you need lower latency, but monitor for cases where final transcripts differ from interim ones; consider temporarily disabling it to test if capture improves. 4. If you see missed audio specifically after tool calls, ensure the agent allows interruptions immediately after the tool completes (or call `session.interrupt()`/resume listening flow) so new audio is accepted. 5. Monitor events: track
user_input_transcribed
,
user_state_changed
, and any post-tool-call events to see whether speech is detected but later discarded. If you want, I can: • Provide the exact config snippets to apply those changes. • Explain how to instrument
user_input_transcribed
and
user_state_changed
logging to confirm whether speech is being detected or dropped. Which would you prefer? Sources: Turns overview | LiveKit Documentation | Agent session | LiveKit Documentation | Silero VAD plugin | LiveKit Documentation, with interactive elements
c
mid conversation no tool calls nothing, the agent wil pose a quesation to the user and then they will respond with a single reply. Could this be the root cause? what other settings could cause this agent_session_config (map) discard_audio_if_uninterruptible true (boolean) max_endpointing_delay 1.5 (double) min_consecutive_speech_delay 0.1 (double) min_endpointing_delay 0.4 (double) min_interruption_duration 0.3 (double) preemptive_generation true (boolean) user_away_timeout 15 architecture google_realtime_llm (map) language "en-US" (string) model "gemini-live-2.5-flash-native-audio" (string) realtime_input_config (map) automatic_activity_detection (map) disabled false (boolean) end_of_speech_sensitivity "END_SENSITIVITY_MEDIUM" (string) silence_duration_ms 500 (int64) start_of_speech_sensitivity "START_SENSITIVITY_HIGH" (string) temperature 0.35 (double) vertexai true (boolean) voice "aoede" google_tts (map) language "en-US" (string) voice_name "en-US-Chirp3-HD-aoede" (string) llm_provider "google" (string) tts_provider "google" silence_detection_config (map) check_interval_sec 1 (double) enabled true (boolean) max_silence_checks 3 (int64) silence_threshold_sec 6
t
Thanks — I hear you: the agent asks a question, the user replies with a single utterance mid-conversation (no tool calls), and parts of that reply are sometimes missed. Based on the config you shared, yes — the settings likely explain the behavior. Why this config can drop or truncate single replies • discard_audio_if_uninterruptible = true — buffered user audio is dropped when the agent is speaking or otherwise uninterruptible. That directly explains missed words or whole replies arriving while the agent is in a speaking/processing state. • max_endpointing_delay = 1.5s (low) and min_endpointing_delay = 0.4s — short endpointing windows increase the chance the system treats pauses as end-of-turn and finalizes/acts too early, truncating slower or hesitant phone replies (common on speakerphone). • preemptive_generation = true — starting LLM generation from interim transcripts can make the agent commit to a response before the final user audio arrives; combined with audio-discard behavior this can lose later words. • min_interruption_duration = 0.3s — may ignore very short user replies as interruptions; with the above settings it can contribute to missed captures. Recommended changes to test 1. Set discard_audio_if_uninterruptible → false (prevents dropping user audio while agent/tool is active). 2. Increase max_endpointing_delay → 4.0–6.0s and min_endpointing_delay → 0.5s (allow natural pauses on telephony/speakerphone). 3. Temporarily disable preemptive_generation to see if final transcripts improve capture consistency. 4. Optionally reduce min_interruption_duration → 0.1s if you want shorter interruptions to register. 5. Instrument logging for
user_input_transcribed
and
user_state_changed
to confirm whether audio is detected then discarded or never detected. Quick suggested config snippet to try
Copy code
{
  "discard_audio_if_uninterruptible": false,
  "max_endpointing_delay": 6,
  "min_endpointing_delay": 0.5,
  "min_interruption_duration": 0.1,
  "preemptive_generation": false
}
If you want, I can: • Provide a smaller test plan to A/B the changes (which calls to make, what metrics/events to watch). • Show the exact logging/events to check to confirm whether speech is detected and then discarded or never detected. Which would you like to do next? Sources: Using a transformer to improve end of turn detection | LiveKit | Using a transformer to improve end of turn detection | LiveKit | Turns overview | LiveKit Documentation | Agent speech and audio | LiveKit Documentation | Gemini Live API plugin | LiveKit Documentation, with interactive elements
c
what do these settings exactly do tho?
t
Thanks — I’ll explain each setting you listed and how it affects audio capture and agent behavior. • discard_audio_if_uninterruptible (boolean) ◦ What it does: If true, any user audio arriving while the agent (or a tool) is speaking and cannot be interrupted is dropped instead of buffered. ◦ Effect: Causes missed words/utterances that arrive during agent speech. Set false to preserve and process that audio afterward. • max_endpointing_delay (seconds) ◦ What it does: The maximum time the system will wait after detecting possible end-of-speech before treating the user turn as finished (used for low-confidence cases). ◦ Effect: Lower values make turn endings happen sooner and can truncate hesitant or slow speech; higher values allow longer pauses without cutting the user off. • min_endpointing_delay (seconds) ◦ What it does: The minimum time the system waits (after a confident end-of-speech signal) before ending the user turn. ◦ Effect: Very small values let the agent close a turn quickly when speech looks finished; raising it adds a small safety buffer to avoid premature cutoffs. • min_consecutive_speech_delay (seconds) ◦ What it does: Minimum silence required between consecutive speech segments to consider them separate utterances. ◦ Effect: If set to 0 (or very low), brief pauses are treated as continuation; increasing it forces longer pauses to separate utterances. • min_interruption_duration (seconds) ◦ What it does: Minimum length of user audio needed to count as an interruption of agent speech. ◦ Effect: Higher values ignore short user interjections; lower values allow shorter interruptions to register. If too high, quick replies/backchannels may be missed. • preemptive_generation (boolean) ◦ What it does: Lets the LLM start generating a response from interim (partial) transcripts before the final transcript is available. ◦ Effect: Reduces perceived latency but risks the agent committing to answers that don't reflect the user’s final words; combined with audio-discarding it can cause missed content. • user_away_timeout (seconds) ◦ What it does: Time of silence after which the user is marked “away.” ◦ Effect: A status/timing control; not directly responsible for dropped audio, but long timeouts keep sessions active longer. • realtime_input_config.automatic_activity_detection / start_of_speech_sensitivity / end_of_speech_sensitivity / silence_duration_ms ◦ What they do: Control the model’s VAD behavior: how aggressively it detects speech start/end and how long silence must persist to consider speech finished. ◦ Effect: Higher start sensitivity detects faint/quiet speech sooner; end sensitivity and silence_duration_ms control when speech is considered finished. Mis-tuned values can cause early cutoffs or missed starts, especially on speakerphone or noisy lines. • silence_detection_config (check_interval_sec, max_silence_checks, silence_threshold_sec) ◦ What they do: Periodically check for sustained silence and decide when silence constitutes end-of-turn based on repeated checks and a threshold duration. ◦ Effect: Together with endpointing/VAD settings, these control when turns close. Aggressive settings can finalize turns too quickly. How these interact (summary) • The combination of small endpointing delays, aggressive preemptive generation, and discard_audio_if_uninterruptible=true is the most likely cause of missed words: the agent may start/commit to a response before final user audio arrives, and incoming audio during agent speech can be dropped. • VAD/start/end sensitivity and silence_duration_ms further tune when the system believes speech started or stopped; on telephony/speakerphone you often need more tolerant (longer) endpointing and silence thresholds. If you want, I can map each setting to a recommended value for telephony/speakerphone use and give a short A/B test plan. Which would you prefer? , with interactive elements
c
discard_audio_if_uninterruptible (boolean) ◦ What it does: If true, any user audio arriving while the agent (or a tool) is speaking and cannot be interrupted is dropped instead of buffered. ◦ Effect: Causes missed words/utterances that arrive during agent speech. Set false to preserve and process that audio afterward. so if its speaking it should not be interruptable but it kinda is only
t
Good question — that’s a subtle but important distinction. What
discard_audio_if_uninterruptible = true
actually does • It only drops incoming user audio when the agent (or a running tool/TTS) is in an uninterruptible state. • If the agent is interruptible, incoming audio is accepted and processed even while it’s speaking or generating. Why you might still see “interruptions” • The agent can be speaking yet still be marked interruptible (so user speech interrupts and is captured). That explains why you see interrupts sometimes even with
discard_audio_if_uninterruptible=true
. • Conversely, if the agent briefly flips to uninterruptible during parts of its response (e.g., certain tool calls, scheduled speech, or state transitions), audio arriving in that window will be dropped. What to check next • Confirm the agent’s interruption policy/state during those question→reply interactions (is the agent actually uninterruptible when speaking?). • Look at events/logs around the moment of missed audio: check
user_input_transcribed
,
agent_speaking_started/stopped
, tool-call start/finish, and any
session.interrupt()
or interruption-mode changes. • For a quick test, set
discard_audio_if_uninterruptible = false
and reproduce the case; if misses stop, the flag (or brief uninterruptible windows) were the cause. If you want, I can provide the exact events to log and a short A/B test plan to confirm whether brief uninterruptible windows are dropping audio. Which would you like? , with interactive elements
c
what about a mid conversation yes issue
t
Thanks — I want to make sure I understand the "mid conversation yes" issue so I can give targeted help. Could you clarify what you mean by "mid conversation yes"? For example: • Does the user say a single-word reply like "yes" and the agent misses it entirely, or is the agent cutting off a longer reply that starts with "yes"? • Is this happening on phone calls (PSTN), WebRTC, or both? • Does it happen consistently after the agent asks a question, or only sometimes (e.g., on speakerphone or noisy lines)? • Please share any nearby events/logs around one example: timestamps for when the agent finished speaking, any
user_input_transcribed
events,
agent_speaking_started/stopped
, and whether
discard_audio_if_uninterruptible
was true at that moment. With one concrete example (timestamped logs or a short transcript) I’ll pinpoint which setting is responsible and give exact config changes and test steps. , with interactive elements
c
only pstn if they say yes it does not transcribe that yes but its loud and clear. also same thing some patients are literally yelling. Can code cause this? or are these are these settings
t
Thanks — that’s clear and helpful. Short answer: this is almost certainly configuration/VAD/endpointing behavior rather than arbitrary code—here’s why and what to do next. Why loud single-word PSTN replies like “yes” get missed • Very short utterances can be treated as noise or interruptions by VAD/endpointing logic and thus ignored. • With your current settings, three things make this likely: ◦ `discard_audio_if_uninterruptible = true`: if the agent briefly becomes uninterruptible while speaking or changing state, incoming short audio will be dropped entirely. ◦ Short endpointing windows (
min_endpointing_delay
= 0.4s,
max_endpointing_delay
= 1.5s) and `silence_duration_ms = 500`: the system may classify a short “yes” as part of silence or as an interruption that doesn’t meet thresholds. ◦ `min_interruption_duration = 0.3s`: if the “yes” is shorter than this threshold it may not register as a valid interruption. Could code cause this? • Possible but less likely. Code bugs that: ◦ accidentally mute/unsubscribe the PSTN audio stream, ◦ incorrectly forward or buffer audio chunks, ◦ or drop interim transcripts after tool/LLM state changes could cause misses. But the pattern you describe (short loud words missed, sometimes with yelling) strongly points to VAD/endpointing and discard behavior first. Concrete changes to try (quick A/B) • Set discard_audio_if_uninterruptible: false (preserve audio arriving during agent speech). • Increase endpointing tolerances: ◦ max_endpointing_delay → 4–6s ◦ min_endpointing_delay → 0.5s • Make interruptions easier to register: ◦ min_interruption_duration → 0.08–0.1s ◦ Keep silence_duration_ms at 500ms or increase slightly if false positives occur. • Temporarily disable preemptive_generation to rule out generation/state races. Suggested test plan 1. Apply the changes above in a staging agent. 2. Run 20 PSTN calls with short replies (single words like “yes”, “no”) across handset and speakerphone. 3. Log these events per call: timestamped
agent_speaking_started/stopped
,
user_input_transcribed
(with interim/final), and
user_state_changed
. Note any cases where audio was received but not transcribed vs. never received. 4. Compare hit-rate vs current prod config. If you want, I can: • Provide the exact config JSON to swap in for the test, and • Give the minimal set of event fields to log (names + timestamps) to prove whether audio was dropped vs not detected. Which would you like? , with interactive elements
c
does this work with the realtime models??
t
Yes — these settings still apply with realtime models like
gemini-live-2.5-flash-native-audio
. Key points: • The Gemini realtime model runs its own VAD when
automatic_activity_detection
is enabled, so it will detect start/end of speech using the model-level sensitivities (
start_of_speech_sensitivity
,
end_of_speech_sensitivity
,
silence_duration_ms
). • LiveKit-side settings (endpointing delays,
discard_audio_if_uninterruptible
,
min_interruption_duration
,
preemptive_generation
, silence detection config) still control buffering, interruption behavior, and when turns are finalized. That means audio can be dropped or turned-ending can happen prematurely even if the model’s VAD detected speech. • In practice: the realtime model detects speech, but LiveKit’s discard/endpointing/interruption policy determines whether that detected audio is buffered, transcribed, or discarded. What to do next: • For realtime use (PSTN) try the changes we discussed: set
discard_audio_if_uninterruptible=false
, increase
max_endpointing_delay
to 4–6s, set
min_endpointing_delay
≥0.5s, reduce
min_interruption_duration
to ~0.08–0.1s, and consider disabling
preemptive_generation
for an A/B test. • Instrument logs for
user_input_transcribed
,
agent_speaking_started/stopped
, and model VAD events to see if the model detected speech but LiveKit discarded it. If you want, I’ll give the exact config JSON for the realtime agent and the minimal event fields to log for validation. Which would you prefer? , with interactive elements
c
what are the default values on this please
t
Good question — here are the default values for the key agent_session_config/VAD/endpointing settings you asked about and a one-line note on each. • discard_audio_if_uninterruptible: false ◦ Default preserves user audio that arrives while agent/tool is speaking. • max_endpointing_delay: 6.0 seconds ◦ Max wait for low-confidence end-of-speech before finalizing a turn. • min_endpointing_delay: 0.5 seconds ◦ Minimum wait after confident end-of-speech before ending the turn. • min_consecutive_speech_delay: (varies by integration; commonly 0.0–0.1s) ◦ Minimum silence between successive speech segments to treat them as separate. • min_interruption_duration: 0.3 seconds (common default) ◦ Minimum user speech length to register as an interruption. • preemptive_generation: false ◦ Default off; when enabled the LLM may start generating from interim transcripts. • user_away_timeout: 15 seconds ◦ Time of silence before user is marked “away.” • realtime_input_config.silence_duration_ms: commonly 200–500 ms (provider-dependent; Gemini example you used shows 500ms) ◦ How long silence must persist to consider speech ended for model-side VAD. • VAD defaults (Silero/local): ◦ min_silence_duration ≈ 0.55s, activation_threshold ≈ 0.5 (these affect sensitivity to short/quiet speech). Note: realtime models often run their own server-side VAD (defaults vary by provider). Server-side VAD and LiveKit endpointing settings both affect whether short PSTN replies like “yes” are detected or dropped. Sources: Silero VAD plugin | LiveKit Documentation | How does end-of-utterance detection work in conversations? | xAI Grok Voice Agent API plugin | LiveKit Documentation | Azure OpenAI Realtime API and LiveKit | LiveKit Documentation | OpenAI Realtime API plugin guide | LiveKit Documentation, with interactive elements