synesthesiam / rhasspy

Rhasspy voice assistant for offline home automation
https://rhasspy.readthedocs.io
MIT License
950 stars 101 forks source link

regression on disable wake feature #124

Closed Khomotica closed 4 years ago

Khomotica commented 4 years ago

Hi,

the new option "disable_wake" (true by default) to stop listening on wake word while TTS are loading has a side effect after the first command succeded :

DEBUG:SnowboyWakeListener:Hotword(s) detected: [‘snowboy/hey_vega.pmdl’] DEBUG:DialogueManager:Awake! DEBUG:DialogueManager:asleep -> awake DEBUG:SnowboyWakeListener:listening -> loaded DEBUG:WebrtcvadCommandListener:Will timeout in 30 second(s) DEBUG:APlayAudioPlayer:[‘aplay’, ‘-q’, ‘-D’, ‘hw:CARD=ALSA,DEV=0’, ‘/home/pi/.config/rhasspy/profiles/fr/sounds/start.wav’] DEBUG:WebrtcvadCommandListener:loaded -> listening DEBUG:WebrtcvadCommandListener:Voice command started DEBUG:WebrtcvadCommandListener:Voice command finished DEBUG:WebrtcvadCommandListener:listening -> loaded DEBUG:DialogueManager:awake -> decoding DEBUG:RemoteDecoder:POSTing 77804 byte(s) of WAV data to http://home.lan:12101/api/speech-to-text DEBUG:APlayAudioPlayer:[‘aplay’, ‘-q’, ‘-D’, ‘hw:CARD=ALSA,DEV=0’, ‘/home/pi/.config/rhasspy/profiles/fr/sounds/end.wav’] DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): home.lan:12101 DEBUG:urllib3.connectionpool:http://home.lan:12101 “POST /api/speech-to-text?profile=fr HTTP/1.1” 200 30 DEBUG:DialogueManager:combien fait-il dans la maison (confidence=1) DEBUG:DialogueManager:decoding -> recognizing DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): home.lan:12101 DEBUG:urllib3.connectionpool:http://home.lan:12101 “POST /api/text-to-intent?profile=fr&nohass=True HTTP/1.1” 200 775 DEBUG:DialogueManager:{‘entities’: [{‘end’: 11, ‘entity’: ‘unite_type’, ‘raw_end’: 7, ‘raw_start’: 0, ‘raw_tokens’: [‘combien’], ‘raw_value’: ‘combien’, ‘start’: 0, ‘tokens’: [‘temperature’], ‘value’: ‘temperature’}, {‘end’: 34, ‘entity’: ‘house_room’, ‘raw_end’: 30, ‘raw_start’: 24, ‘raw_tokens’: [‘maison’], ‘raw_value’: ‘maison’, ‘start’: 28, ‘tokens’: [‘maison’], ‘value’: ‘maison’}], ‘intent’: {‘confidence’: 1.0, ‘name’: ‘EntityStateValueJeedom’}, ‘raw_text’: ‘combien fait-il dans la maison’, ‘raw_tokens’: [‘combien’, ‘fait-il’, ‘dans’, ‘la’, ‘maison’], ‘recognize_seconds’: 0.00653655402129516, ‘siteId’: ‘salon’, ‘slots’: {‘house_room’: ‘maison’, ‘unite_type’: ‘temperature’}, ‘speech_confidence’: 1, ‘text’: ‘temperature fait-il dans la maison’, ‘time_sec’: 0.008160114288330078, ‘tokens’: [‘temperature’, ‘fait-il’, ‘dans’, ‘la’, ‘maison’], ‘wakeId’: ‘snowboy/hey_vega.pmdl’} DEBUG:DialogueManager:recognizing -> handling DEBUG:WebSocketObserver:{“entities”: [{“end”: 11, “entity”: “unite_type”, “raw_end”: 7, “raw_start”: 0, “raw_tokens”: [“combien”], “raw_value”: “combien”, “start”: 0, “tokens”: [“temperature”], “value”: “temperature”}, {“end”: 34, “entity”: “house_room”, “raw_end”: 30, “raw_start”: 24, “raw_tokens”: [“maison”], “raw_value”: “maison”, “start”: 28, “tokens”: [“maison”], “value”: “maison”}], “intent”: {“confidence”: 1.0, “name”: “EntityStateValueJeedom”}, “raw_text”: “combien fait-il dans la maison”, “raw_tokens”: [“combien”, “fait-il”, “dans”, “la”, “maison”], “recognize_seconds”: 0.00653655402129516, “siteId”: “salon”, “slots”: {“unite_type”: “temperature”, “house_room”: “maison”}, “speech_confidence”: 1, “text”: “temperature fait-il dans la maison”, “time_sec”: 0.008160114288330078, “tokens”: [“temperature”, “fait-il”, “dans”, “la”, “maison”], “wakeId”: “snowboy/hey_vega.pmdl”} DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): khomotica.lan:80 DEBUG:urllib3.connectionpool:http://khomotica.lan:80 “POST /core/api/jeeApi.php?plugin=jeerhasspy&apikey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx&plugin=jeerhasspy&type=jeerhasspy HTTP/1.1” 200 22 DEBUG:RemoteIntentHandler:{‘speech’: {‘text’: ‘’}} DEBUG:DialogueManager:handling -> ready INFO:DialogueManager:Automatically listening for wake word DEBUG:DialogueManager:ready -> asleep DEBUG:SnowboyWakeListener:loaded -> listening DEBUG:PicoTTSSentenceSpeaker:[‘pico2wave’, ‘-w’, ‘/tmp/tmp64eamu5i.wav’, ‘-l’, ‘fr-FR’, ‘la température dans le salon est de 17.2°C’] DEBUG:PicoTTSSentenceSpeaker:ready -> speaking DEBUG:SnowboyWakeListener:listening -> loaded DEBUG:APlayAudioPlayer:[‘aplay’, ‘-q’, ‘-D’, ‘hw:CARD=ALSA,DEV=0’] DEBUG:PicoTTSSentenceSpeaker:speaking -> ready DEBUG:SnowboyWakeListener:loaded -> listening [2019-12-30 00:02:29,510] 192.168.1.239:50930 POST /api/text-to-speech 1.1 200 44 3896596 INFO:quart.serving:192.168.1.239:50930 POST /api/text-to-speech 1.1 200 44 3896596 DEBUG:SnowboyWakeListener:Hotword(s) detected: [‘snowboy/hey_vega.pmdl’] DEBUG:SnowboyWakeListener:Hotword(s) detected: [‘snowboy/hey_vega.pmdl’] DEBUG:SnowboyWakeListener:Hotword(s) detected: [‘snowboy/hey_vega.pmdl’]

