Microphone selection
Gemini Live — the model that handles live voice sessions — performs best with microphones
that deliver ≥ 16 kHz sample rate and SNR ≥ 65 dB. Below this threshold, transcription
accuracy degrades significantly in noisy environments.
Connecting to the C library
How you wire audio hardware tokiosk-c depends on the interface:
USB microphone (Linux) — the built-in ALSA helper is the simplest path. Pass "default" or
the specific ALSA device name to kiosk_alsa_create():
capture_fn that reads from your DMA ring buffer.
The callback runs on the library’s audio thread and must complete within frame_ms (default 20 ms):
playback_fn that writes PCM to your DAC driver:
kiosk_voice_config_t instead of the ALSA helper. Full callback
signatures and real-time constraints are documented in the
C library reference.
Microphone placement and acoustic treatment
- Distance: Place the microphone 20–50 cm from the speaker’s mouth for countertop kiosks. Drive-through applications may require a directional beamforming array.
- Enclosure: Avoid mounting microphones in fully enclosed plastic casings — resonances colour the signal and reduce STT accuracy. Use a mesh grille.
- Echo cancellation: If your device plays TTS audio through a speaker, the microphone will pick it up and the server-side AEC (Acoustic Echo Cancellation) must remove it. AEC works best when speaker and microphone are on different surfaces of the enclosure. Aim for ≥ 10 dB acoustic isolation.
Speaker and amplifier
For kiosk deployments, a Class D mono amplifier + dedicated speaker gives the best audio
quality at lowest cost. Use an 8 Ω, 5 W speaker for enclosed cabinets; a 4 Ω speaker if heat
dissipation is not a concern.
ALSA configuration for Raspberry Pi
Configure ALSA to use your USB microphone and I²S speaker simultaneously:/etc/asound.conf:
STT accuracy optimisation
STT accuracy optimisation
Sample rate: Capture at 16 000 Hz (16 kHz) or 48 000 Hz. Do not resample from 8 kHz
— low-frequency audio discards speech harmonics critical for STT.Bit depth: 16-bit PCM is sufficient. 24-bit or 32-bit PCM is wasteful over the network
and provides no STT benefit after codec encoding.Noise suppression: Enable hardware noise suppression if your microphone supports it
(many USB conference microphones do). Do not stack software noise suppression on top of
hardware suppression — double-processing degrades the signal.Gain staging: Aim for an average capture level of −12 dBFS during speech, with peaks
below −3 dBFS. Clipping (above 0 dBFS) destroys STT accuracy and cannot be recovered.
Use
alsamixer or amixer to set input gain.Silence and VAD: The Humain server runs voice activity detection (VAD). Do not
gate the microphone client-side — let the server handle VAD. Sending silence between
utterances is expected and has no cost impact.Acoustic echo cancellation: If you implement speaker playback, enable server-side AEC
by setting AudioManager.MODE_IN_COMMUNICATION (Android) or AVAudioSession.mode = .voiceChat (iOS). On embedded Linux, kiosk-c enables AEC automatically when a voice
session is opened with ALSA capture + playback.