Fix wake up
parent
d122eabc7d
commit
e11bb52853
|
@ -27,7 +27,8 @@ from requests.exceptions import ConnectionError
|
|||
|
||||
import mycroft.dialog
|
||||
from mycroft.client.speech.mic import MutableMicrophone, ResponsiveRecognizer
|
||||
from mycroft.client.speech.recognizer.pocketsphinx_recognizer import PocketsphinxRecognizer
|
||||
from mycroft.client.speech.recognizer.pocketsphinx_recognizer \
|
||||
import PocketsphinxRecognizer
|
||||
from mycroft.configuration import ConfigurationManager
|
||||
from mycroft.messagebus.message import Message
|
||||
from mycroft.metrics import MetricsAggregator
|
||||
|
@ -113,8 +114,7 @@ class AudioConsumer(Thread):
|
|||
|
||||
# TODO: Localization
|
||||
def wake_up(self, audio):
|
||||
if self.wakeup_recognizer.is_recognized(audio.frame_data,
|
||||
self.metrics):
|
||||
if self.wakeup_recognizer.found_wake_word(audio.frame_data):
|
||||
SessionManager.touch()
|
||||
self.state.sleeping = False
|
||||
self.__speak(mycroft.dialog.get("i am awake", self.stt.lang))
|
||||
|
@ -217,13 +217,15 @@ class RecognizerLoop(EventEmitter):
|
|||
wake_word = self.config.get('wake_word')
|
||||
phonemes = self.config.get('phonemes')
|
||||
threshold = self.config.get('threshold')
|
||||
return PocketsphinxRecognizer(wake_word, phonemes, threshold, rate, lang)
|
||||
return PocketsphinxRecognizer(wake_word, phonemes,
|
||||
threshold, rate, lang)
|
||||
|
||||
def create_wakeup_recognizer(self, rate, lang):
|
||||
wake_word = self.config.get('standup_word', "wake up")
|
||||
phonemes = self.config.get('standup_phonemes', "W EY K . AH P")
|
||||
threshold = self.config.get('standup_threshold', 1e-10)
|
||||
return PocketsphinxRecognizer(wake_word, phonemes, threshold, rate, lang)
|
||||
return PocketsphinxRecognizer(wake_word, phonemes,
|
||||
threshold, rate, lang)
|
||||
|
||||
def start_async(self):
|
||||
"""
|
||||
|
|
|
@ -379,7 +379,8 @@ class ResponsiveRecognizer(speech_recognition.Recognizer):
|
|||
if buffers_since_check > buffers_per_check:
|
||||
buffers_since_check -= buffers_per_check
|
||||
audio_data = byte_data + silence
|
||||
said_wake_word = self.wake_word_recognizer.found_wake_word(audio_data)
|
||||
said_wake_word = \
|
||||
self.wake_word_recognizer.found_wake_word(audio_data)
|
||||
# if a wake word is success full then record audio in temp
|
||||
# file.
|
||||
if self.save_wake_words and said_wake_word:
|
||||
|
|
|
@ -24,7 +24,8 @@ from os.path import dirname, join
|
|||
from speech_recognition import WavFile, AudioData
|
||||
|
||||
from mycroft.client.speech.listener import AudioConsumer, RecognizerLoop
|
||||
from mycroft.client.speech.recognizer.pocketsphinx_recognizer import PocketsphinxRecognizer
|
||||
from mycroft.client.speech.recognizer.pocketsphinx_recognizer \
|
||||
import PocketsphinxRecognizer
|
||||
from mycroft.stt import MycroftSTT
|
||||
|
||||
__author__ = 'seanfitz'
|
||||
|
@ -58,7 +59,8 @@ class AudioConsumerTest(unittest.TestCase):
|
|||
self.consumer = AudioConsumer(
|
||||
self.loop.state, self.queue, self.loop, MycroftSTT(),
|
||||
PocketsphinxRecognizer(self.loop.wakeup_recognizer.key_phrase,
|
||||
self.loop.wakeup_recognizer.phonemes, "1e-16"),
|
||||
self.loop.wakeup_recognizer.phonemes,
|
||||
"1e-16"),
|
||||
self.loop.mycroft_recognizer)
|
||||
|
||||
def __create_sample_from_test_file(self, sample_name):
|
||||
|
|
Loading…
Reference in New Issue