From 6723c9a59e324dd963b0f50d2f512009b55bc163 Mon Sep 17 00:00:00 2001 From: Jeena Date: Fri, 18 Sep 2026 06:50:09 +0900 Subject: [PATCH] whisrs: stream phrases sooner and type slower for TUIs Streaming dictation only emits a phrase after phrase_silence_ms of silence; the 400ms default stalled long continuous speech until the 20s force-split, which read as "the text cuts off". 250ms emits at short breathing pauses instead. key_delay_ms was the 2ms default, which drops characters in busy Node/Ink TUIs like the pi chat while they are streaming output; 10ms keeps dictation readable there. --- hypr/scripts/whisrs-hold-start.sh | 4 +++- hypr/scripts/whisrs-hold-stop.sh | 6 ++++-- whisrs/config.toml | 8 +++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/hypr/scripts/whisrs-hold-start.sh b/hypr/scripts/whisrs-hold-start.sh index bd54b4d..7bf55c0 100755 --- a/hypr/scripts/whisrs-hold-start.sh +++ b/hypr/scripts/whisrs-hold-start.sh @@ -1,4 +1,6 @@ #!/bin/sh # Start dictation only when the daemon is idle. Guards against stray toggle # events (key repeat, re-fired press binds) inverting the recording state. -[ "$(whisrs status 2>/dev/null)" = "idle" ] && exec whisrs toggle \ No newline at end of file +# Logs each invocation to /tmp/whisrs-hold.log for debugging dropped events. +echo "$(date +%H:%M:%S.%N) press status=$(whisrs status 2>/dev/null)" >> /tmp/whisrs-hold.log +[ "$(whisrs status 2>/dev/null)" = "idle" ] && exec whisrs toggle diff --git a/hypr/scripts/whisrs-hold-stop.sh b/hypr/scripts/whisrs-hold-stop.sh index a2f491f..ced13ab 100755 --- a/hypr/scripts/whisrs-hold-stop.sh +++ b/hypr/scripts/whisrs-hold-stop.sh @@ -1,4 +1,6 @@ #!/bin/sh # Stop dictation only when actually recording. If the release bind never -# fires, whisrs' own silence auto-stop (2s) ends the recording instead. -[ "$(whisrs status 2>/dev/null)" = "recording" ] && exec whisrs toggle \ No newline at end of file +# fires, whisrs' own silence auto-stop ends the recording instead. +# Logs each invocation to /tmp/whisrs-hold.log for debugging dropped events. +echo "$(date +%H:%M:%S.%N) release status=$(whisrs status 2>/dev/null)" >> /tmp/whisrs-hold.log +[ "$(whisrs status 2>/dev/null)" = "recording" ] && exec whisrs toggle diff --git a/whisrs/config.toml b/whisrs/config.toml index dd9050e..d5464f1 100644 --- a/whisrs/config.toml +++ b/whisrs/config.toml @@ -1,6 +1,11 @@ [audio] device = "pipewire" +[input] +# pi's Ink TUI drops injected keystrokes while it is busy streaming output; +# raise the inter-key delay so dictation survives that. +key_delay_ms = 10 + [general] backend = "local-whisper" language = "en" @@ -9,4 +14,5 @@ notify = true audio_feedback = true [local-whisper] -model_path = "/home/jeena/.local/share/whisrs/models/ggml-base.en.bin" \ No newline at end of file +model_path = "/home/jeena/.local/share/whisrs/models/ggml-base.en.bin" +phrase_silence_ms = 250 \ No newline at end of file