diff --git a/__main__.py b/__main__.py index 8bcd3ec..fecb087 100644 --- a/__main__.py +++ b/__main__.py @@ -291,11 +291,12 @@ def callback(recognizer, audio, resp): except: return None -def ADJUST_MICROPHONE(rec,recognizer): +def ADJUST_MICROPHONE(rec,recognizer,resp): while True: with rec.mic as source: - recognizer.adjust_for_ambient_noise(source,duration=0.05) - #print(recognizer.energy_threshold) + if not resp.wake: + recognizer.adjust_for_ambient_noise(source,duration=0.5) + #print(recognizer.energy_threshold) if stopped: break @@ -303,7 +304,7 @@ def ADJUST_MICROPHONE(rec,recognizer): bg = r.listen_in_background(m,lambda recognizer, audio: callback(recognizer, audio, resp)) print(":initialisation_successful:") -adj_thread = threading.Thread(target=ADJUST_MICROPHONE,args=(rec,rec.recognizer,),daemon=True) +adj_thread = threading.Thread(target=ADJUST_MICROPHONE,args=(rec,rec.recognizer,resp),daemon=True) adj_thread.start() if __name__ == "__main__": diff --git a/__pycache__/conversations.cpython-38.pyc b/__pycache__/conversations.cpython-38.pyc index 184d1a5..97a2e23 100644 Binary files a/__pycache__/conversations.cpython-38.pyc and b/__pycache__/conversations.cpython-38.pyc differ diff --git a/conversations.py b/conversations.py index 7476fa6..74442e4 100644 --- a/conversations.py +++ b/conversations.py @@ -9,7 +9,7 @@ ['What are you doing?', 'Nothing, I\'m talking to you.', 'No, I think you are processing.', - 'To talk, I obviously have to process.'], + 'To talk, I obviously have to process.','Do you make food?','No, but I can process toast.'], ['What is your name?', 'My name is pion.'], ['What are you?', @@ -17,7 +17,7 @@ 'Do you know sophia?', 'No, I think she\'s real. I\'m not real!'], ['What is your purpose?', 'I talk to bored people to entertain them, but I sometimes do annoy them!'], - ['Nothing.','Oh, Okay.'], + ['Nothing.','Oh, Okay.','What\'s the joke?'], ['What is your favorite color?','Blue.']] diff --git a/db.sqlite3 b/db.sqlite3 index ea628fb..95dc6f9 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