First Commit
PocketSphinx Just Barely works to recoginze 'Jade' as the wake word Using https://github.com/suno-ai/bark for the TTS part of the code
This commit is contained in:
33
main.py
Normal file
33
main.py
Normal file
@ -0,0 +1,33 @@
|
||||
import speech_recognition as sr
|
||||
from voice import say
|
||||
from intents import handle_intent
|
||||
|
||||
# Define the wake word
|
||||
wake_word = "Jade"
|
||||
|
||||
# Define the speech recognition function
|
||||
def recognize_speech():
|
||||
r = sr.Recognizer()
|
||||
with sr.Microphone() as source:
|
||||
print("Say something!")
|
||||
audio = r.listen(source)
|
||||
try:
|
||||
text = r.recognize_sphinx(audio)
|
||||
print(f"You said: {text}")
|
||||
if wake_word.lower() in text.lower():
|
||||
# Get the intent from the text
|
||||
intent = get_intent(text)
|
||||
response = handle_intent(intent)
|
||||
say(response)
|
||||
except sr.UnknownValueError:
|
||||
print("PocketSphinx could not understand audio")
|
||||
except sr.RequestError as e:
|
||||
print(f"PocketSphinx error; {e}")
|
||||
|
||||
# Define the function to get the intent from text
|
||||
def get_intent(text):
|
||||
# TODO: implement intent recognition
|
||||
return "greeting"
|
||||
|
||||
# Call the speech recognition function
|
||||
recognize_speech()
|
Reference in New Issue
Block a user