2

I am running a Speech Recognition/PyAudio module on Raspberry PI. Every time I try to run my program, i end up with this message...

pi@raspberrypi ~/Desktop/Projects/EDWIN $ python edwin.py
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
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
Expression 'SetApproximateSampleRate( pcm, hwParams, sr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1968
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2643
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2767
Traceback (most recent call last):
File "edwin.py", line 6, in <module>
with sr.Microphone() as source:
File "/usr/local/lib/python2.7/dist-packages/speech_recognition/__init__.py", line 76, in __enter__
input = True, # stream is an input stream
File "/home/pi/Desktop/Projects/EDWIN/pyaudio.py", line 714, in open
stream = Stream(self, *args, **kwargs)
File "/home/pi/Desktop/Projects/EDWIN/pyaudio.py", line 396, in __init__
self._stream = pa.open(**arguments)
IOError: [Errno Invalid sample rate] -9997

Please help me. I don't know where to edit the sample rate.

1

I'm assuming you're using the command arecord to record audio. I had this same problem a while back.

Simply add --rate 48000 to your arecord command.

If you are using pocketsphinx for your speech recognition:

Then you also need to add -samprate 48000 to your pocketsphinx command.

  • Update: I figured out the problem. Now I have a different error... It now says input overflowed. I'm guessing it has something to do with the number of chunks? – user3718874 Nov 16 '15 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.