【问题标题】:Python SpeechRecognition running but not hearing through the micPython SpeechRecognition 正在运行但无法通过麦克风听到
【发布时间】:2014-11-23 08:09:26
【问题描述】:

所以我正在尝试使用 python SpeechRecognition 1.1.3,但它无法通过我的麦克风识别我。我已经安装了 pyAudio,当我运行 SpeechRecognition 提供的示例代码时,一切似乎都很顺利:

# NOTE: this requires PyAudio because it uses the Microphone class
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:                # use the default microphone as the audio source
    audio = r.listen(source)                   # listen for the first phrase and extract it into audio data

try:
    print("You said " + r.recognize(audio))    # recognize speech using Google Speech Recognition
except LookupError:                            # speech is unintelligible
    print("Could not understand audio")

它只是等待听到麦克风的输入。麦克风工作正常,SpeechRecognition 能够识别它是默认麦克风,因为当我拔下它时,代码 barfs。有什么建议吗?

我正在运行 python 2.7.6,我的操作系统是 Windows 7。此外,我将所有这些都放在了 E: 驱动器上,只是为了让生活变得更复杂...:/

【问题讨论】:

  • 你检查过你的麦克风是否静音了吗?
  • 它没有被静音。我检查了我的录音设备,发现它在我说话时都会做出反应。

标签: python speech-recognition pyaudio


【解决方案1】:

根据脚本,Pyaudio 尚未安装。别担心,这是应用程序可能收到的常见语法错误。我建议你做的是你必须将你的 Python 程序重新安装到能够在 Pyaudio 1.1.3 下运行的版本。你没有指定你正在使用的 Python 版本,并且您的计算机在什么操作系统下运行(即 Windows Vista、7 或 8)。假设您使用的是 Windows 8 或 7,您必须在 windows cmd 中输入 easy_install。但是,如果这不起作用,请安装此 Python 脚本:http://peak.telecommunity.com/dist/ez_setup.py 然后通过输入来自C:\<Your python directory>\Scripts\easy_install 重新尝试该过程。希望这有帮助。

【讨论】:

    【解决方案2】:

    我也遇到过类似的问题,然后我意识到这是互联网连接问题。检查宽带连接速度或通过蜂窝网络连接进行测试。

    【讨论】:

      猜你喜欢
      • 2020-10-04
      • 1970-01-01
      • 1970-01-01
      • 2019-10-04
      • 1970-01-01
      • 1970-01-01
      • 2020-06-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多