Repository navigation
feat(voice): end the capture on silence and keep whisper warm - #37
Merged
Merged
Conversation
A spoken turn was dominated by two waits that had nothing to do with
thinking. Measured on this machine (RTX 4060 / Vulkan, large-v3-turbo):
whisper-cli takes ~880 ms once warm, of which ~610 ms is reloading the
model every single turn — and before that, `record_seconds: 5` made every
turn wait out the full window even for a two-second question.
Both fixes were already half-present. `pylon.local.yaml` has carried a
`voice.stt_server` block for weeks with no Go field to read it, and the
recorder's self-terminating path (commandUsesSeconds) was there but no
default command used it.
Silence-stop: the per-OS default now prefers sox's `silence` effect, which
ends the capture ~1 s after you stop talking; `record_seconds` becomes a
ceiling rather than a fixed wait. sox missing → one log line and the old
fixed window. A configured record_cmd is still used verbatim.
Warm STT: `stt_server.bin` makes the daemon supervise a whisper.cpp server
for its own lifetime (restart on death, SIGINT + Pdeathsig on shutdown) and
transcribe over HTTP. Unreachable server falls back to stt_bin, so a dead
server costs latency, not the feature. Listening on the port only means the
weights loaded — the backend still builds its graph on first inference
(5.0 s here), so startup fires one throwaway clip: first real request went
5050 ms → 150 ms.
Measured end to end with a file-fed recording, warm server: 883-950 ms per
turn against ~5.9 s before.
One trap worth naming: sox reads a bare integer duration as a *sample
count*, so formatting 1.0 as "1" ended the capture after one sample and
clipped the last word ("Hava bugün nasıl?" for "Hava bugün nasıl olacak?").
{silence} always renders with a decimal point now, with a test pinning it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Testing silence-stop against a real microphone turned up two problems the
file-fed runs could not.
The deadline was still `record_seconds + 3s`, inherited from the fixed
window. But a silence-triggered capture waits for the speaker to *begin*,
which is unbounded — so reading the prompt and drawing a breath blew the
deadline and failed the turn with "record: rec: context deadline exceeded".
record_seconds now caps only how long you may talk; starting gets its own
15s grace. A deadline with nothing captured is no longer an error either:
it returns errNoSpeech, which the CLI and the daemon report as the plain
"ses algılanamadı".
The 1% start threshold was picked without measuring. Room noise on this
desk mic peaked at 1.27%, i.e. above it — the capture could trigger on the
room. Measured silence at 3% instead: it never fired across a quiet room,
and speech runs far above it. voice.silence_threshold makes it tunable,
since mic levels vary more than any default can cover.
Worth recording for the next person: input gain dominates all of this. This
mic sat at 51% (-17.56 dB), where speech measured 0.83% RMS against a 0.87%
noise floor — indistinguishable, and whisper answered with its silence
hallucination ("Altyazı M.K."). At 100% the same voice gave 47.5% peak /
4.8% RMS and transcribed cleanly. Both pylon.yaml and the README now say to
check the level before touching a threshold.
NewRecorder took five positional arguments after this; it takes
RecorderOptions now.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
YCistak
added a commit
that referenced
this pull request
Aug 10, 2026
* feat(voice): end the capture on silence and keep whisper warm
A spoken turn was dominated by two waits that had nothing to do with
thinking. Measured on this machine (RTX 4060 / Vulkan, large-v3-turbo):
whisper-cli takes ~880 ms once warm, of which ~610 ms is reloading the
model every single turn — and before that, `record_seconds: 5` made every
turn wait out the full window even for a two-second question.
Both fixes were already half-present. `pylon.local.yaml` has carried a
`voice.stt_server` block for weeks with no Go field to read it, and the
recorder's self-terminating path (commandUsesSeconds) was there but no
default command used it.
Silence-stop: the per-OS default now prefers sox's `silence` effect, which
ends the capture ~1 s after you stop talking; `record_seconds` becomes a
ceiling rather than a fixed wait. sox missing → one log line and the old
fixed window. A configured record_cmd is still used verbatim.
Warm STT: `stt_server.bin` makes the daemon supervise a whisper.cpp server
for its own lifetime (restart on death, SIGINT + Pdeathsig on shutdown) and
transcribe over HTTP. Unreachable server falls back to stt_bin, so a dead
server costs latency, not the feature. Listening on the port only means the
weights loaded — the backend still builds its graph on first inference
(5.0 s here), so startup fires one throwaway clip: first real request went
5050 ms → 150 ms.
Measured end to end with a file-fed recording, warm server: 883-950 ms per
turn against ~5.9 s before.
One trap worth naming: sox reads a bare integer duration as a *sample
count*, so formatting 1.0 as "1" ended the capture after one sample and
clipped the last word ("Hava bugün nasıl?" for "Hava bugün nasıl olacak?").
{silence} always renders with a decimal point now, with a test pinning it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(voice): let the speaker start late, and make the threshold tunable
Testing silence-stop against a real microphone turned up two problems the
file-fed runs could not.
The deadline was still `record_seconds + 3s`, inherited from the fixed
window. But a silence-triggered capture waits for the speaker to *begin*,
which is unbounded — so reading the prompt and drawing a breath blew the
deadline and failed the turn with "record: rec: context deadline exceeded".
record_seconds now caps only how long you may talk; starting gets its own
15s grace. A deadline with nothing captured is no longer an error either:
it returns errNoSpeech, which the CLI and the daemon report as the plain
"ses algılanamadı".
The 1% start threshold was picked without measuring. Room noise on this
desk mic peaked at 1.27%, i.e. above it — the capture could trigger on the
room. Measured silence at 3% instead: it never fired across a quiet room,
and speech runs far above it. voice.silence_threshold makes it tunable,
since mic levels vary more than any default can cover.
Worth recording for the next person: input gain dominates all of this. This
mic sat at 51% (-17.56 dB), where speech measured 0.83% RMS against a 0.87%
noise floor — indistinguishable, and whisper answered with its silence
hallucination ("Altyazı M.K."). At 100% the same voice gave 47.5% peak /
4.8% RMS and transcribed cleanly. Both pylon.yaml and the README now say to
check the level before touching a threshold.
NewRecorder took five positional arguments after this; it takes
RecorderOptions now.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: YCistak <YCistak@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #34, which GitHub closed automatically when its base branch (
feat/voice-buttons, #33) was deleted on merge. Same two commits, rebased onto master.A spoken turn was dominated by two waits that had nothing to do with thinking. Measured here (RTX 4060 / Vulkan,
large-v3-turbo):whisper-clitakes ~880 ms once warm, of which ~610 ms is reloading the model every turn — and before that,record_seconds: 5made every turn wait out the full window even for a two-second question.Both fixes were already half-present in the repo.
pylon.local.yamlhad carried avoice.stt_serverblock for weeks with no Go field to read it, and the recorder's self-terminating path (commandUsesSeconds) existed but no default command used it.Silence-stop
The per-OS default now prefers sox's
silenceeffect, which ends the capture ~1 s after you stop talking.record_secondsbecomes a ceiling on how long you may talk rather than a fixed wait, and starting to speak gets its own 15 s grace. sox missing → one log line and the old fixed window. A configuredrecord_cmdis still used verbatim.Warm STT
stt_server.binmakes the daemon supervise a whisper.cpp server for its own lifetime (restart on death, SIGINT +Pdeathsigon shutdown) and transcribe over HTTP. An unreachable server falls back tostt_bin, so a dead server costs latency, not the feature.Listening on the port only means the weights loaded — the backend still builds its compute graph on the first inference (5.0 s here), so startup fires one throwaway clip.
Measured
Two traps worth naming
sox reads a bare integer duration as a sample count. Formatting
1.0as"1"ended the capture after one sample and clipped the last word — "Hava bugün nasıl?" for "Hava bugün nasıl olacak?".{silence}always renders with a decimal point now, with a test pinning it.Input gain dominates everything. Testing against a real mic, this one sat at 51% (−17.56 dB), where speech measured 0.83% RMS against a 0.87% noise floor — indistinguishable, and whisper answered with its silence hallucination. At 100% the same voice gave 47.5% peak / 4.8% RMS and transcribed cleanly. The 1% start threshold was also picked without measuring; room noise peaked at 1.27%, above it. Now 3% and tunable via
voice.silence_threshold. Bothpylon.yamland the README say to check the level before touching a threshold.Testing
go test ./...(20 new tests ininternal/voice),go vet, gofmt, darwin/arm64 + windows/amd64 cross-compiles, andpylon-uiwith-tags webkit2_41— all clean.Verified live: the warm-server timings above; daemon shutdown really does take
whisper-serverwith it; killing the server mid-session gets it restarted; pointing at a dead port falls back to the CLI and still answers; and a full push-to-talk turn through a real microphone ("Bugün hava nasıl?" → forecast).After rebasing onto master (which now carries #33's hotkey work), a daemon started from
/tmpwas re-checked: config found via~/.config/pylon,hotkey: bağlandı SUPER+P, andstt-serverstarted — the conflict resolution incmdStartkeeps both registrations.CI cannot run: every job fails with "recent account payments have failed or your spending limit needs to be increased", unrelated to this branch.
🤖 Generated with Claude Code