Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
p3Priority: Backlog (score <14)
Description
Summary
Revive Modulate (Velma-2) integration as the second STT provider alongside Deepgram, supporting both streaming WebSocket and batch/pre-recorded transcription.
Prior art: PR #5593 (closed 2026-03-17) implemented a working prototype with 32 unit tests. The code was architecturally sound but closed because "modulate is not ready for our high demand." The feature should now be implemented.
Since PR #5593: The backend was simplified on March 28, 2026 — Soniox and Speechmatics were removed, leaving Deepgram as the sole STT provider. The old PR's multi-provider wiring in transcribe.py no longer applies. A fresh implementation against the current single-provider architecture is needed.
Scope
Streaming (WebSocket)
- Add
STTService.modulateenum value - Implement
process_audio_modulate()instreaming.pywith WAV header support, speaker diarization, and preseconds filtering - Wire into
_stream_handler()intranscribe.py(single-channel and multi-channel paths) - Feature-gated via
STT_SERVICE_MODELSenv var (e.g.,modulate-velma-2) - EOS signal + delay before close for final transcript delivery
- Socket interface:
send(),finalize(),finish(),is_connection_dead
Pre-recorded (Batch REST)
- Implement
modulate_prerecorded_from_bytes()inpre_recorded.py - Output format:
[{'timestamp': [start, end], 'speaker': 'SPEAKER_XX', 'text': 'word'}](same as Deepgram) - Speaker ID mapping: Modulate 1-indexed → SPEAKER_XX 0-indexed
- Timestamp conversion: ms → seconds
- Retry with
RuntimeErroron exhaustion (not silent empty return)
Infrastructure
MODULATE_API_KEYenv var + GCP Secret Manager- Helm chart updates: backend-listen, pusher, backend-secrets ExternalSecret
.env.templateupdate- Language routing in
get_stt_service_for_language()with Deepgram fallback for unsupported languages
Tests
- Unit tests: enum, language routing, streaming message parsing, speaker ID mapping, timestamp conversion, preseconds skip, batch API, error handling, WAV header, retry exhaustion
- Integration: verify batch API connectivity with real key (streaming if available)
Architecture Notes
- Current architecture is Deepgram-only (Soniox/Speechmatics removed March 28, 2026)
- Socket interface contract:
send/finalize/finish/is_connection_dead(seeSafeDeepgramSocket) - VAD gate compatibility: new socket should work with
GatedDeepgramSocketwrapper - BYOK: not required for initial launch (Modulate doesn't have per-user key model)
- Default behavior unchanged — Deepgram remains default unless
STT_SERVICE_MODELSincludesmodulate-velma-2
Reference
- Closed PR: Add Modulate (Velma-2) as alternative STT provider #5593
- Closed issue: Add Modulate (Velma-2) as alternative STT provider #5592
- Modulate API: Velma-2 streaming (
wss://modulate-developer-apis.com/api/velma-2-stt-streaming) and batch (POST /api/velma-2-stt-batch)
Metadata
Metadata
Assignees
Labels
p3Priority: Backlog (score <14)
Activity
feat(stt): add Modulate Velma-2 as second STT provider (#7140) (#7142)