From 29389e9ccba8a099f0e7d78babc5e28170b0b2ad Mon Sep 17 00:00:00 2001 From: SevaSk Date: Thu, 1 Jun 2023 14:59:36 -0400 Subject: [PATCH] catch source is none error --- AudioRecorder.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AudioRecorder.py b/AudioRecorder.py index 810bf96..8c09227 100644 --- a/AudioRecorder.py +++ b/AudioRecorder.py @@ -11,6 +11,10 @@ class BaseRecorder: self.recorder = sr.Recognizer() self.recorder.energy_threshold = ENERGY_THRESHOLD self.recorder.dynamic_energy_threshold = DYNAMIC_ENERGY_THRESHOLD + + if source is None: + raise ValueError("audio source can't be None") + self.source = source self.source_name = source_name