Commit Graph
10 Commits
Author SHA1 Message Date
gabby 88700898be voice: hold the wake word until the scheduler reaches a result
Gate the wake word on the scheduler's single slot being free: a wake that
fires while the current request is still running is ignored (traced
voice_wake_blocked), so a second command cannot start mid-run. The gate is
GatewayService.input_ready (False while a run executes, True when idle or
paused for the user's answer), handed to adapters via set_input_ready; the
voice adapter passes it to VoiceDaemon.input_ready.
2026-10-09 23:52:57 +00:00
gabby ff94ea938c voice: require the wake word for every command
Drop the post-reply follow-up window: capture no longer accepts an utterance
without the wake word after a result, so the front end never keeps listening
on its own. Removes follow_up_window_s from the config/README/AGENTS/bootstrap
docs and updates the tests (a reply no longer arms capture).
2026-10-09 22:34:13 +00:00
gabby a388c292bc voice: play a multi-note bling once the utterance is transcribed
Add a configurable cue.submit_notes sequence ([frequency_hz, duration_ms],
spaced by note_gap_ms) played after STT returns text, falling back to the
single submit_frequency beep when empty. Two-note chime shipped as the
default in config.example.json; README + tests updated.
2026-10-09 22:30:07 +00:00
gabby f6ef66b532 voice: tolerate the wake-tail pause; harden the front end
Endpointing fix. The wake detector usually fires inside the wake phrase,
so the first speech captured after it is the phrase's tail (plus the cue
beep echoing back through the mic), not the command. A fixed 500 ms
trailing-silence endpoint then ended the capture during the natural pause
before the command: the utterance held 240-400 ms of speech and STT
returned empty. In a recorded session 18 of 30 wakes dropped the command
that way (only 10 transcribed).

The endpoint now uses a longer silence tolerance (vad.initial_silence_ms,
default 1500) until vad.min_command_ms (default 700) of speech is in
hand, then reverts to vad.silence_ms, so a pause before the command is
tolerated while a real command still ends promptly.

Front-end hardening (the ways it was silently dying or losing work):

- Utterances run on a worker thread, not the audio thread, and a task
  error is traced and spoken rather than propagated, so one bad command
  cannot stop the mic or take the front end down.
- Capture-stream watchdog: read with a timeout and close/reopen the input
  after a sustained stall, so a wedged PortAudio/ALSA callback recovers
  instead of hanging the gateway (traced voice_stream_stalled/reopened).
- faulthandler enabled (CLI + unit) so a fatal signal dumps every
  thread's stack to the journal.
- The scheduler's answer-side entry points (answer, answer_question,
  resolve_repair, answer_approval) are guarded like submit_request: an
  EngineUnavailable is fatal-and-reported and any other resume/repair
  error returns a reply instead of propagating into a front end.
2026-10-09 09:41:00 +00:00
gabby ec39a990e4 voice: default wake word to "Hey Computer", capture command after a pause
openWakeWord ships no "computer" model, so pin a community
openWakeWord-compatible ONNX (Apache-2.0, sha256 in pins.json `wake_word`) and
fetch it into .runtime/voice/wake from scripts/voice-models.py. Its scores run
lower than the official models (~0.26-0.82 on the phrase, <0.02 on negatives),
so the seeded wake.threshold is 0.2 (the official models score ~0.99 at 0.5).

Also fix command capture: after the wake word the daemon now waits
listen_timeout_s (default 3s) for the command's speech to begin instead of
assuming it is glued to the wake word, so a natural pause while the cue beep
plays no longer truncates the command.
2026-10-09 08:19:36 +00:00
gabby b7d405454a voice: add custom Piper voice training pipeline
Record an LJSpeech dataset from the microphone, fine-tune a Piper voice
from the pinned base checkpoint on a GPU host, and verify every take
against its prompt with Whisper before training.

- semif_agent/voice_train.py: neutral, stdlib-only recording helpers
  (LJSpeech dataset writer, prompt loading, WAV I/O, mic-check level
  math, silence-endpointing capture loop) plus transcript-fidelity
  helpers (normalize_text, word_error_rate, compare_transcript).
- scripts/voice-record.py: interactive + hands-free (--speak-prompts /
  --read-prompts) recording; resumes by prompt id and announces how many
  of the 720 prompts remain, so a resume is never mistaken for a rerun.
- scripts/voice-train.sh: piper1-gpl checkout + venv, warmstart
  fine-tune of the pinned medium checkpoint, ONNX export. Handles
  torch>=2.6 weights_only (PosixPath allowlist), the older checkpoint's
  hyperparameters (--model.warmstart_ckpt, not --ckpt_path), the
  espeakbridge in-place dev build, and piper's validation/test splits
  (needed for the default checkpoint callbacks).
- scripts/voice-verify.py: transcribe-and-compare fidelity check
  (empty/mismatch/review/ok), --json report, --from-json + --prune to
  mark bad takes for re-recording without deleting them.
- pins.json: voice block (piper1-gpl ref + medium base checkpoint).
- voice_transport.py: WhisperTranscriber beam_size/vad_filter knobs;
  SoundDeviceAudio.read(timeout=) so a dropped device ends a take
  instead of hanging.
- AGENTS.md: architecture map + roadmap entries; docs/VOICE-TRAIN.md
  the end-to-end guide; tests/test_voice_record.py the helper tests.
2026-10-08 22:37:34 +00:00
gabby 5bb0e9d21d voice gateway: instrument end-to-end latency
Add trace boundaries and timings so the last-word -> first-audio latency can
be split by section:

- voice_transport: emit `voice_speech_end` (the last VAD-speech frame, i.e. the
  true "last word"), `voice_speak_start`, `voice_tts_synth` (Piper duration +
  audio length), and `voice_playback_start` (the instant the first reply
  samples reach the device).
- trace: `TraceLog.append` accepts an explicit `ts` so an event records when it
  happened, not when it was written.
- gateway/voice: trace `gateway_reply_dequeued` at the outbound pump.
- gateway/service: trace `humanize` (duration) and `gateway_reply_queued`; a
  best-effort `_trace` helper tolerates test doubles with no trace log.
- log: persist the engine's per-decision `input_tokens`/`forward_seconds`/
  `total_seconds` (already computed by the backend, previously discarded) into
  the decision row's `extra.timing`.

scripts/voice-latency.py reads data/runs.jsonl and prints a per-interaction
breakdown (endpointing, STT, each SemIf guard, act/assess, humanize, TTS,
playback) plus aggregates.
2026-10-06 22:01:32 +00:00
gabby 172e61e6be voice: add tts volume knob; louder wake cue 2026-10-06 04:52:45 +00:00
gabby d2f9a74bd9 voice: play a beep cue on wake 2026-10-06 04:45:59 +00:00
gabby d25b3259e4 add voice gateway (wake word, speech-to-text, text-to-speech) 2026-10-06 04:32:21 +00:00