def main():
    # 创建录音设备(平台相关)
    audio = Audio()
    # 创建播放器(平台相关)
    player = Player()

    dueros = DuerOS(player)
    dueros.set_directive_listener(directive_listener)

    audio.link(dueros)

    dueros.start()
    audio.start()

    prompt_tone_player = PromptTone()

    while True:
        try:
            try:
                print '\n'
                input('单击[Enter]建,然后发起对话\n')
            except SyntaxError:
                pass
            # 唤醒态提示音
            prompt_tone_player.play()
            dueros.listen()
        except KeyboardInterrupt:
            break

    dueros.stop()
    audio.stop()
def main():
    audio = Audio()
    player = Player()
    dueros = DuerOS(player)
    dueros.set_directive_listener(directive_listener)

    audio.link(dueros)
    dueros.start()
    audio.start()

    prompt_tone_player = PromptTone()

    while True:
        try:
            try:
                print '\n'
                input('input [ENTER] key to start conversation\n')
            except SyntaxError:
                pass
            prompt_tone_player.play()
            dueros.listen()

        except KeyboardInterrupt:
            break

    dueros.stop()
    audio.stop()
Beispiel #3
0
def main():
    # 创建录音设备(平台相关)
    audio = Audio()
    #audio = Audio(rate=1600, frames_size=1024)
    # 创建唤醒引擎
    wakeup_engine = WakeupEngine()
    # 创建播放器(平台相关)
    player = Player()
    # 创建duerOS核心处理模块
    dueros = DuerOS(player)
    dueros.set_directive_listener(directive_listener)

    # [小度小度] SnowBoy唤醒引擎
    #model = 'app/model/xiaoduxiaodu_all_10022017.umdl'
    model = 'app/model/xiaobai.pmdl'
    # SnowBoy唤醒引擎实体
    snowboy = SnowBoy(model)

    audio.link(wakeup_engine)
    wakeup_engine.link(dueros)
    wakeup_engine.set_wakeup_detector(snowboy)

    prompt_tone_player = PromptTone()

    def wakeup():
        '''
        唤醒回调
        :return:
        '''
        print('[小白]已唤醒,我能为你做些什么..........')
        # 唤醒态提示音
        prompt_tone_player.play()
        dueros.listen()

    snowboy.set_callback(wakeup)

    dueros.start()
    wakeup_engine.start()
    snowboy.start()
    audio.start()

    print('请说[小白小白]来唤醒我.......')

    while True:
        try:
            time.sleep(1)
        except KeyboardInterrupt:
            break

    dueros.stop()
    wakeup_engine.stop()
    audio.stop()
    snowboy.stop()
Beispiel #4
0
def main():
    # 创建录音设备(平台相关)
    audio = Audio()
    # 创建唤醒引擎
    wakeup_engine = WakeupEngine()
    # 创建播放器(平台相关)
    player = Player()
    # 创建duerOS核心处理模块
    dueros = DuerOS(player)
    dueros.set_directive_listener(directive_listener)

    
    model = cnfg.getConfigValue("snowboy","snowboyPmdl")
    snowboyName = cnfg.getConfigValue("snowboy","snowboyName")
    # SnowBoy唤醒引擎实体
    snowboy = SnowBoy(model)

    audio.link(wakeup_engine)
    wakeup_engine.link(dueros)
    wakeup_engine.set_wakeup_detector(snowboy)

    prompt_tone_player = PromptTone(player)

    def wakeup():
        '''
        唤醒回调
        :return:
        '''
        print snowboyName+'已唤醒,我能为你做些什么?'
        # 唤醒态提示音
        prompt_tone_player.play()
        dueros.listen()

    snowboy.set_callback(wakeup)

    dueros.start()
    wakeup_engine.start()
    snowboy.start()
    audio.start()

    print '请说'+snowboyName+'来唤醒我。'

    while True:
        try:
            time.sleep(1)
        except KeyboardInterrupt:
            break

    dueros.stop()
    wakeup_engine.stop()
    audio.stop()
    snowboy.stop()
Beispiel #5
0
def main():
    # 创建录音设备(平台相关)
    audio = Audio()
    # 创建唤醒引擎
    wakeup_engine = WakeupEngine()
    # 创建播放器(平台相关)
    player = Player()
    # 创建duerOS核心处理模块
    dueros = DuerOS(player)
    dueros.set_directive_listener(directive_listener)

    # [小度小度] SnowBoy唤醒引擎
    model = 'app/snowboy/xiaoduxiaodu_all_10022017.umdl'
    # SnowBoy唤醒引擎实体
    snowboy = SnowBoy(model)

    audio.link(wakeup_engine)
    wakeup_engine.link(dueros)
    wakeup_engine.set_wakeup_detector(snowboy)
    mic_data_saver = MicDataSaver()
    prompt_tone_player = PromptTone(player)

    def wakeup():
        '''
        唤醒回调
        :return:
        '''
        print '[Robot]已唤醒,我能为你做些什么..........'
        # 唤醒态提示音
        prompt_tone_player.play()
        dueros.listen()

    snowboy.set_callback(wakeup)
    #mic_data_saver.record_wave()
    dueros.start()
    wakeup_engine.start()
    snowboy.start()
    audio.start()

    print '请说[xiaoduxiaodu]来唤醒我.......'

    while True:
        try:
            time.sleep(1)
        except KeyboardInterrupt:
            break
    dueros.stop()
    wakeup_engine.stop()
    audio.stop()
    snowboy.stop()