From b005ebd64f402cd1f8f7faafb60264405fdd4cb0 Mon Sep 17 00:00:00 2001 From: chexit Date: Tue, 10 Nov 2026 15:56:38 +0300 Subject: [PATCH] Persist quieter output and open recognition only after speech --- station/main.go | 10 +++++++--- station/pulse.conf | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/station/main.go b/station/main.go index d8c3013..a83eb3c 100644 --- a/station/main.go +++ b/station/main.go @@ -353,10 +353,10 @@ func exchange(url, token string, live *liveReader, fileAudio []byte, threshold f return errMuted } _ = c.SetWriteDeadline(time.Now().Add(15 * time.Second)) - if e = c.WriteJSON(message{Type: "start"}); e != nil { - return e - } if fileAudio != nil { + if e = c.WriteJSON(message{Type: "start"}); e != nil { + return e + } for len(fileAudio) > 0 { n := 3200 if n > len(fileAudio) { @@ -402,6 +402,10 @@ func exchange(url, token string, live *liveReader, fileAudio []byte, threshold f if voiced < 4 { continue } + _ = c.SetWriteDeadline(time.Now().Add(15 * time.Second)) + if e = c.WriteJSON(message{Type: "start"}); e != nil { + return e + } heard = true s = pre } diff --git a/station/pulse.conf b/station/pulse.conf index 97eff8e..cb55da0 100644 --- a/station/pulse.conf +++ b/station/pulse.conf @@ -3,3 +3,4 @@ load-module module-native-protocol-unix socket=/tmp/alice-pulse/native auth-anon load-module module-alsa-sink sink_name=station device=hw:0,0 channels=2 rate=48000 format=s16le tsched=0 load-module module-remap-sink sink_name=music master=station set-default-sink station +set-sink-volume station 39321