python3我的语音识别程序无法正常工作

时间:2018-08-03 01:51:06

标签: python audio speech-recognition speech-to-text voice-recognition

这是我的代码

import speech_recognition as sr  

# get audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
    print("Speak:")
    audio = r.listen(source)

try:
    print("You said " + r.recognize_google(audio))
except sr.UnknownValueError:
    print("Could not understand audio")
except sr.RequestError as e:
    print("Could not request results; {0}".format(e))

这是结果

#ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
#ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
#ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM                                                                   cards.pcm.center_lfe
#ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
#ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel     #map
#ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
#ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map

0 个答案:

没有答案