mavsttd: silence gate — don't feed non-speech to whisper
Whisper hallucinates subtitle-credit boilerplate ("Редактор субтитров …") on
silence/room-noise, which then got stored as tap:voice facts. Gate before the
model: drop clips shorter than -min-ms (default 300) or below -silence-rms
(default 0.01 normalized RMS). Both are flags — the mic floor is hardware
specific. Returns empty transcript (same as whisper's no-segments path), so
nothing downstream changes.
gateReason is pure and unit-tested (silence/short/quiet → dropped, loud+long →
passes). ponytail: energy gate, not a real VAD; upgrade to WebRTC VAD or
whisper no_speech_prob if too blunt.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -47,6 +47,8 @@ func main() {
|
||||
func run(args []string) error {
|
||||
sock := flag.String("socket", defaultSocket("stt.sock"), "unix socket path")
|
||||
model := flag.String("model", "", "path to whisper ggml model file")
|
||||
minMs := flag.Int("min-ms", 300, "drop clips shorter than this (silence gate); whisper hallucinates on short/quiet audio")
|
||||
silenceRMS := flag.Float64("silence-rms", 0.01, "drop clips with normalized RMS below this (silence gate); tune to your mic floor")
|
||||
flag.CommandLine.Parse(args)
|
||||
|
||||
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
|
||||
@@ -54,7 +56,7 @@ func run(args []string) error {
|
||||
|
||||
var t worker.Transcriber
|
||||
if *model != "" {
|
||||
w, err := newWhisperHandler(*model)
|
||||
w, err := newWhisperHandler(*model, *minMs, *silenceRMS)
|
||||
if err != nil {
|
||||
return fmt.Errorf("whisper: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user