6

I'm setting up a sound recognizer with the speechRecognition python library.

This is my code so far:

#!/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))

On running I get

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

I'm using SpeechRecognition version 1.3.1 running on Linux LXLE 14.04 x64 with python 3.4

helado
  • 825
  • 2
  • 13
  • 26

2 Answers2

2

It tells you it can not record audio on your device. It is not related to a jack server, it also tries to open alsa device and bluetooth audio device. Make sure that audio is properly set on your device. See also

PyAudio does not work and bricks sound on ubuntu

PyAudio working, but spits out error messages each time

Community
  • 1
  • 1
Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
1

I am having this same error. If you would like a work around you can use my code I wrote. I used the sounddevice library to record audio while there is audio it saves into one file, then convert it to text using the speech recognition library. The error comes when microphone is called in as it is using PyAudio.

https://shepai.github.io/code/PetSHEP/soundLib.py

The following lines should replace your "with microphone" bit

with sr.AudioFile(filename) as source: Audio=r.record(source)

This is how I got round the problem, hope it helps :)

SHEP AI
  • 51
  • 4