[英]I installed pyaudio by conda install but my laptop is not taking audio from microphone
def takeCommand(): def takeCommand():
r = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
r.pause_threshold = 0.8
audio = r.listen(source)
try:
print("Recognizing...")
query = r.recognize_google(audio, language='en-in')
print("User said: {} \n".format(query))
except Exception as e:
# print(e)
print("Say that again please...")
return "None"
return query
above code is not taking voice from microphone上面的代码没有从麦克风中获取声音
只需使用 conda install 安装 pyaudio ,它的工作方式相同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.