In the tts.py there is an action introduced to block wake feature when TTS is ready to load but not to reactivate to wake word action when the speech has finished :

    def in_ready(self, message: Any, sender: RhasspyActor) -> None:
        """Handle messages in ready state."""
        if isinstance(message, SpeakSentence):
            self.receiver = message.receiver or sender
            language = message.language or message.voice or self.language
            self.wav_data = self.speak(message.sentence, language=language)

            if message.play:
                self.enable_wake = False
                if self.wake and self.disable_wake:
                    # Disable wake word
                    self.send(self.wake, StopListeningForWakeWord(clear_all=True))
                    self.enable_wake = self.wake_on_start

Disabling the option on JSON profile let wake word working again.

synesthesiam commented 4 years ago

There is code to re-enable the wake word, and I can see it happening in your log:

...
DEBUG:PicoTTSSentenceSpeaker:speaking -> ready
DEBUG:SnowboyWakeListener:loaded -> listening

What must be happening is the snowboy decoder retaining some leftover state or something and getting activated over and over. Let me check into this.

In the mean time, I should probably disable the TTS wake feature by default.

Khomotica commented 4 years ago

yes you're right ... i didn't check all your code :) i noticed that you have a Dialog Manager to control all the stuff... could be the "asleep" trigger missing ?

Note : i try to understand the architecture so maybe in the futur i can help and contribute ;)

synesthesiam commented 4 years ago

Should be fixed now!

Also, your profile picture gives me confidence that you'd be a perfect Rhasspy contributor :)

Khomotica commented 4 years ago

Okay Thx man i will try some testing before celebrations :) ... Happy new year man