简体   繁体   English

我试用时,Google语音识别模块会抛出错误

[英]Google Speech Recognition module throws error when I try it out

I am working on a project in which I need to take input from my built-in microphone and process it in Python. 我正在开发一个项目,我需要从内置麦克风中获取输入并在Python中处理它。 The input will be a command, like "right", "left", "forward", etc. 输入将是一个命令,如“右”,“左”,“前进”等。

I found the speech recognition library here . 我在这里找到了语音识别库。

When I run the command python -m speech_recognition , I get the following output: 当我运行命令python -m speech_recognition ,我得到以下输出:

A moment of silence, please...
ALSA lib pcm_dsnoop.c:614:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1024:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:1024:(snd_pcm_dmix_open) unable to open slave
Cannot lock down 82274202 byte memory area (Cannot allocate memory)
Set minimum energy threshold to 48.5477227879
Say something!
ALSA lib pcm_dsnoop.c:614:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1024:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:1024:(snd_pcm_dmix_open) unable to open slave
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/speech_recognition /__main__.py", line 12, in <module>
with m as source: audio = r.listen(source)
  File "/usr/local/lib/python2.7/dist-packages/speech_recognition/__init__.py", line 377, in listen
    buffer = source.stream.read(source.CHUNK, exception_on_overflow = False)
TypeError: read() got an unexpected keyword argument 'exception_on_overflow'

This error means that your pyaudio is too old. 此错误意味着您的pyaudio太旧了。 The speech_recognition module expects very recent API from PyAudio 0.2.9, your have an older version. speech_recognition模块需要来自PyAudio 0.2.9的最新API,你的版本较旧。 Upgrade Pyaudio and error will go away. 升级Pyaudio并且错误将消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 语音识别抛出未知值错误 - Speech recognition throws unknown value error 为什么在 VSCode 中成功导入模块语音识别时实例化“识别器”时会出现 Python 错误? - Why am I getting a Python error when instantiating a 'Recognizer' while successfully importing module speech_recognition in VSCode? 每当我尝试访问语音识别程序中的文件时,我总是收到权限拒绝错误 - I keep getting a permission denial error whenever I try to access a file in a speech recognition program Google语音识别API凭据错误 - Google speech recognition API credentials error Google Cloud语音识别权限被拒绝错误 - Google Cloud Speech Recognition Permission Denied Error 没有模块名称“语音识别” - No Module name "Speech recognition" 之前工作的speech_recognition突然抛出错误 - speech_recognition which worked before throws an error all of a sudden 一段时间后,Python google 语音识别模块不起作用 - Python google speech recognition module doesn't work after a while 属性错误:模块“ speech_recognition”没有属性“ Recognizer” - Attribute error:module 'speech_recognition' has no attribute 'Recognizer' 如何使用 Speech_recognition 修复模块导入错误? - How to fix Module Import Error with speech_recognition?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM