Snapshot: full project state
This commit is contained in:
24
selftest.py
Normal file
24
selftest.py
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Collector self-test: synthesize a phrase with Piper, transcribe it back with
|
||||
faster-whisper. Proves the STT/TTS audio pipeline end-to-end (no phone needed)."""
|
||||
import sys
|
||||
sys.path.insert(0, "/opt/collector")
|
||||
from app import STT, TTS, CFG
|
||||
|
||||
stt = STT(CFG["stt"])
|
||||
tts = TTS(CFG["tts"])
|
||||
|
||||
print("loading STT (first run downloads whisper model)...")
|
||||
stt.load()
|
||||
print("loading TTS...")
|
||||
tts.load()
|
||||
|
||||
phrase = "This is the collector self test. If you can hear this, the voice pipeline works."
|
||||
pcm16k = tts.synthesize_16k(phrase)
|
||||
print("TTS_OK bytes=%d" % len(pcm16k))
|
||||
|
||||
text = stt.transcribe(pcm16k)
|
||||
print("STT_OK transcript=%r" % text)
|
||||
|
||||
ok = "collector" in text.lower() or "voice" in text.lower() or "hear" in text.lower()
|
||||
print("SELFTEST", "PASS" if ok else "PARTIAL", file=sys.stderr)
|
||||
Reference in New Issue
Block a user