我正在使用SpeechRecognition python库设置声音识别器。

到目前为止,这是我的代码:

#!/usr/bin/env python3

import speech_recognition as sr

r = sr.Recognizer('es-MX')

with sr.Microphone() as mic:
    audio = r.listen(mic)

print(r.recognize(audio))

运行时我得到
ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_l$
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started

我正在使用在Linux LXLE 14.04 x64和python 3.4上运行的SpeechRecognition版本1.3.1

最佳答案

它告诉您无法在设备上录制音频。它与插孔服务器无关,它还会尝试打开alsa设备和蓝牙音频设备。确保在设备上正确设置了音频。也可以看看

PyAudio does not work and bricks sound on ubuntu

PyAudio working, but spits out error messages each time

关于linux - speechRecognition : jack server is not running,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31642765/

10-10 18:15