gpt4 book ai didi

python - RaspberryPi 3 上的 Google Assistant SDK - sounddevice.PortAudioError

转载 作者:太空宇宙 更新时间:2023-11-03 15:14:41 24 4
gpt4 key购买 nike

当我尝试运行示例 Google AI 时,出现以下错误,如 Configure and Run the sample 所示-

(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: ''

不确定这是否相关。但是,我也有一个arecord问题-

(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

音频输出测试,如Google AI setup guide中所述。作品。另外,我已经完成了链接中描述的步骤 2 到 4。但它并没有修复错误。

此命令有效 -

(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

有办法解决这个问题吗?

谢谢。

最佳答案

将 ~/.asoundrc 更改为以下内容

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

关于python - RaspberryPi 3 上的 Google Assistant SDK - sounddevice.PortAudioError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43958779/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com