Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parse(self, line):
params = [param.lower() for param in line.split() if param]
if params == ['hal-e', 'listen']:
listen()
elif params == ['shut', 'down', 'program']:
print "Halley will go to sleep now. Good bye!"
tts.Google().play_wav("./hal-e/wav/sleep.wav")
print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
print "+++++++++++++++++++++++ HAL-E HAS SHUT DOWN ++++++++++++++++++++++++"
print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
sys.exit(1) # note: doesn't exit julius speech listener
def __init__(self):
self.speaker = tts.Google()
self.voice_cmd = VoiceCommand(self.speaker)
self.print_welcome()
print "Saying: Hello there!"
self.speaker.play_wav("./wav/hello.wav")
def listen():
print "Initializing..."
speaker = tts.Google()
if not internet_on():
print("No Internet connection.")
speaker.play_wav("./hal-e/wav/internet_err.wav")
return
speaker.play_wav("./hal-e/wav/yes.wav")
try:
audioInput = Microphone()
audioInput.listen()
speech_to_text = stt.Google(audioInput)
recorded_text = speech_to_text.get_text()
job = Job(recorded_text)
def main():
speaker = tts.Google()
# test internet connection
if not internet_on():
speaker.play_wav("./jarvis/wav/internet_err.wav")
return
try:
speaker.play_wav("./jarvis/wav/yes.wav")
audioInput = Microphone()
audioInput.listen()
# init new Voice class associated with audio
speech_to_text = stt.Google(audioInput)
# convert audio file into text and init a new Job class with text
def __init__(self, AI):
print "Saying: Yes?"
self.speaker = tts.Google()
self.speaker.play_wav("./wav/yes.wav")
self.AI = AI
self.listen()