linux - PyAudio 打印 ALSA 警告并且不起作用

标签 linux python-3.x speech-to-text alsa

我正在尝试运行一个基本的 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/

相关文章:

python 文件显示 AttributeError : module 'http' has no attribute 'client'

speech-recognition - 语音到文本的大型音频文件 [Microsoft Speech API]

android - 如何教 Android 语音识别器一门新语言

python - 识别 concurrent.futures.ThreadPoolExecutor 中的当前线程

database - 如果更改目录然后在 linux 中执行一些操作

c - C中的多线程无法正常工作

linux - docker 运行说 "No such image"

Python 编译字节码 : Unable to read file if non-ascii character are present

ios - 在支持多语言的 iOS 应用程序中使用 Openears 的最佳方式是什么?

linux - libCGAL_Qt5 缺少依赖项