def start_speech_recording(tmp):
# Record Audio
global recognised_speech
BING_KEY = "cfee7d6db79d4671b9cea936da4689d7"
while True:
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say something!")
r.adjust_for_ambient_noise(source, duration = 1)
audio = r.listen(source)
try:
recognised_speech = r.recognize_bing(audio, key=BING_KEY).lower()
print("Microsoft Bing Voice Recognition thinks you said:" + recognised_speech)
if "hallo" in recognised_speech or "wakeup" in recognised_speech or "start" in recognised_speech or "makeup" in recognised_speech or "star" in recognised_speech or "breakup" in recognised_speech:
thread.start_new_thread( face_identify, (3, ) )
except sr.UnknownValueError:
print("Microsoft Bing Voice Recognition could not understand audio")
except sr.RequestError as e:
print("Could not request results from Microsoft Bing Voice Recognition service; {0}".format(e))
评论列表
文章目录