No I use snowboy for hotword detection.
this is my workflow:
download snowboy for phyton (https://snowboy.kitt.ai/docspartials/docs/index.html#downloads) and get a hotword file. You can see an example here:
https://pimylifeup.com/raspberry-pi-snowboy/
Than i wrote a python script like this is called hotword.py in my snowball folder:
import snowboydecoder
import sys
models = ['/home/pi/hey_pips.pmdl']
detector = snowboydecoder.HotwordDetector(models, sensitivity=float(sys.argv[1]))
def callbackfunc():
print("Hotword")
detector.terminate()
sys.exit(0)
detector.start(detected_callback=callbackfunc,
sleep_time=0.03)
I run this from nodered in an exec node using: python -u ~/snowboy/hotword.py
with append msg.payload ticked. This script includes that you send the hotword sensitivity from nodered using sys.argv. When a hotword is detected it prints Hotword
and releases the audio resources. This triggers a second exec node in nodered that uses sox (http://sox.sourceforge.net/) to record audio in the right format.
The sox command in the exec node actually does a little bit more:
sox -t alsa default -r 16000 -c 1 -b 16 ~/asr.wav silence -l 0 1 2.0 2.0% trim 0 6 vad -p 0.2 reverse vad -p 0.6 reverse
It only records until it detects silence and for a max of 6 seconds it than applies additional vad to trim silence/noises of the start and end. Once the recording is finished it restarts the hotword and in my case triggers the speech to text using voice to json or on my satellites sends the recorded wav as a buffer over mqtt to do the stt on my main nodered instance. This is the basics of my hotword stuff as a flow(in my actual flow their is stuff like leds on the mic array and finding out which hotword was first from several sites):
[{"id":"ce732054.cde6c","type":"exec","z":"ed7ded5f.9a395","command":"python -u ~/snowboy/hotword.py ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"hotword.py","x":590,"y":660,"wires":[["6e159b37.21f8dc"],[],[]]},{"id":"a20a43a6.91b2","type":"inject","z":"ed7ded5f.9a395","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"30","x":220,"y":660,"wires":[["17f2a8f4.42c1cf"]]},{"id":"6e159b37.21f8dc","type":"switch","z":"ed7ded5f.9a395","name":"hotword?","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"Hotword","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":1,"x":760,"y":660,"wires":[["2114741d.a8fd24"]]},{"id":"2114741d.a8fd24","type":"exec","z":"ed7ded5f.9a395","command":"sox -t alsa default -r 16000 -c 1 -b 16 ~/asr.wav silence -l 0 1 2.0 2.0% trim 0 6 vad -p 0.2 reverse vad -p 0.6 reverse","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"record","x":910,"y":660,"wires":[["17f2a8f4.42c1cf"],[],[]]},{"id":"17f2a8f4.42c1cf","type":"change","z":"ed7ded5f.9a395","name":"set sensitivity","rules":[{"t":"set","p":"payload","pt":"msg","to":"0.4","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":660,"wires":[["ce732054.cde6c"]]}]
Johannes