Skip to content

Whisper-stream: Add --pausable / -p — live **Pause / Resume** control #3325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bogdoslavik
Copy link

@bogdoslavik bogdoslavik commented Jul 15, 2025

✨ Add --pausable / -p — live Pause / Resume control

Overview

Enabling --pausable lets you temporarily suspend and resume real-time transcription without restarting the program.

Action Stdin command
Pause p followed by a newline (p\n)
Resume r followed by a newline (r\n)

The control thread reads from stdin.
Most terminals add \n automatically when you press Enter, so type p⏎ or r⏎.


Why it matters

  • Pause long sessions to save CPU/GPU and keep the transcript clean.
  • Prevent residual words from the previous utterance from leaking into the next one.
  • Convenient when Whisper is part of an interactive pipeline that needs on-demand control.

Implementation details

  • CLI — new flag --pausable (-p), default off (backward-compatible).
  • Control thread — listens on stdin for p\n / r\n; unknown commands print a warning and are ignored.
  • Pause workflow
    audio.pause();            // stop capture
    audio.clear();            // flush ring buffer
    
    pcmf32.clear();
    pcmf32_new.clear();
    pcmf32_old.clear();
    prompt_tokens.clear();
    
    whisper_reset_timings(ctx);
    t_last = std::chrono::high_resolution_clock::now();
    is_paused = true;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant