I have successfully configured my Matrix Voice and it detects hotwords well. Thank you for good work ))
But I have some issue: I configured custom hotword because Snips dont support my language yet. So I did it and then I tried to write custom handler on mqtt Matrix Voice events using Python and PyAudio. Aaaand…I realized that there is some problems: PyAudio returns an error even when I’m trying to start your example script from here
My asound.conf and python traceback:
name "MicArray Master"
Traceback (most recent call last):
File "mqtt.py", line 13, in <module>
stream = p.open(format=FORMAT,
File "/home/pi/smarthome/venv/lib/python3.8/site-packages/pyaudio.py", line 750, in open
stream = Stream(self, *args, **kwargs)
File "/home/pi/smarthome/venv/lib/python3.8/site-packages/pyaudio.py", line 441, in __init__
self._stream = pa.open(**arguments)
OSError: [Errno -9998] Invalid number of channels
Hope you can help me
I figured out that problem was in blocking I/O by snips-audio-server. So if it’s started there is no way to access microphone input…
Is there some possibility to realize next scenario?
- snips-hotword detects my personal hotword and sends mqtt message (in topic hermes/hotword/friday/detected)
- snips-audio-server stops blocking microphone input for example for 5 seconds
- python script receive the mqtt message about hotword detection and tries to record audio with PyAudio and Matrix Microphones?
- after that snips-audio server takes microphone I/O control back
So, if Snips does not support your language, what good is it to use it?
And if you choose a language supported, why is there the need for a custom hotword? (Beside the fact that it’s cool)
I do not know what language you need, but you might consider Rhasspy: https://rhasspy.readthedocs.io/en/latest/
At the beginning of project I was looking at Snowboy word detection because it’s the best solution for me, but then I understood that Matrix Voice has a bad support of Snowboy (or the other way around) and I started to think what can I do with Snips.ai.
So now I’m looking for next workaround:
- Detect hotword with Snips.ai and send mqtt message
- Python script runs “os.system(‘sam service stop snips-audio-server’)” and takes control of the microphone
- Python script with SpeechRecognition library records the audio stream and sends it to Google TTS (but now I have problems in this step, supposetly with alsa library)
- Python script runs “os.system(‘sam service start snips-audio-service’)” and gives control of the microphone back to snips-audio-server
That workaround looks very bad and takes much time to turn off and then turn on snips-audio-server, but now it’s only one solution that I came to.
If you have working solution with Snowboy - you are welcome But I think that there is some problems with sync of Matrix and Snowboy (or maybe I’m a noob).
Or maybe someone can help me with this or…maybe someone already streamed audio over mqtt?
Matrix Voice is a Mic Array, there is no such thing as “bad support of Snowboy”.
I think you really should check into Rhasspy
Yes, see my repo here: