def main(): debugInit=debug() try: WAVPATH="/home/vincent/coding/python/piRobot/output.wav" audioInput = microphone(WAVPATH,debugInit) audioInput.recordAudio() speech_to_text=google(audioInput,debugInit) command=speech_to_text.sst_google() debugInit.saytxt(command) cmd=InstructionSet(command,debugInit) cmd.docmd() #audioOutput=aerophone(WAVPATH) #audioOutput.play() except NotUnderstoodException: debugInit.saytxt("error")
def run(self): global queue while 1: if queue.qsize() > 0: wavpath = queue.get() self.debug.saytxt("comsumer file:%s" % wavpath) speech_to_text = google(wavpath, self.debug) command = speech_to_text.sst_google() # command="下一页" os.remove(wavpath) if command: self.debug.saytxt(command) cmd = InstructionSet(command, self.debug) cmd.docmd() else: self.debug.saytxt("Sorry, I couldn't understand what you said") else: self.debug.saytxt("Time:%s/n" % (time.ctime())) time.sleep(5)
def run(self): global queue while 1: if queue.qsize()>0 : wavpath=queue.get() self.debug.saytxt("comsumer file:%s"%wavpath) speech_to_text=google(wavpath,self.debug) command=speech_to_text.sst_google() #command="下一页" os.remove(wavpath) if command: self.debug.saytxt(command) cmd=InstructionSet(command,self.debug) cmd.docmd() else: self.debug.saytxt("Sorry, I couldn't understand what you said") else : self.debug.saytxt('Time:%s/n' %(time.ctime())) time.sleep(5)