Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

fix: don't re-emit hangover frames in VAD pre-roll

CJ Pais7b2a28a30aa2
diff --git a/src-tauri/src/audio_toolkit/vad/smoothed.rs b/src-tauri/src/audio_toolkit/vad/smoothed.rs
index 1ac51cb5..dc3c2005 100644
--- a/src-tauri/src/audio_toolkit/vad/smoothed.rs
+++ b/src-tauri/src/audio_toolkit/vad/smoothed.rs
@@ -81,7 +81,7 @@ impl VoiceActivityDetector for SmoothedVad {
// Collect prefill + current frame
self.temp_out.clear();
- for buffered in self.frame_buffer.iter_mut() {
+ for buffered in self.frame_buffer.iter_mut().filter(|f| !f.emitted) {
self.temp_out.extend(buffered.samples.iter());
buffered.emitted = true;
}