Skip to main content
Version: v1 (Current)

Live AI Audio Turns and Activity Detection

The current frontend composes useLiveAi, useLiveAiState, useLiveAiSignaling, useLiveAiWebRTC and useLiveAiAudio. The media service owns its provider/session transport. Browser speech detection, provider turn completion and transcript finalization are different mechanisms.

Session flow​

Initialize the permitted project AI/media session, initialize audio and request microphone capture, then establish signaling/WebRTC. The frontend can interrupt playback when speech is detected during the assistant turn. The service/provider determines its supported live input and turn behavior.

The current useLiveAi has transcript-finalization timers; these should not be described as the older exposed silenceThreshold/silenceTimeout API. Inspect the actual composable interface and deployed media/provider configuration before adding a silence timer or calling an assumed turn-complete helper.

Which mechanism controls which result?​

MechanismCurrent source behaviorWhat it does not prove
Browser speech-level detectionuseLiveAiAudio calculates an average frequency-bin level on a 0–100 scale; above 15, no more often than once per 300 ms, it invokes the speech callbackA semantic speech classifier or provider turn completion
Local interruptionuseLiveAi interrupts playback when the callback fires during the assistant turn; input transcription can also trigger interruptionCancellation of all provider generation or durable transcript removal
Browser transcript timeoutuseLiveAi uses a 5,000 ms input/output transcription timeout to append available text to history and clear live textFive seconds of acoustic silence, or provider acknowledgement
Service transcript pauseSessionManager.handleTranscriptionPause uses a 2,000 ms pause between transcript updates to send a completed transcriptionA browser-configurable microphone silence threshold
Provider activity configurationGeminiClient builds automatic activity detection with high start/end sensitivity, 500 ms prefix padding and 1,000 ms silence durationAcceptance of those settings by every provider/model version
Provider turn eventThe media client emits turnComplete from the relevant provider server-content path; the browser consumes turn-complete with role/final textExactly-once transcript delivery or successful storage callbacks

These constants describe the reviewed implementation, not a public configuration API. The browser's frequency level is not decibels or a calibrated noise threshold. Background noise can trigger local interruption, and delayed transcript updates can trigger text finalization independently of microphone activity.

The browser tracks whether its timeout already appended input/output text to avoid adding the same completion immediately again. The level check does not require speech to remain above threshold for 300 ms. interruptPlayback() stops scheduled audio sources, clears that schedule and resets playback timing; it is not a pause/resume promise. Each corresponding transcription update restarts the browser timeout, and subsequent updates/completion paths reset the local flags. This is local UI bookkeeping, not general deduplication across reconnects, callbacks or stored events. Test late final text and interrupted responses explicitly.

Configure and verify​

Use the model/interface and service settings offered for the deployed integration. Test microphone permission denial, quiet speech, background noise, interruption, session expiry and reconnect. Inspect audio capture, network/transport, provider response and transcript state separately. A transcript timeout does not establish that the provider completed an audio turn.

Troubleshooting​

No capture: inspect device permission and audio initialization. No transport: inspect session/signaling/WebRTC state. No response: inspect provider session/input configuration and current turn state. Overlapping audio: inspect interruption/playback handling. Missing or duplicated transcript text: inspect the transcript-finalization and event paths rather than changing model prompts to mask a transport failure.

Detailed production media-service recovery remains in operator runbooks. Use the current Live AI overview and architecture for component responsibilities.