在python中练习语音识别时,麦克风不会自行关闭

我正在尝试使用麦克风将语音转换为文本,并在最后打印输出。由于某种原因,它没有检测到任何东西,也没有给我输出。有人可以找出为什么不起作用吗?

我正在使用的代码是

r = sr.Recognizer()
with sr.microphone() as source:
    print("Bro say something!")
    audio = r.listen(source)

try:
    print("You precious words are: " + r.recognize_google(audio))
except sr.UnknownValueError:
    print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
    print("Could not request results from Google Speech Recognition service; {0}".format(e))

开始时,麦克风检测到我说的所有内容,但是经过3-4个小时后再次运行时,它不起作用。

PeterChia 回答:在python中练习语音识别时,麦克风不会自行关闭

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3052369.html

大家都在问