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

问题描述 投票:-3回答:1

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

以上代码未从麦克风获取声音

python speech-recognition pyaudio
1个回答
0
投票

只需使用conda install来安装pyaudio,它的作用相同。

© www.soinside.com 2019 - 2024. All rights reserved.