You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Blocks until a hot word, sometimes refered to as a wake word, it found in an audio input.
523
+
524
+
Intended to be used as a means to limit network traffic and reduce cost of online speech-to-text services
525
+
526
+
Currently utilizes the SnowBoy service which is free for hobbiest with a paid option for commerical use.
527
+
528
+
``snowboy_location`` is the local top level directory containing the compiled SnowBoy files.
529
+
530
+
``hot_words`` is an iterable element that contains the local file location of models provided by the SnowBoy service, either .pmdl or .umdl format
531
+
532
+
``source`` is the actual audio input as u
533
+
"""
534
+
assertisinstance(source, AudioSource), "Source must be an audio source"
535
+
assertsource.streamisnotNone, "Audio source must be entered before listening, see documentation for ``AudioSource``; are you using ``source`` outside of a ``with`` statement?"
536
+
assertsnowboy_location!=None, "Need to specify snowboy_location argument if using hot words"
537
+
assertos.path.isfile(snowboy_location+"/snowboydetect.py"), "Can not find snowboydetect.py. Make sure snowboy_location is pointed at the root directory"
538
+
forfinhot_words: assertos.path.isfile(f), "Unable to locate file with given path: {}".format(f)
pause_buffer_count=int(math.ceil(self.pause_threshold/seconds_per_buffer)) # number of buffers of non-speaking audio during a phrase, before the phrase should be considered complete
542
631
phrase_buffer_count=int(math.ceil(self.phrase_threshold/seconds_per_buffer)) # minimum number of buffers of speaking audio before we consider the speaking audio a phrase
543
632
non_speaking_buffer_count=int(math.ceil(self.non_speaking_duration/seconds_per_buffer)) # maximum number of buffers of non-speaking audio to retain before and after a phrase
544
-
search_for_hot_word= (len(hot_words) !=0)
633
+
545
634
546
635
# read audio input for phrases until there is a phrase that is long enough
0 commit comments