PyAudio打印ALSA警告并且不起作用 [英] PyAudio prints ALSA warnings and does not work

查看:745
本文介绍了PyAudio打印ALSA警告并且不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,我正在尝试对文本代码运行基本的python语音.这是代码.

hey guys i'm trying to run a basic python speech to text code. This is the code.

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")

代码可以正常工作,直到到达打印阶段,然后引发此错误.我做错了什么吗?

The code works fine till it reaches the print stage and then throws this error. Is there anything that i have done wrong?

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

感谢您的帮助,在此先感谢

Any help is appreciated and Thanks in advance

推荐答案

如果有人仍在寻找摆脱的机会

if someone is still looking for getting rid of

ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map

我刚刚注释了"PCM接口"部分中的所有pcm.surround *行

I just commented out all pcm.surround* lines in "PCM interface" section in

/usr/share/alsa/alsa.conf

文件,对我来说很好.

这篇关于PyAudio打印ALSA警告并且不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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