def _load_config(self): """ Load configuration parameters from configuration """ config = Configuration.get() self.config_core = config self._config_hash = hash(str(config)) self.lang = config.get('lang') self.config = config.get('listener') rate = self.config.get('sample_rate') device_index = self.config.get('device_index') device_name = self.config.get('device_name') if not device_index and device_name: device_index = find_input_device(device_name) LOG.debug('Using microphone (None = default): ' + str(device_index)) self.microphone = MutableMicrophone(device_index, rate, mute=self.mute_calls > 0) self.wakeword_recognizer = self.create_wake_word_recognizer() # TODO - localization self.wakeup_recognizer = self.create_wakeup_recognizer() self.responsive_recognizer = ResponsiveRecognizer( self.wakeword_recognizer) self.state = RecognizerLoopState()
def _load_config(self): """ Load configuration parameters from configuration """ config = Configuration.get() self.config_core = config self._config_hash = hash(str(config)) self.lang = config.get('lang') self.config = config.get('listener') rate = self.config.get('sample_rate') device_index = self.config.get('device_index') device_name = self.config.get('device_name') if not device_index and device_name: device_index = find_input_device(device_name) LOG.debug('Using microphone (None = default): '+str(device_index)) self.microphone = MutableMicrophone(device_index, rate, mute=self.mute_calls > 0) # TODO:19.02 - channels are not been used, remove from mycroft.conf # and from code. self.microphone.CHANNELS = self.config.get('channels') self.wakeword_recognizer = self.create_wake_word_recognizer() # TODO - localization self.wakeup_recognizer = self.create_wakeup_recognizer() self.responsive_recognizer = ResponsiveRecognizer( self.wakeword_recognizer) self.state = RecognizerLoopState()
def open_mic_stream(pa, device_index, device_name): """ Open microphone stream from first best microphone device. """ if not device_index and device_name: device_index = find_input_device(device_name) stream = pa.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, input_device_index=device_index, frames_per_buffer=INPUT_FRAMES_PER_BLOCK) return stream