Raspberry Pi 3 上的 Google Assistant SDK:音频设置不起作用 [英] Google Assistant SDK on Raspberry Pi 3: Audio setup does not work

查看:77
本文介绍了Raspberry Pi 3 上的 Google Assistant SDK:音频设置不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试将 G 助手安装到 Raspberry Pi3.我在以下链接中有问题

I have been trying to install G assistant in to a Raspberry Pi3. I have question in the following link

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

来自上面链接的部分文字

A partial text from above link

# Record a short audio clip. If you get an error, go to step 2.
$ arecord --format=S16_LE --duration=5 --rate=16k --file-type=raw out.raw

正如预期的那样,我在这一步出错.所以我尝试 Step2 创建了一个包含所有硬件信息的新文件 (.asoundrc).然后我尝试了以下

As expected I got error in this step. So I tried the Step2 created a new file (.asoundrc) with all the hardware info. Then I tried following

speaker-test -t wav

但是我遇到了以下错误(如果我重命名 .asoundrc 我没有看到这个错误但我无法记录)

But I got following error ( If I rename .asoundrc I don't see this error but I cannot record)

speaker-test 1.0.28

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
WAV file(s)
ALSA lib conf.c:1697:(snd_config_load1) toplevel:9:17:Unexpected char
ALSA lib conf.c:3417:(config_file_open) /home/pi/.asoundrc may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3339:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:3788:(snd_config_update_r) hooks failed, removing configuration
Playback open error: -22,Invalid argument

我该如何解决这个问题?谢谢!

How can I fix this? Thanks!

推荐答案

如果您的 .asoundrc 没有正确的结构,就会发生这种情况.警告:如果您使用 rpi gui(桌面)音量控制来更改输入,它将为您修改 .asoundrc,从而破坏 ALSA for google Assistant.你必须去修理它.谷歌网站上的说明是正确的.

That happens if your .asoundrc doesn't have the correct structure. Warning: If you use the rpi gui (desktop) volume control to change inputs it will modify the .asoundrc for you, breaking ALSA for google assistant. You'll have to go and fix it up. The instructions on google's website are correct.

要修复它,请删除创建的新条目.然后,在顶部,查找type hw"行.它已被偷偷修改...您必须将其改回type asym"以匹配 google 指定的配置.

To fix it delete the new entries created. Then, at the top, look for the line 'type hw'. It has been sneakily modified... you'll have to change it back to 'type asym' to match the config google specify.

我将 gui(桌面)音量的输入/输出设置为模拟,一旦我开始使用谷歌助手就不要触摸它,这样它就不会再与 .asoundrc 混淆了.

I leave the input/output for the gui (desktop) volume set to analogue and don't touch it once I start using google assistant so it won't go and mess with .asoundrc again.

我使用的是 Logitech USB 耳机,它同时具有麦克风和扬声器(我不使用外部扬声器)所以,考虑到我的音频输入和输出到耳机,我的 .asoundrc 看起来像这样:

I am using a Logitech USB headset and which has both mic & speaker (I don't use external speaker) So, given my audio input and output goes to the headset, my .asoundrc looks like this:

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

最后,如果你重启你的树莓派,你必须重置助手二进制文件的源路径,否则它将无法找到启动助手演示的命令.通过键入source env/bin/activate"来执行此操作然后你可以通过输入google-assistant-demo"再次运行它

Lastly, if you reboot your Pi, you'll have to reset the source path for the assistant binary, otherwise it won't be able to find the command that starts the assistant demo. Do this by typing "source env/bin/activate" Then you can run it again by typing "google-assistant-demo"

祝你好运!

这篇关于Raspberry Pi 3 上的 Google Assistant SDK:音频设置不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