Skip to content

True realtime buffer writes/re-writes #219

Description

@cbenz

Problem

When transcription_backend: realtime-ws is used with websocket_provider: elevenlabs and websocket_model: scribe_v2_realtime, hyprwhspr waits for the user to press "stop" before transcribing and injecting text via ydotool. It should inject each committed segment as it arrives from the server, providing real-time dictation.

Root Cause

Two issues in the code:

1. ElevenLabsRealtimeClient never forwards transcripts in real-time

In lib/src/elevenlabs_realtime_client.py, the on_committed_transcript and on_partial_transcript event handlers only store text in internal buffers:

def on_committed_transcript(data):
    text = data.get('text', '')
    with self.lock:
        self._current_transcript = text
        self._committed_segments.append(text.strip())  # stored, never pushed
    self._transcript_event.set()  # only consumed by commit_and_get_text()

There is no set_partial_transcript_callback() implementation, so the partial preview shown in the OSD never receives data for ElevenLabs.

2. Partial preview callback hard-gated to OpenAI only

In lib/src/backends/realtime_ws_backend.py, _is_realtime_whisper_preview_enabled():

def _is_realtime_whisper_preview_enabled(self, provider_id, model_id, realtime_mode):
    return (
        self.config.get_setting('mic_osd_enabled', True)
        and provider_id == 'openai'              # ← only OpenAI
        and model_id == 'gpt-realtime-whisper'
        and realtime_mode == 'transcribe'
        and self._realtime_partial_callback is not None
    )

This means apply_partial_callback() always calls set_partial_transcript_callback(None) for ElevenLabs, clearing any preview.

Expected Behavior

  • Each COMMITTED_TRANSCRIPT from ElevenLabs should be immediately injected via ydotool (real-time dictation)
  • PARTIAL_TRANSCRIPT updates should be forwarded to the OSD for live preview (when mic_osd_enabled)

Environment

  • hyprwhspr 1.37.0-1 (Arch Linux)
  • ElevenLabs API (Scribe v2 Realtime — scribe_v2_realtime)
  • Config: transcription_backend: realtime-ws, websocket_provider: elevenlabs, websocket_model: scribe_v2_realtime

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions