Psychokiller1888 / snips-custom-hotword

Using Snowboy to customize the snips hotword
GNU General Public License v3.0
21 stars 5 forks source link

snips-custom-hotword

Using Snowboy to customize the snips hotword. This is meant to use the Snowboy engine to trigger Snips, unlike oziee that processes a sound buffer from Snips to check if the hotword is present. The main reason of this repository is to share another approach, all the needed files and a configurable way

Install

I'm using raspbian stretch light

We need a few dependencies first:

sudo apt-get install python-pip python-pyaudio python3-pyaudio sox libatlas-base-dev

sudo pip install pyaudio

sudo pip install pytoml

sudo pip install paho_mqtt

Now, I perfectly know that libatlas-base-dev might be in conflict with Snips. That is why I do install it before Snips!

Install Snips

Once you sorted that out, you can download this project

git clone https://github.com/Psychokiller1888/snips-custom-hotword.git

Checking your mic

In a console type sudo nano /etc/asound.conf

Check that the part "capture" is set as type "dsnoop"

Here an exemple of a working configuration, so the mic can be shared between applications:

pcm.!default {
    type asym
    playback.pcm {
        type plug
        slave.pcm "hw:0,0"
    }
    capture.pcm "multi"
}

pcm.multi {
    type plug
    slave.pcm "multiapps"
}

pcm.multiapps {
    type dsnoop
    slave.pcm "hw:1,0"
    ipc_key 666666
}

Creating a custom hotword

You're good to go!

sudo python customHotword.py YOUR MODEL NAME SENSITIVITY

Whaaat? Ok, calm down, here's an exemple:

sudo python customHotword.py Alice 0.45

Given that you downloaded the model Alice.pmdl and you want a sensitivity of 0.45 for it. (Sensitivity from 0 - not hearing you and 1 - full blast)

Disabling Snips hotword

By this line of this little guide, your Snips instance still listens to both your custom hotword and your Snips hotword. Wanna disable the Snips hotword?

sudo systemctl stop snips-hotword

sudo systemctl disable snips-hotword

Starting the custom hotword at Raspberry boot

But but but.... Nothing happens!

Ok, the aim of this is to change your hotword by a custom one, I didn't include any script... If you want to check that it actually works, make sure to have the service started, you could use sudo systemctl status snipsCustomHotword to make sure, then use snips-watch -v and try to wake your assistant by telling your hotword. If it hears you, you'll get informations on screen

Proof

Yes, it works! Screen capture Video

Todo

I'm open to any suggestions. Here a little TODO list for this simple project:

I wanna go back!!!

sudo systemctl stop snipsCustomHotword

sudo systemctl disable snipsCustomHotword

sudo systemctl start snips-hotword

sudo systemctl enable snips-hotword

sudo rm /etc/systemd/system/snipsCustomHotword.service

sudo rm -rf /home/pi/snips-custom-hotword

Special thanks