How to set a wake up word for an virtual assistant using Vosk offline speech recognition (or any other fast offline speech recognizer)

Viewed 593

I want a fast offline speech recognizer (like vosk or sphinx) as a wake-up word for google speech recognition so it doesn't always hear what we say.

Want wake up word for this:

def takeCommand():
# mic input

r = sr.Recognizer()
with sr.Microphone() as source:
    print("Hearing...")
    # r.pause_threshold = 1
    r.chunk_size = 2048
    r.adjust_for_ambient_noise(source)
    audio = r.listen(source)

try:
    print("Recognizing....")
    query = r.recognize_google(audio, language='en-in')
    print(f"You said: {query}\n")

except Exception as e:
    print(e)

    print("Say that again please...")
    return "None"
return query
1 Answers
Related