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

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

问题描述

我正在尝试将基本的 Python 语音转换为文本代码.这是代码.

I am 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 until it reaches the print stage, then it 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

推荐答案

如果有人还在寻找摆脱

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

我刚刚在

/usr/share/alsa/alsa.conf

文件,它对我来说很好.

file and it works fine for me.

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

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