Skip to main content
This page explains how the Humain voice pipeline behaves on mobile devices. The concepts here apply to both iOS and Android. For platform-specific setup — AVAudioSession, AudioManager, permission handling — see the iOS guide and Android guide. The WebRTC protocol underlying the voice session is documented in the WebRTC connection guide.

VAD behaviour

Voice Activity Detection (VAD) runs server-side. Your app streams a continuous audio capture to the Humain server — you do not implement push-to-talk or silence detection. The server:
  1. Receives the raw audio stream
  2. Detects when the user starts speaking
  3. Detects end-of-utterance after 600 ms of silence
  4. Streams the accumulated audio to Gemini Live — a single audio-in/audio-out model that handles speech understanding, inference, and voice synthesis natively, with no separate STT or TTS step
  5. Streams the AI’s audio response back to the device
Your app does not need to know about any of these stages — the SDK abstracts them via the VoiceStatus / VoiceStatus enum and the delegate/listener callbacks.
The VAD sensitivity (silence threshold) is configured per kiosk in the admin panel under Kiosk → Voice settings → VAD sensitivity. There is no per-session API to override it.

Barge-in

Barge-in allows the user to interrupt the AI while it is speaking. When the server detects user speech during AI audio playback:
  1. The AI’s audio output is cancelled immediately
  2. The captured speech is processed as a new turn
  3. The VoiceStatus transitions: speaking → listening → processing
Developers do not need to implement barge-in. The SDK handles:
  • Cancelling the current audio playback
  • Resuming microphone capture
  • Notifying the delegate/listener of the status change
The didTranscribe / onTranscript callback fires with the barge-in text, allowing you to update the UI to show what the user said.

Network interruptions

Brief network drops (under 5 seconds) are handled transparently:
  1. The SDK detects the WebRTC connection drop via ICE connection state change
  2. ICE restarts automatically using the existing session credentials
  3. If reconnection succeeds within 5 seconds, the session resumes — no server state is lost; conversation history is preserved
  4. The delegate/listener receives status: .connecting / VoiceStatus.CONNECTING during reconnection
  5. If reconnection fails after 5 seconds, didFailWith error: / onError() is called with a networkError
Your app should:
  • Show a reconnecting indicator when status is .connecting
  • Offer a “Retry” button when didFailWith / onError fires with a network error
  • Call startSession() again to open a new session after a hard failure

Background behaviour

By default, iOS suspends all app threads when the app moves to the background — the voice session stops capturing and streaming audio.To keep a voice session alive in the background:
  1. Add the Audio, AirPlay, and Picture in Picture background mode capability in Xcode
  2. Activate AVAudioSession before the session starts (see iOS audio session)
With the background audio capability, the AVAudioSession remains active and the voice session continues while the app is backgrounded. This is appropriate for AI assistant apps where a conversation must not be interrupted by the user switching apps briefly.Without the capability, the session pauses on backgrounding and resumes on foreground — the server preserves session state for up to 30 minutes.

Battery and performance

The SDK uses the device’s hardware audio codec via AVAudioEngine (iOS) or AudioRecord (Android). The WebRTC stack encodes to Opus at 16 kbps during silence and up to 40 kbps during speech. To minimise battery consumption for long-running deployments (kiosk terminals):
  • Keep the device plugged in
  • Disable screen auto-lock when a session is active (UIApplication.shared.isIdleTimerDisabled = true on iOS; WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON on Android)
  • Use a wired headset or built-in speaker rather than Bluetooth (Bluetooth SCO draws ~30% more power than wired audio)