fix: iMac mic quiet - arecord raw + 12x software gain, strip WAV RIFF header, wakeword api 0.4.0, STT base.en tests, voiceID Adolfo 0.97 enrolled

This commit is contained in:
Adolfo Reyna
2026-07-10 12:42:50 -04:00
commit af6f926019
47 changed files with 2171 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
# Build PortAudio locally in user space if system lib missing
set -e
cd /tmp
if [ -d portaudio ]; then
echo "portaudio src exists, skipping clone"
else
git clone https://github.com/PortAudio/portaudio.git
fi
cd portaudio
./configure --prefix=$HOME/.local --without-jack
make -j$(nproc)
make install
echo "Installed to ~/.local/lib"
echo "Add to LD_LIBRARY_PATH: export LD_LIBRARY_PATH=\$HOME/.local/lib:\$LD_LIBRARY_PATH"
ldconfig -n $HOME/.local/lib || true
+10
View File
@@ -0,0 +1,10 @@
import sys
from jarvis.cli import main
if len(sys.argv) == 1:
print("Usage: python scripts/enroll_face.py --name NAME")
sys.exit(1)
if sys.argv[1] != "enroll-face" and not sys.argv[1].startswith("--"):
sys.argv.insert(1, "enroll-face")
elif sys.argv[1].startswith("--"):
sys.argv.insert(1, "enroll-face")
main()
+13
View File
@@ -0,0 +1,13 @@
import sys
from jarvis.cli import main
# Pass through args
sys.argv[0] = "jarvis"
if len(sys.argv) == 1:
print("Usage: python scripts/enroll_speaker.py --name NAME --mic")
sys.exit(1)
# ensure first arg is enroll-speaker
if sys.argv[1] != "enroll-speaker" and not sys.argv[1].startswith("--"):
sys.argv.insert(1, "enroll-speaker")
elif sys.argv[1].startswith("--"):
sys.argv.insert(1, "enroll-speaker")
main()
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
set -e
DIR="$(cd "$(dirname "$0")/.." && pwd)"
SERVICE_FILE="$DIR/systemd/jarvis.service"
DEST="$HOME/.config/systemd/user/jarvis.service"
mkdir -p "$HOME/.config/systemd/user"
cp "$SERVICE_FILE" "$DEST"
echo "Reloading systemd user daemon"
systemctl --user daemon-reload
echo "Enabling jarvis service"
systemctl --user enable jarvis.service
echo "To start: systemctl --user start jarvis"
echo "To logs: journalctl --user -u jarvis -f"
echo "To stop: systemctl --user stop jarvis"
+4
View File
@@ -0,0 +1,4 @@
from jarvis.cli import main
import sys
sys.argv = ["jarvis","test-mic"]
main()
+50
View File
@@ -0,0 +1,50 @@
"""Test STT with mic"""
from jarvis.audio.capture import AudioCapture
from jarvis.stt.faster_whisper_engine import FasterWhisperSTT
from jarvis.audio.vad import create_vad
from jarvis.config import load_config
import numpy as np, time, collections
cfg = load_config(None)
vad = create_vad(cfg)
stt = FasterWhisperSTT(model=cfg.get('stt',{}).get('model','base'), device='cpu', compute_type='int8')
cap = AudioCapture()
cap.start()
print("Speak, with 1.5s silence to trigger transcription. Ctrl+C to exit")
buffer = []
silence_start = None
recording = False
try:
while True:
chunk = cap.read(timeout=0.1)
if chunk is None:
continue
is_speech = vad.is_speech(chunk)
if is_speech:
if not recording:
print("Speech start")
recording = True
buffer.append(chunk)
silence_start = None
else:
if recording:
if silence_start is None:
silence_start = time.time()
buffer.append(chunk)
if time.time() - silence_start > 1.2:
# transcribe
audio = np.concatenate(buffer)
print(f"Transcribing {len(audio)/16000:.2f}s...")
res = stt.transcribe(audio)
print(f" => {res.get('text')}")
buffer = []
recording = False
silence_start = None
print("Listening again...")
# else silence, continue
except KeyboardInterrupt:
pass
finally:
cap.stop()
+29
View File
@@ -0,0 +1,29 @@
"""Test wakeword detection without full pipeline"""
from jarvis.audio.capture import AudioCapture
from jarvis.audio.wakeword import WakeWordDetector
from jarvis.audio.vad import create_vad
from jarvis.config import load_config
import time
cfg = load_config(None)
vad = create_vad(cfg)
ww = WakeWordDetector(models=cfg.get('wakeword',{}).get('models',['hey_jarvis']), threshold=0.45)
cap = AudioCapture()
cap.start()
print("Say 'Hey Jarvis'...")
try:
while True:
chunk = cap.read(timeout=0.1)
if chunk is None:
continue
# Optional VAD gate
if not vad.is_speech(chunk):
continue
det = ww.detect(chunk)
if det:
print(f"Wake detected: {det}")
except KeyboardInterrupt:
pass
finally:
cap.stop()