mirror of
https://github.com/Louis-CFM/coucou.git
synced 2026-12-07 07:32:35 +09:00
EnergyVAD: pure struct with 22-frame fast calibration (~0.5 s), so noisePower converges to ambient before any trigger; max-segment safety (~30 s) forces end if VAD gets stuck; reset() preserves noise floor. Fixes the "deaf after first wake" bug: endCommand now calls resetVAD() and sets voiceSegmentActive=false so the next speech reopens the wake window cleanly. VoiceAudio rebuilt on EnergyVAD; adds resetVAD(), onMicLevel callback (~20 Hz smoothed level, bypass mode only). VoiceEngine: wires onMicLevel → micLevel @Published; endCommand resets VAD+voiceSegmentActive; logs: [Voice] vad start/end, window open/close, wake, command end. BotEngine: enterListening() (jump + permanent wide eyes + head tilt + right hand raised + question sound); exitListening(hadCommand:) (nod + happy eyes, or shrug); per-frame voice-reactive eye/body pulse via listeningLevel; waiting sway + upward look before first word; slow blink ~3 s interval in listening mode; listenHandRaise animated property. BotCanvasView: calls enterListening/exitListening on view change; feeds listeningLevel + listeningHasWords from VoiceEngine each frame. IslandWindowController: removed triggerEmote(.listening) notification (superseded by BotCanvasView onChange). Tests: 8/8 EnergyVAD, 26/26 wake phrase, all island FSM — all pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
12 lines
381 B
Bash
Executable File
12 lines
381 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Energy VAD tests — pure struct, no AVFoundation dependency.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
TEST_DIR="$(mktemp -d "${TMPDIR:-/tmp}/coucou-voice-vad.XXXXXX")"
|
|
trap 'rm -rf "$TEST_DIR"' EXIT
|
|
swiftc \
|
|
NotchBuddy/Sources/App/Voice/EnergyVAD.swift \
|
|
tests/EnergyVADTests.swift \
|
|
-o "$TEST_DIR/energy-vad-tests"
|
|
"$TEST_DIR/energy-vad-tests"
|