From c31947194e3785ab0f5fe96b1389c1e52abd80b3 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 12 Nov 2025 16:21:20 -0800 Subject: [PATCH] Update icad_tone.py --- etc/icad_tone.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/icad_tone.py b/etc/icad_tone.py index 9beedf5..ef52018 100644 --- a/etc/icad_tone.py +++ b/etc/icad_tone.py @@ -194,6 +194,9 @@ def main(): ) detect_and_alert(audio, SAMPLE_RATE) buffer = buffer[DETECTION_CHUNK:] # keep remainder for next window + # Prevent buffer from growing forever + if buffer.size > DETECTION_CHUNK * 10: + buffer = buffer[-DETECTION_CHUNK*10:] except Exception as e: print(f"Callback error: {e}", file=sys.stderr) try: