From 7270eef6bfc099eecfa611f09b3aff7549886d04 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 3 Nov 2023 20:18:23 -0600 Subject: [PATCH] Don't fail on 0 rms (#8447) --- frigate/events/audio.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frigate/events/audio.py b/frigate/events/audio.py index e8f4f6546..3bc80c920 100644 --- a/frigate/events/audio.py +++ b/frigate/events/audio.py @@ -240,7 +240,10 @@ class AudioEventMaintainer(threading.Thread): rms = np.sqrt(np.mean(np.absolute(np.square(audio_as_float)))) # Transform RMS to dBFS (decibels relative to full scale) - dBFS = 20 * np.log10(np.abs(rms) / AUDIO_MAX_BIT_RANGE) + if rms > 0: + dBFS = 20 * np.log10(np.abs(rms) / AUDIO_MAX_BIT_RANGE) + else: + dBFS = 0 self.inter_process_communicator.queue.put( (f"{self.config.name}/audio/dBFS", float(dBFS))