diff --git a/src/device/input/parse/v01/tts.go b/src/device/input/parse/v01/tts.go index 80112b8..bfc1a33 100644 --- a/src/device/input/parse/v01/tts.go +++ b/src/device/input/parse/v01/tts.go @@ -68,6 +68,9 @@ func (v01 *V01) _tts(text string) error { speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/30)) speaker.Play(&effects.Volume{Streamer: beep.ResampleRatio(4, 1, &beep.Ctrl{Streamer: beep.Loop(1, decoder)})}) duration := time.Duration(decoder.Len()) * format.SampleRate.D(1) - time.Sleep(duration) + select { + case <-v01.ctx.Done(): + case <-time.After(duration): + } return nil }