diff --git a/basic_text_to_speech/talk.py b/basic_text_to_speech/talk.py index ebd9779..df7deba 100644 --- a/basic_text_to_speech/talk.py +++ b/basic_text_to_speech/talk.py @@ -1,15 +1,5 @@ -import time - import os -import RPi.GPIO as GPIO -import time - -BUTTON = 17 - -GPIO.setmode(GPIO.BCM) -GPIO.setup(BUTTON, GPIO.IN) - def robot(text): print("executing command") @@ -17,33 +7,5 @@ def robot(text): os.system("aplay -D plughw:2,0 output.wav") -def sayScript(): - print("initializing") - robot("hey Heran?") - robot("Based on your age, health, and habits, you have 10950 days left") - robot("Make sure you chant more") - time.sleep(5) - - robot("hey Kam?") - robot("you have some time, but make sure to surrender to jesus") - time.sleep(5) - - robot("hey Arjun") - robot("You have maybe 12000 days left to live") - robot("just drink some water or something") - - if __name__ == '__main__': - while True: - try: - state = GPIO.input(BUTTON) - if state: - print("off") - else: - print("on") - sayScript() - - except KeyboardInterrupt: - break - - time.sleep(1) + robot("Hello, I am your personal assistant") diff --git a/youwilldie/talk.py b/youwilldie/talk.py new file mode 100644 index 0000000..ebd9779 --- /dev/null +++ b/youwilldie/talk.py @@ -0,0 +1,49 @@ +import time + +import os + +import RPi.GPIO as GPIO +import time + +BUTTON = 17 + +GPIO.setmode(GPIO.BCM) +GPIO.setup(BUTTON, GPIO.IN) + + +def robot(text): + print("executing command") + os.system("espeak -w output.wav \"" + text + "\"") + os.system("aplay -D plughw:2,0 output.wav") + + +def sayScript(): + print("initializing") + robot("hey Heran?") + robot("Based on your age, health, and habits, you have 10950 days left") + robot("Make sure you chant more") + time.sleep(5) + + robot("hey Kam?") + robot("you have some time, but make sure to surrender to jesus") + time.sleep(5) + + robot("hey Arjun") + robot("You have maybe 12000 days left to live") + robot("just drink some water or something") + + +if __name__ == '__main__': + while True: + try: + state = GPIO.input(BUTTON) + if state: + print("off") + else: + print("on") + sayScript() + + except KeyboardInterrupt: + break + + time.sleep(1)