I'm building a personal voice assistant, and I wanna to make my AI listen to commands by wake words (I don't know if it is a good idea, so if not advice me) since SpeechRecogniton requires internet and its a little heavy and makes the AI response more slowly... But when I put more than 1 wake word and execute him it doesn't recognise any command...
import datetime
import pyttsx3 # pip install pyttsx3
import os
import sys
import re
import snowboy.snowboydecoder as snowboydecoder
engine = pyttsx3.init()
voices = engine.getProperty('voices')
# for voice in voices:
# print(voice.id)
engine.setProperty('voice', voices[0].id)
def speak(audio):
engine.say(audio)
engine.runAndWait()
def Greetings():
speak ("Hi Sir")
def How_are_you_doing():
speak ("I'm very good, Sir. And You?")
def wake_word():
print ("Hello_word")
detector=snowboydecoder.HotwordDetector("Hey_Bold.pmdl",sensitivity=0.5,audio_gain=1)
detector.start(Greetings)
def how_you_doing():
print ("how_you_doing_word")
detector_how = snowboydecoder.HotwordDetector("How_you_doing.pmdl", sensitivity=0.5, audio_gain=1)
detector_how.start(How_are_you_doing)
Any devices are welcome!
in order to listen to a number of wake words, simply pass a list of wake words model paths to HotwordDetector (see below).
below is a working example of listening to a number of wakewords connected to google's assistant (running of rpi 4 with AIY VOICE IMAGE from https://github.com/google/aiyprojects-raspbian/releases/tag/v20191113)