Skip to content

Voice input and speech output

PHOS has separate paths for microphone input and spoken output. Voice input captures one finite session, transcribes it, and can resolve a small exact English/Italian command list. It is not continuous listening or general conversation. A microphone, an available speech-to-text provider and explicit configuration are required. The supplied configuration disables voice and command execution.

The Web Admin Voice & Speech page configures providers and reports whether they are configured and active. It does not expose a microphone Listen button. A client must start the finite session through the supported Voice API; see the voice API reference. After an utterance, PHOS returns to idle. A phrase outside the exact command list is unresolved; an unavailable STT provider cannot transcribe it.

Speech output is separate: it needs an enabled text-to-speech provider and an audio output device. Voice-command actions are silent. Sensor-query replies can be spoken only when response speech is enabled and TTS/playback is available. External agents can request speech through their supported integration, but that is optional. Cloud providers require network access and credentials; local Vosk/Piper paths need their software/model assets. Not all voice functions operate offline. See Voice Commands for exact phrases and expected results, and Web Admin for configuration changes.

For a direct spoken phrase, an authenticated client can submit text to POST /api/v1/speak; PHOS synthesizes and plays it through the configured TTS and audio-output path. The Web Admin does not currently have a Speak control. See Speak in the Remote API guide for limits and expected responses.

Provider and audio details

Voice is disabled by default. Local Vosk uses a separately installed model; PHOS does not download one at startup. Cartesia Ink is an optional batch STT provider. Local/Piper, Cartesia and ElevenLabs provide supported TTS paths. Provider availability is shown in Web Admin; selecting an unavailable provider does not guarantee a fallback. Activation failure retains the prior working provider/configuration. See the hardware guide for microphone and output requirements.

Privacy and known limitations

Raw audio is not persisted by the normal capture path, exposed through the API or sent through the event stream. Local Vosk has been exercised on Raspberry Pi 3, but longer phrases and non-native English accents can be poor. Voice recognition failure, unsupported wording, missing model assets or unavailable providers can result in no command. Wake words, continuous listening and conversational LLM operation are not implemented. Completed transcript text is currently written to the runtime log at INFO level and the last transcript is available through the authenticated voice status API. Treat those logs and status responses as sensitive; redact transcript text before sharing diagnostic output. Optional audio debug dumps are separate and disabled by default.

Troubleshooting

Symptom Check Supported action and expected result
A listening session cannot start Check Voice & Speech configuration and the authenticated Voice API status (enabled, state, stt_available, last_error). The Web Admin has no Listen button. Start a finite session through the supported Voice API. A disabled voice path, unavailable STT provider or unavailable capture device is reported as an error rather than continuous listening. See Voice capture.
A session completes without a transcript Check the Voice API state and last_error. An empty recognizer result is last_transcript: null without a provider error; audio shorter than the configured minimum emits voice_empty_utterance; capture/provider failure emits voice_error. Confirm the selected microphone and active STT provider/model or cloud prerequisites. An empty result does not imply a PHOS defect by itself.
A transcript appears but no local command runs The resolver accepts only the documented deterministic phrase catalog, and command execution is separately opt-in. Use an exact supported phrase and check that command execution is enabled. PHOS does not send unresolved speech to a general conversational model.
A speech request is accepted but nothing is heard POST /api/v1/speak returning 202 means the runtime accepted and scheduled the utterance; it does not confirm synthesis or playback completion. Check the configured/active TTS provider and audio output, then consult sanitized runtime logs. Resolve the indicated provider or output availability issue. 409 tts_busy means PHOS is already speaking; 503 tts_unavailable means TTS is disabled or unavailable. See Speak and TTS diagnostics.

Do not include transcript text, credentials, raw audio, or debug WAV data in a public issue. See contribution reporting guidance and the repository security policy.

Technical reference

The details below describe provider selection and diagnostics for maintainers and advanced operators; most users can begin with the instructions above.

