feat: Jarvis v2 - CPU optimized always-listening for iMac Ubuntu
- PipeWire/pw-record backend (no PortAudio needed) - tested mic live - VAD: Energy (immediate) + Silero (torch CPU) switchable - Wakeword: openWakeWord TFLite hey_jarvis 0.4 - STT: faster-whisper base int8 CPU - model loads OK on i3 - SpeakerID: ECAPA embeddings + fallback stats, enrollment store - Vision: OpenCV Haar + face_recognition + webcam cam0 640x480 verified - LLM: ollama/qwen2.5:3b, gemini_cli, hermes_api, echo strategies - TTS: Piper + espeak + echo fallbacks - Core pipeline: IDLE -> WAKE -> RECORDING -> STT -> SpeakerID/FaceID fusion -> LLM -> TTS -> followup window - Config via jarvis.yaml, soul.md persona - CLI tools: run, devices, enroll-speaker, enroll-face, test-vad, test-mic - Systemd user service ready - Tested on iMac 2010 i3 550 15GB Ubuntu 26.04 CPU-only
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user