Explorar o código

speech input: enfore min energy threshold of 400

Martin %!s(int64=10) %!d(string=hai) anos
pai
achega
2ad05a0c62
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      voice_control/input_sources/google_cloud_speech.py

+ 2 - 0
voice_control/input_sources/google_cloud_speech.py

@@ -20,6 +20,8 @@ class GoogleCloudSpeech(base.InputSource):
         with sr.Microphone() as source:
             self.recognizer.adjust_for_ambient_noise(source)
 
+        self.recognizer.energy_threshold = max(400, self.recognizer.energy_threshold)
+
         output.debug('sr: recognizer initialized, at energy threshold %i.' % self.recognizer.energy_threshold)
 
     def _recognizer_callback(self, recognizer, audio):