From 3911f23954affe909ef82e4db4ab1896cfc7d9fb Mon Sep 17 00:00:00 2001 From: Bytez <25850701+Bytezz@users.noreply.github.com> Date: Mon, 28 Sep 2020 06:04:41 +0200 Subject: [PATCH 1/2] Added verbose option. --- examples/Python/snowboydecoder.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/Python/snowboydecoder.py b/examples/Python/snowboydecoder.py index 5da9aff0..108081b0 100644 --- a/examples/Python/snowboydecoder.py +++ b/examples/Python/snowboydecoder.py @@ -144,7 +144,8 @@ def start(self, detected_callback=play_audio_file, sleep_time=0.03, audio_recorder_callback=None, silent_count_threshold=15, - recording_timeout=100): + recording_timeout=100, + verbose=True): """ Start the voice detector. For every `sleep_time` second it checks the audio buffer for triggering keywords. If detected, then call @@ -208,10 +209,11 @@ def start(self, detected_callback=play_audio_file, self.recordedData.append(data) silentCount = 0 recordingCount = 0 - message = "Keyword " + str(status) + " detected at time: " - message += time.strftime("%Y-%m-%d %H:%M:%S", - time.localtime(time.time())) - logger.info(message) + if verbose: + message = "Keyword " + str(status) + " detected at time: " + message += time.strftime("%Y-%m-%d %H:%M:%S", + time.localtime(time.time())) + logger.info(message) callback = detected_callback[status-1] if callback is not None: callback() From 0bdc85d87710e2453dc3842bdad42dd39b21f795 Mon Sep 17 00:00:00 2001 From: Bytez <25850701+Bytezz@users.noreply.github.com> Date: Mon, 28 Sep 2020 06:08:36 +0200 Subject: [PATCH 2/2] Added verbose option in Python3. --- examples/Python3/snowboydecoder.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/Python3/snowboydecoder.py b/examples/Python3/snowboydecoder.py index 34ee26fb..f5ae08a5 100644 --- a/examples/Python3/snowboydecoder.py +++ b/examples/Python3/snowboydecoder.py @@ -130,7 +130,8 @@ def start(self, detected_callback=play_audio_file, sleep_time=0.03, audio_recorder_callback=None, silent_count_threshold=15, - recording_timeout=100): + recording_timeout=100, + verbose=True): """ Start the voice detector. For every `sleep_time` second it checks the audio buffer for triggering keywords. If detected, then call @@ -212,10 +213,11 @@ def audio_callback(in_data, frame_count, time_info, status): self.recordedData.append(data) silentCount = 0 recordingCount = 0 - message = "Keyword " + str(status) + " detected at time: " - message += time.strftime("%Y-%m-%d %H:%M:%S", - time.localtime(time.time())) - logger.info(message) + if verbose: + message = "Keyword " + str(status) + " detected at time: " + message += time.strftime("%Y-%m-%d %H:%M:%S", + time.localtime(time.time())) + logger.info(message) callback = detected_callback[status-1] if callback is not None: callback()