smartmirror-bing.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:Smart-Mirror 作者: aishmittal 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号