예제 #1
0
파일: jarvis.py 프로젝트: rbs-pli/Jarvis
def wakeup():
    while not exit_flag:
        #mic = microphone.Microphone()
        a, s_data = mic.listen()
        a = 0
        if mic.is_silent(s_data):
            commonsense.sleepy()
            sleep()
        try:
            stt_engine = google_stt.Google_STT(mic)
            stt_response = stt_engine.get_text()
            print("Heard: %r" % stt_response)
            if (jarvis_brain.process(stt_response)):
                pass
            else:
                if check_sleep(stt_response.split(' ')):
                    break
                response = k.respond(stt_response)
                print(response)
                tts_engine.say(response)
        except NotUnderstoodException:
            commonsense.sorry()
        except Exception:
            print("Error in processing loop:")
            traceback.print_exc()
            commonsense.uhoh()
예제 #2
0
파일: jarvis.py 프로젝트: rbs-pli/Jarvis
def sleep():
    while not exit_flag:
        try:
            #mic = microphone.Microphone()
            a, s_data = mic.listen()
            stt_engine = google_stt.Google_STT(mic)
            stt_response = stt_engine.get_text()
            words_stt_response = stt_response.split(' ')
            if 'wake' in words_stt_response or 'jarvis' in words_stt_response or 'wakeup' in words_stt_response:
                tts_engine.say("Hello Sir, I am back once again.")
                wakeup()
        except Exception:
            pass
예제 #3
0
파일: jarvis.py 프로젝트: techite/Jarvis
def wakeup():
    while True:
        mic = microphone.Microphone()
        a, s_data = mic.listen()
        a = 0
        if mic.is_silent(s_data):
            commonsense.sleepy()
            sleep()
        try:
            stt_engine = google_stt.Google_STT(mic)
            stt_response = stt_engine.get_text()
            if (jarvis_brain.process(stt_response)):
                pass
            else:
                if check_sleep(stt_response.split(' ')):
                    break
                response = k.respond(stt_response)
                print(response)
                tts_engine.say(response)
        except:
            commonsense.sorry()