a. Adding the Hot Word
Detecting hot words from the ambient noises of your house is crucial to the voice control: Once a hot word is detected, it triggers the recording of the voice command.
Fortunately, there is a way to do hotword detection on device thanks to Snowboy. This open-source framework allows you to use your own hotword, and thus allows you to start recording at the right time. Once a certain amount of time has passed, the recording is stopped, and the audio file is transformed to text.
By default, spkr will react to the “Hey Snips” hotword. You are free to use whatever hotword you’d like though:
Train your own hotword model by heading over to: https://snowboy.kitt.ai/
Retrieve the parameters file (with the .pmdl extension)
Load it to your raspberry in the folder: /opt/snips/config
b. Configuring the Speech-to-Text
To enable speech to text using Google Speech to Text, you need a Speech Service access. You can get account and credentials file there:
https://cloud.google.com/speech/. You can have free access for limited monthly usage. Don’t worry the data is only sent to google when the hotword has been detected, so it will ensure privacy when the hotword is not detected + you wont exceed the monthly limit of 60 minutes.
Enable Google Speech API
Download the credentials in json format
Copy this file at the right place on the raspberry:
$ scp <PATH_TO_GOOGLE_CREDENTIALS_JSON> firstname.lastname@example.org:/opt/snips/config/googlecredentials.json