You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
738 B
Python

1 year ago
print("Processing...")
text = r.recognize_whisper(audio, language="english")
print(f"Whisper thinks you said {text}")
#TODO: Check for Apollo
def callback(recognizer, audio):
try:
pass
except sr.UnknownValueError:
print("Whisper could not understand audio")
except sr.RequestError as e:
print("Could not request results from Whisper")
r = sr.Recognizer()
m = sr.Microphone()
with m as source:
r.adjust_for_ambient_noise(source) # we only need to calibrate once, before we start listening
stop_listening = r.listen_in_background(m, callback)
print("Listening...")
while True:
time.sleep(0.1) # we're not listening anymore,
# print('1')