简体   繁体   English

RaspberryPi 3上的Google Assistant SDK-sounddevice.PortAudioError

[英]Google assistant SDK on RaspberryPi 3 - sounddevice.PortAudioError

I get following error when I try to run Sample Google AI as in Configure and Run the sample - 当我尝试运行“ 配置并运行示例”中的示例 Google AI时,出现以下错误-

(env) pi@raspberrypi:~ $ python -m googlesamples.assistant
Traceback (most recent call last):
  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/__main__.py", line 26, in <module>
    from googlesamples.assistant import (
  File "/home/pi/env/lib/python3.4/site-packages/googlesamples/assistant/audio_helpers/__init__.py", line 24, in <module>
    import sounddevice as sd
  File "/home/pi/env/lib/python3.4/site-packages/sounddevice.py", line 2787, in <module>
    _initialize()
  File "/home/pi/env/lib/python3.4/site-packages/sounddevice.py", line 2744, in _initialize
    _check(_lib.Pa_Initialize(), 'Error initializing PortAudio')
  File "/home/pi/env/lib/python3.4/site-packages/sounddevice.py", line 2671, in _check
    raise PortAudioError(msg)
sounddevice.PortAudioError: Error initializing PortAudio: Unanticipated host API -10000 error 0: ''

Not sure if this is related. 不知道这是否相关。 But, I also have a arecord issue- 但是,我也有一个创纪录的问题-

(env) pi@raspberrypi:~ $ sudo arecord --format=S16_LE --duration=5 --rate=16k --file-type=raw out.raw
arecord: main:722: audio open error: No such file or directory

Audio output testing as described in Google AI setup guide works. Google AI设置指南中所述的音频输出测试有效。 Also, I have completed steps 2 to 4 described in link. 另外,我已经完成了链接中描述的步骤2至4。 It does not fix the error though. 它不能解决错误。

This command works - 此命令有效-

(env) pi@raspberrypi:~ $ sudo arecord --format=S16_LE --duration=5 --rate=16k -D hw:1,0 --file-type=raw out.raw
Recording raw data 'out.raw' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
Warning: rate is not accurate (requested = 16000Hz, got = 44100Hz)
     please, try the plug plugin

Is there a solution to get this going? 有解决方案可以解决这个问题吗?

Thanks. 谢谢。

change ~/.asoundrc to below 将〜/ .asoundrc更改为以下

pcm.!default {
     type asym
     playback.pcm {
             type plug
             slave.pcm "hw:0,0"
     }
     capture.pcm {
             type plug
             slave.pcm "hw:1,0"
     } 
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM