diff --git a/mycroft/client/speech/listener.py b/mycroft/client/speech/listener.py
index 8ec77bfb8b..7b99fb5220 100644
--- a/mycroft/client/speech/listener.py
+++ b/mycroft/client/speech/listener.py
@@ -20,8 +20,8 @@ import time
from Queue import Queue
from threading import Thread
-import pyee
import speech_recognition as sr
+from pyee import EventEmitter
from requests import HTTPError
from mycroft.client.speech.local_recognizer import LocalRecognizer
@@ -36,10 +36,6 @@ from mycroft.util.log import getLogger
LOG = getLogger(__name__)
-config = ConfigurationManager.get()
-speech_config = config.get('speech_client')
-listener_config = config.get('listener')
-
class AudioProducer(Thread):
"""
@@ -173,28 +169,28 @@ class RecognizerLoopState(object):
self.sleeping = False
-class RecognizerLoop(pyee.EventEmitter):
- def __init__(self,
- channels=speech_config.get('channels'),
- rate=speech_config.get('sample_rate'),
- device_index=speech_config.get('device_index'),
- lang=config.get('lang')):
- pyee.EventEmitter.__init__(self)
- self.microphone = MutableMicrophone(device_index, rate)
+class RecognizerLoop(EventEmitter):
+ def __init__(self):
+ super(RecognizerLoop, self).__init__()
+ config = ConfigurationManager.get()
+ lang = config.get('lang')
+ self.config = config.get('listener')
+ rate = self.config.get('sample_rate')
+ device_index = self.config.get('device_index')
+ self.microphone = MutableMicrophone(device_index, rate)
# FIXME - channels are not been used
- self.microphone.CHANNELS = channels
+ self.microphone.CHANNELS = self.config.get('channels')
self.mycroft_recognizer = self.create_mycroft_recognizer(rate, lang)
# TODO - localization
self.wakeup_recognizer = self.create_wakeup_recognizer(rate, lang)
self.remote_recognizer = ResponsiveRecognizer(self.mycroft_recognizer)
self.state = RecognizerLoopState()
- @staticmethod
- def create_mycroft_recognizer(rate, lang):
- wake_word = listener_config.get('wake_word')
- phonemes = listener_config.get('phonemes')
- threshold = listener_config.get('threshold')
+ def create_mycroft_recognizer(self, rate, lang):
+ wake_word = self.config.get('wake_word')
+ phonemes = self.config.get('phonemes')
+ threshold = self.config.get('threshold')
return LocalRecognizer(wake_word, phonemes, threshold, rate, lang)
@staticmethod
diff --git a/mycroft/client/speech/local_recognizer.py b/mycroft/client/speech/local_recognizer.py
index 99b188e1ff..8f85bccdc6 100644
--- a/mycroft/client/speech/local_recognizer.py
+++ b/mycroft/client/speech/local_recognizer.py
@@ -16,11 +16,11 @@
# along with Mycroft Core. If not, see .
+import os
import tempfile
import time
-
-import os
from os.path import join, dirname, abspath
+
from pocketsphinx import Decoder
__author__ = 'seanfitz, jdorleans'
diff --git a/mycroft/configuration/mycroft.conf b/mycroft/configuration/mycroft.conf
index 26cfeb1d09..108305ddb5 100644
--- a/mycroft/configuration/mycroft.conf
+++ b/mycroft/configuration/mycroft.conf
@@ -20,12 +20,9 @@
"route": "/core",
"ssl": false
},
- "speech_client": {
- "module": "mycroft",
- "sample_rate": 16000,
- "channels": 1
- },
"listener": {
+ "sample_rate": 16000,
+ "channels": 1,
"wake_word": "hey mycroft",
"phonemes": "HH EY . M AY K R AO F T",
"threshold": 1e-90,
diff --git a/mycroft/stt/__init__.py b/mycroft/stt/__init__.py
index 4db85dabd1..e0fef980ea 100644
--- a/mycroft/stt/__init__.py
+++ b/mycroft/stt/__init__.py
@@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see .
from abc import ABCMeta, abstractmethod
+
from speech_recognition import Recognizer
from mycroft.api import STTApi