简体   繁体   English

我通过 conda install 安装了 pyaudio,但我的笔记本电脑没有从麦克风中获取音频

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM