问题描述
重现问题的步骤(似乎仅适用于 PC):
离开并重新进入可以解决此问题,在第 2 步中的音频切断后更改扬声器输出也是如此。
这里是一些基本的代码。请注意,在某些时候,我确实发现这可以在不切断 discord 通话中的音频的情况下工作,所以我猜他们的一端有些断断续续——我只是想弄清楚如何很好地处理它。>
import speech_recognition as sr
r = sr.Recognizer()
m = sr.Microphone()
with m as source:
r.adjust_for_ambient_noise(source)
while(True):
print("Please say something...")
audio = r.listen(source)
command = ""
try:
# All the getting command stuff. 0 is a dummy number
command = r.recognize_google(audio)
print("You said : \n " + command)
if command.lower() == "quit": break
except:
print("Error getting command from microphone")
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)