返回
RCreddit.com
20
·11小时前·开发者社区 · RSS

Voice for DeepSeek Harness: the interruption problem, and how I ended up measuring the echo instead of guessing a threshold

查看原文
DeepSeek

热度趋势

趋势数据积累中

百分比基于当前可用热度信号,而非评论数或独立用户人数。

AI 摘要

一位开发者在使用 DeepSeek Harness 进行语音编程时,遇到了一个中断问题:当语音助手朗读回复时,麦克风会捕捉到回放的声音,导致系统误判为新的指令,从而陷入循环对话。为解决此问题,该开发者没有采用固定的音频阈值,而是选择了一种动态测量方法。在每次回复的前 500 毫秒内,麦克风会监听并测量环境中的回声,以此作为基准。只有当音频信号强度超过此基准 3 倍并持续 320 毫秒时,才会被识别为有效语音。这种方法能够自动适应环境变化,例如佩戴耳机或开关门等情况,从而有效避免了误触发。

The problem. I write most of my code by voice. Any hands-free setup has the same failure: while the agent reads its reply aloud, the microphone has to stay open if you want to interrupt — but then the turn detector hears the reply coming out of the speaker, decides it was spoken to, and the thing talks to itself in a loop.

What already existed, and why it didn't fit me. There are good voice plugins for the harness — dsh-voice-mode, dsh-ears, dsh-talk. I studied all three. Two things I couldn't get from them: they're built English-first (reasonable, wrong for me — the browser recogniser mangles Spanish), and all of them solve the echo problem by simply refusing to listen while speaking. Which works, and means you can't interrupt.

What I did. Two parts.

The mic now closes when the first word is actually spoken, not when the message is sent. It was closing at send time, so during a multi-second think there was no echo to defend against and the thing was deaf for no reason.

And for interrupting during playback: I don't guess a threshold. A fixed number is a bet about someone else's room and speakers — too low and it cuts itself off constantly, too high and it never triggers. Instead, the first 500 ms of every reply the mic just listens, and what it hears is the echo, by definition, because nobody has spoken yet. That's the floor. To count as speech, audio has to clear it by 3× and hold for 320 ms. Re-measured per reply, so headphones going on mid-session adapt automatically, and a door slam is too short to trigger it.

Two things that would have made it useless: stopping the current utterance isn't stopping (the read loop starts the next chunk half a second later), and the detector's buffer already contains the echo — so unless you flush it, what you send to Whisper starts with the plugin's own voice.

Eleven tests over the decision logic, including the two that matter: the echo must not trigger it, and neither must a bang.

MIT, dsh-kitt-voice on npm. Source: https://github.com/kittcat-lab/dsh-kitt-voice

Happy to be told the approach is wrong — I've only tested it on my own hardware.

Voice for DeepSeek Harness: the interruption problem, and how I ended up measuring the echo instead of guessing a threshold · BuzzRadr