diff --git a/frigate/const.py b/frigate/const.py index 9ebe6b573..3495da28e 100644 --- a/frigate/const.py +++ b/frigate/const.py @@ -14,9 +14,9 @@ BTBN_PATH = "/usr/lib/btbn-ffmpeg" # Audio Consts -AUDIO_DETECTOR = "audio-detector" AUDIO_DURATION = 0.975 AUDIO_FORMAT = "s16le" +AUDIO_MAX_BIT_RANGE = 32768.0 AUDIO_SAMPLE_RATE = 16000 # Regex Consts diff --git a/frigate/events/audio.py b/frigate/events/audio.py index 00e9990db..8e9c711ae 100644 --- a/frigate/events/audio.py +++ b/frigate/events/audio.py @@ -19,6 +19,7 @@ from frigate.config import CameraConfig, FrigateConfig from frigate.const import ( AUDIO_DURATION, AUDIO_FORMAT, + AUDIO_MAX_BIT_RANGE, AUDIO_SAMPLE_RATE, CACHE_DIR, ) @@ -146,7 +147,7 @@ class AudioEventMaintainer(threading.Thread): self.audio_listener = None def detect_audio(self, audio) -> None: - waveform = (audio / 32768.0).astype(np.float32) + waveform = (audio / AUDIO_MAX_BIT_RANGE).astype(np.float32) model_detections = self.detector.detect(waveform) for label, score, _ in model_detections: