当我在pycharm virtualenv,ubuntu18.04中运行此python代码
def listen():
recognizer = speech_recognition.Recognizer()
with speech_recognition.Microphone(device_index=0) as source:
audio = recognizer.listen(source)
message = ""
try:
message = recognizer.recognize_google(audio)
print("You said: " + message)
except speech_recognition.UnknownValueError:
print("Google Speech Recognition could not understand audio")
except speech_recognition.RequestError as error:
print("Cannot send request to google".format(error))
return message
say("Hi " + getpass.getuser() + " what can i do for you?")
data = listen()
我收到类似输出的错误:
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open)无法打开从属 ALSA lib pcm.c:2495:(snd_pcm_open_noupdate)未知PCM卡.pcm.rear ALSA lib pcm.c:2495:(snd_pcm_open_noupdate)未知PCM cards.pcm.center_lfe ALSA lib pcm.c:2495:(snd_pcm_open_noupdate)未知PCM卡.pcm.side ALSA lib pcm_route.c:867:(find_matching_chmap)未找到匹配项 频道地图 ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open)无法打开从站
如何解决? 这令人困惑,这表明ALSA。