def run(self): global queue global WAVPATH while 1: timestamps=int(time.time()); wavefilepath=WAVPATH+"output%d.wav"%timestamps audioInput = microphone(wavefilepath,self.debug) audioInput.recordAudio() if audioInput.getSleepFLag() == 0: os.remove(wavefilepath) else: self.debug.saytxt("producter file:%s"%wavefilepath) queue.put(wavefilepath) time.sleep(5)
def run(self): global queue global WAVPATH while 1: timestamps = int(time.time()) wavefilepath = WAVPATH + "output%d.wav" % timestamps audioInput = microphone(wavefilepath, self.debug) audioInput.recordAudio() if audioInput.getSleepFLag() == 0: os.remove(wavefilepath) else: self.debug.saytxt("producter file:%s" % wavefilepath) queue.put(wavefilepath) time.sleep(5)
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")