在RPi 3上启动Google Assistant示例时出现无效的采样率错误

时间:2017-04-29 20:36:46

标签: python microphone google-assistant-sdk

我尝试按照针对此特定设备和软件(https://developers.google.com/assistant/sdk/overview)制作的Google页面上的说明,在我的RPi 3型号B上安装新的Google智能助理SDK。我按照指示操​​作并成功配置了我的麦克风(Kinobo USB麦克风https://www.amazon.com/Kinobo-Microphone-Desktop-Recognition-Software/dp/B00IR8R7WQ)。

但是,在运行启动命令时:

python -m googlesamples.assistant

我收到错误:Traceback(最近一次调用最后一次):

File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
File "/home/pi/env/lib/python3.4/site-
    packages/googlesamples/assistant/audio_helpers/__main__.py", line 94, 
    in <module>
    main()
File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 
    722, in __call__
    return self.main(*args, **kwargs)
File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 
    697, in main
    rv = self.invoke(ctx)
File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 
    895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 
    535, in invoke
    return callback(*args, **kwargs)
File "/home/pi/env/lib/python3.4/site-
    packages/googlesamples/assistant/audio_helpers/__main__.py", line 
    67, in main
    flush_size=audio_flush_size)
File "/home/pi/env/lib/python3.4/site-
    packages/googlesamples/assistant/audio_helpers/__init__.py", line 
    140, in __init__
    blocksize=int(block_size/2),  # blocksize is in number of frames.
File "/home/pi/env/lib/python3.4/site-packages/sounddevice.py", line 
    1491, in __init__
    **_remove_self(locals()))
File "/home/pi/env/lib/python3.4/site-packages/sounddevice.py", line 
    1017, in __init__
    'Error opening {0}'.format(self.__class__.__name__))
File "/home/pi/env/lib/python3.4/site-packages/sounddevice.py", line 
    2671, in _check
    raise PortAudioError(msg)
    sounddevice.PortAudioError: Error opening RawStream: Invalid 
    sample rate

我不明白为什么它会抛出无效的采样率,并且在试图追踪错误时,我没有遇到表示采样率的变量或幻数。关于如何修复此错误的任何想法?

1 个答案:

答案 0 :(得分:0)

您是否尝试过“配置和测试音频”下的步骤2和3?我有同样的问题,并为我清理了它。它现在很棒。

“配置和测试音频”的链接是:

https://developers.google.com/assistant/sdk/prototype/getting-started-pi-python/configure-audio