Skip to content

Commit

Permalink
feat!:move to simple listener
Browse files Browse the repository at this point in the history
be even more lightweight
  • Loading branch information
JarbasAl committed Oct 25, 2024
1 parent 3de0ff2 commit 96f0341
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hivemind_voice_relay/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import speech_recognition as sr
from ovos_audio.service import PlaybackService
from ovos_bus_client.message import Message, dig_for_message
from ovos_config import Configuration
from ovos_plugin_manager.microphone import OVOSMicrophoneFactory
from ovos_plugin_manager.templates.stt import STT
from ovos_plugin_manager.templates.tts import TTS
Expand Down Expand Up @@ -88,7 +89,7 @@ def error_callback(self, audio: sr.AudioData):
def text_callback(self, utterance: str, lang: str):
LOG.info(f"STT: {utterance}")
self.bus.emit(Message("recognizer_loop:utterance",
{"utterances": utterance, "lang": lang}))
{"utterances": [utterance], "lang": lang}))


class HiveMindSTT(STT):
Expand Down Expand Up @@ -173,10 +174,11 @@ class HiveMindVoiceRelay(SimpleListener):
def __init__(self, bus: Optional[HiveMessageBusClient] = None):
self.bus = bus or get_bus()
self.audio = HMPlayback(bus=self.bus)
ww = Configuration().get("listener", {}).get("wake_word", "hey_mycroft")
super().__init__(
mic=OVOSMicrophoneFactory.create(),
vad=OVOSVADFactory.create(),
wakeword=OVOSWakeWordFactory.create_hotword("hey_mycroft"),
wakeword=OVOSWakeWordFactory.create_hotword(ww),
stt=HiveMindSTT(self.bus),
callbacks=HMCallbacks(self.bus)
)
Expand Down

0 comments on commit 96f0341

Please sign in to comment.