【发布时间】: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