我正在尝试运行一个基本的 python 语音到文本代码。这是代码。
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
audio = r.listen(source)
try:
print("You said " + r.recognize(audio))
except LookupError:
print("Could not understand audio")
代码在到达打印阶段之前工作正常,然后抛出此错误。我做错了什么吗?
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
最佳答案
如果有人还在寻找摆脱
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
我刚刚在“PCM 接口(interface)”部分注释掉了所有 pcm.surround* 行
/usr/share/alsa/alsa.conf
文件,它对我来说很好用。
关于linux - PyAudio 打印 ALSA 警告并且不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42504581/