我对Python (和一般编程)比较陌生,正在尝试使用语音识别库。然而,当使用Mac OSX在Python 3.3上运行一个非常简单的程序时。
import speech_recognition as sr
r = sr.Recognizer()
sr.adjust_for_ambient_noise(source, duration = 1)
with sr.Microphone() as source: # use the default microphone as the audio source
audio = r.listen(source)