Raspberry Python wit.ai使用
作者:互联网
我已经在树莓上安装了WIP,但是当我要使用它时,出现此错误
[wit] initialized sox: 14.4.0
[wit] init state machine
[wit] initialized with device: default
[wit] ready. state=idle
formats: can't open input `default': snd_pcm_open error: No such file or directory
[wit] couldn't open input device using alsa. Trying with coreaudio...
formats: no handler for given file type `coreaudio'
[wit] Failed to open input device
task '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value',
/home/martin/rust/src/libcore/option.rs:357
解决方法:
编辑〜/ .asoundrc并添加以下内容:
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "hw:0,0"
}
capture.pcm {
type plug
slave.pcm "hw:1,0"
}
}
This little ALSA configuration setting uses the default soundcard as playback device (hw:0,0) and sets hw:1,0 (that suppose to be your USB-mic) to become the default capture device.
(摘自“设置默认记录设备”下的http://wiki.audacityteam.org/wiki/USB_mic_on_Linux.)
要确定slave.pcm之后应该写什么,请运行以下命令:
aplay -l
arecord -l
结果将指示应该分别在playback.pcm和capture.pcm下显示的内容.
例如,arecord -l在我的机器上产生以下输出:
**** List of CAPTURE Hardware Devices ****
card 1: USBSA [Andrea PureAudio USB-SA], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0
slave.cpm旁边的文本应为“ hw:X,Y”,其中X和Y取自上面输出中的第二行:
card X: ..., device Y: ...
标签:raspberry-pi,wit-ai,python 来源: https://codeday.me/bug/20191028/1954751.html