session.mic is the low-level audio input: raw frames, a voice-activity
signal, and the “Hey Mentra” wake word. If you want text, use session.transcription
instead. Reach for mic when you need the audio itself, like recording a clip or
running your own audio processing.
All of these subscriptions need the MICROPHONE permission in your
manifest, or the phone rejects them
with PERMISSION_NOT_DECLARED.
Raw audio
AudioChunkData has:
Voice activity
onVoiceActivity fires when the user starts and stops speaking, without giving
you the audio. The phone runs voice detection on-device and sends one event per
change:
A gap in microphone audio counts as silence, so you still get the “stopped”
event when the glasses stop sending audio during quiet. Silence is reported
after a short pause (a few hundred milliseconds); apply your own longer
end-of-turn rule on top using
silentForMs.
Wake word
onWakeWord listens for “Hey Mentra” on the phone, without sending audio
anywhere:
WakeWordEvent has:
You get the detector’s current state right away, then every change. While any
miniapp subscribes, the phone loads the wake-word model (downloading it first
if needed; it is listed on the phone’s Speech page) and every subscriber
receives every detection. When no miniapp subscribes, the model is unloaded.
These events describe only the wake-word model; for the speech-to-text model,
use
transcription.onModelStatus.
Cleaning up
Every method returns an unsubscribe function, andstop() tears down everything
this module owns:
session.mic.hasPermission reports whether MICROPHONE is declared in your
manifest, not whether the user granted the OS prompt. If they denied it, the
subscription succeeds but no chunks arrive.
mic, transcription, and translation are independent. Subscribing to raw
audio does not give you transcripts, and vice versa. Audio output (playback and
text-to-speech) lives on session.speaker.
