示例#1
0
def main():
    atexit.register(lambda:deletePID())
    writePID()
    debugInit=debug()
    '''
     如果用户是桌面系统,就可以提示用户信息
    '''
    #gntptarget=gntpnotify()
    #gntptarget.ownnotify()
    #test
    '''
    目前准备是1个生产者 5个消费者的模型
    '''
    try:
        tList = []
        producerTarget=Producer(debugInit)
        tList.append(producerTarget)
        for i in range(5):
            consumerTarget=Consumer(debugInit)
            tList.append(consumerTarget)
        for t in tList:
            t.setDaemon(1)
            t.start()
    except NotUnderstoodException:
        debugInit.saytxt("error")
    #Controller+C也可以终止程序
    while True:
        try:
            sys.stdin.read()
        except KeyboardInterrupt:
            stop()
示例#2
0
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")