An explicit, finite microphone session negotiates a supported native 16-bit mono device rate, then resamples the bounded utterance to 16 kHz for VAD and STT. During temporary physical STT debugging, opt in to voice.debug.dump_utterance_wav; the most recent submitted utterance is overwritten at voice.debug.utterance_wav_path (default /tmp/phos-last-utterance.wav). It is temporary diagnostic output, not permanent storage.

Voice is disabled by default. Enable voice.enabled, select an ALSA device, and configure a local Vosk model directory under voice.stt.model_path. Vosk is optional (pip install vosk); PHOS never downloads a model at startup. Without the dependency or model, status reports the provider unavailable.

voice.stt.provider defaults to local, which means offline Vosk and remains the behavior for existing installations. cartesia is an opt-in batch Ink STT adapter using the existing Cartesia credential; its non-secret model, language, and 16 kHz sample rate live under voice.stt.cartesia. Voice & Speech applies supported provider changes live after candidate activation succeeds; there is no streaming Cartesia STT: PHOS's existing VAD, utterance limits, and pre-roll remain authoritative. An explicitly selected unavailable Cartesia provider is reported unavailable; PHOS never silently falls back to Vosk. An active capture keeps its original provider; subsequent sessions use the replacement. Failed activation retains the prior provider/configuration, and Web Admin distinguishes configured from active state.

voice.input.sample_rate is the optional requested hardware rate; if it is unsupported, PHOS tries the selected device's default rate, then 44.1/48 kHz, before reporting unsupported_capture_rate. voice.processing.sample_rate is strictly 16 kHz. Set voice.input.device to a stable substring such as USB PnP Sound Device: Audio; device_index is optional diagnostics/fallback, not a stable hardware identity.

The explicit API session transitions IDLE → LISTENING → THINKING → IDLE. SSE emits lifecycle edges such as voice_speech_started and voice_transcription_completed. /api/v1/speak uses a TTS provider and audio output provider. When enabled through interaction.response_tts_enabled, completed temperature and air-quality query responses may use that same speech path; actions and unresolved input remain silent. Wake words, continuous listening, LLM conversation and speaker identification remain deferred.

During an active capture session, PHOS writes a rate-limited VOICE VAD LEVEL diagnostic at most once per 500 ms. It reports only calculated RMS/peak levels from the canonical 16 kHz PCM16 frame, never audio samples. voice.vad.threshold uses the same signed 16-bit PCM amplitude scale as audioop.rms (roughly 0–32768), not decibels; the VAD regards a frame as speech when its RMS is at least the configured threshold.

For physical microphone validation, capture also logs its start/device/stream lifecycle and a rate-limited VOICE AUDIO FRAME line at most once per 500 ms. The line contains only delivered byte length plus capture and processing rates; it never logs raw PCM. The first blocking hardware read additionally logs VOICE AUDIO READ: waiting and its received byte count. Read failures are logged with VOICE AUDIO ERROR: stage=read.

Before VAD speech start, PHOS retains the bounded voice.vad.pre_roll_ms processed-PCM pre-roll (300 ms by default) to preserve the beginning of an utterance. Immediately before local STT it logs whole-utterance duration, byte length, RMS and peak, conditionally writes the temporary WAV debug dump, and logs the provider's raw text, confidence and language result.

Raspberry Pi 3 physical baseline and benchmark

Slice 3 is physically validated with a USB microphone on Raspberry Pi 3: 44.1 kHz mono PCM16 PyAudio capture is resampled once to 16 kHz mono PCM16, then passes through energy VAD (threshold 50), 300 ms pre-roll and the local models/vosk/vosk-model-small-en-us-0.15 English model. Model files are not committed. This small Vosk model validates the offline, provider-independent STT architecture; longer phrases and non-native English accents can be poor.

For a manual benchmark, restart PHOS and test: Hello, How are you, Hello PHOS, This is a test, What time is it, and Turn on the light. Record the expected phrase, transcript, VOICE STT: completed duration, and a success, partial or poor rating. Confirm silence does not activate VAD, speech onset is not clipped, and inspect /api/v1/voice (or optionally the one debug WAV).