Martin 9 жил өмнө
parent
commit
81fa21d543

+ 6 - 2
speech_recognition/__init__.py

@@ -540,7 +540,8 @@ class Recognizer(AudioSource):
 
                 # detect whether speaking has started on audio input
                 energy = audioop.rms(buffer, source.SAMPLE_WIDTH)  # energy of the audio signal
-                if energy > self.energy_threshold: break
+                if energy > self.energy_threshold: 
+                    break
 
                 # dynamically adjust the energy threshold using asymmetric weighted average
                 if self.dynamic_energy_threshold:
@@ -560,7 +561,9 @@ class Recognizer(AudioSource):
                     break
 
                 buffer = source.stream.read(source.CHUNK)
-                if len(buffer) == 0: break  # reached end of the stream
+                if len(buffer) == 0: 
+                    break  # reached end of the stream
+
                 frames.append(buffer)
                 phrase_count += 1
 
@@ -570,6 +573,7 @@ class Recognizer(AudioSource):
                     pause_count = 0
                 else:
                     pause_count += 1
+                
                 if pause_count > pause_buffer_count:  # end of the phrase
                     break
 

+ 0 - 0
speech_recognition/flac-linux-x86_64