Add stt-server.py and fix setup scripts #1

Merged
mikael-lovqvist merged 6 commits from mikael-lovqvists-claude-agent/stt-server:stt-process into main 2026-06-07 08:51:23 +00:00

Summary

  • stt-server.py: self-contained recording + VAD + transcription process. Replaces the old stdin/stdout transcription-only server. Handles the full pipeline in Python — no Node.js or sherpa-onnx needed. Emits JSON line events to stdout (ready, vad_start, vad_end, transcript, error). Protocol is designed to map directly to WebSocket subscriptions in the next step.
  • Setup scripts: add torch and silero-vad to both installation paths; fix missing faster-whisper deps in local-build path (--no-deps was skipping av etc.); remove Arch Linux specific hints; add PYTHON_ENV, HF_TOKEN_FILE, HF_HUB_CACHE env overrides; remove stray chmod on a file that doesn't exist in this repo.

Test plan

  • ./setup-venv.sh completes without error
  • ./stt-server.py starts, emits {"event": "ready"}, produces transcripts on speech
## Summary - `stt-server.py`: self-contained recording + VAD + transcription process. Replaces the old stdin/stdout transcription-only server. Handles the full pipeline in Python — no Node.js or sherpa-onnx needed. Emits JSON line events to stdout (`ready`, `vad_start`, `vad_end`, `transcript`, `error`). Protocol is designed to map directly to WebSocket subscriptions in the next step. - Setup scripts: add `torch` and `silero-vad` to both installation paths; fix missing faster-whisper deps in local-build path (`--no-deps` was skipping `av` etc.); remove Arch Linux specific hints; add `PYTHON_ENV`, `HF_TOKEN_FILE`, `HF_HUB_CACHE` env overrides; remove stray `chmod` on a file that doesn't exist in this repo. ## Test plan - [x] `./setup-venv.sh` completes without error - [x] `./stt-server.py` starts, emits `{"event": "ready"}`, produces transcripts on speech
mikael-lovqvists-claude-agent added 6 commits 2026-06-07 08:50:59 +00:00
setup-venv.sh: simple PyPI install path — just pip install faster-whisper.
Use this when the PyPI ctranslate2 wheel matches the system CUDA version.

setup-venv-local-build.sh:
- PYTHON_ENV env var for venv path override (consistent with tts-server)
- HF_TOKEN_FILE env var instead of hardcoded path
- HF_HUB_CACHE env var surfaced in output when set
- Remove stray chmod on faster-whisper-server.py (not part of this repo)
- Remove voice-experiment-specific "run with" message
- Add python3 to tool prerequisite check
- Arch Linux package suggestions extended to cover CUDA and python
- Document why each script exists and when to use which

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
--no-deps skipped av and other required packages. Fix by installing
faster-whisper normally first (satisfies all deps, pulls PyPI ctranslate2),
then immediately overriding ctranslate2 with the source-built version.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the old stdin/stdout transcription-only server. Now handles the
full pipeline in Python:
- Launches parec or arecord for mic capture
- Runs Silero VAD (via silero-vad, already a faster-whisper dep — no sherpa-onnx needed)
- Pre-roll ring buffer (0.2s) prepended to each segment for context
- Transcribes with faster-whisper in a separate thread (GPU not blocking VAD)
- Emits JSON line events to stdout: ready, vad_start, vad_end, transcript, error

Event protocol is designed to map directly to WebSocket subscriptions later.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mikael-lovqvist merged commit a4fe95b24a into main 2026-06-07 08:51:23 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: efforting.tech/stt-server#1