Closed santhoshrsk closed 7 years ago
Hi, I rectified this problem by reflashing my raspberry pi with new os and started again from scratch. But program works fine with my webcam microphone and when i change it to usb microphone it shows " IOError: -9997 Invalid sample rate"
to check sample rate, i gave sample rate as 44100 in Microphone declaration part in _main.py , then it is working but it is very slow, what to do now?
Hi @santhoshrsk,
Can you run python -c "import pyaudio;audio=pyaudio.PyAudio();print([audio.get_device_info_by_index(i) for i in range(audio.get_device_count())])"
, and then paste the result here?
Also, try setting chunk_size
to a larger value, like Microphone(chunk_size=8192)
, and see if that makes things a bit faster.
Hi, I'm having problems with ALSA when I run the library, I'm using Ubuntu 16.04 LTS (4.4.0-22-generic).
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_direct.c:1562:(_snd_pcm_direct_get_slave_ipc_offset) Invalid value for card ALSA lib pcm_direct.c:1562:(_snd_pcm_direct_get_slave_ipc_offset) Invalid value for card ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
This is output of the command that Uberi suggested in the post before.
~$ python -c "import pyaudio;audio=pyaudio.PyAudio();print([audio.get_device_info_by_index(i) for i in range(audio.get_device_count())])" ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_direct.c:1562:(_snd_pcm_direct_get_slave_ipc_offset) Invalid value for card ALSA lib pcm_direct.c:1562:(_snd_pcm_direct_get_slave_ipc_offset) Invalid value for card [{'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': 0.008707482993197279, 'maxInputChannels': 2L, 'structVersion': 2L, 'hostApi': 0L, 'index': 0, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 2L, 'name': u'HDA Intel PCH: ALC269VC Analog (hw:0,0)', 'defaultHighInputLatency': 0.034829931972789115}, {'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': -1.0, 'maxInputChannels': 0L, 'structVersion': 2L, 'hostApi': 0L, 'index': 1, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 8L, 'name': u'HDA Intel PCH: HDMI 0 (hw:0,3)', 'defaultHighInputLatency': -1.0}, {'defaultSampleRate': 48000.0, 'defaultLowOutputLatency': 0.021333333333333333, 'defaultLowInputLatency': 0.021333333333333333, 'maxInputChannels': 128L, 'structVersion': 2L, 'hostApi': 0L, 'index': 2, 'defaultHighOutputLatency': 0.021333333333333333, 'maxOutputChannels': 128L, 'name': u'sysdefault', 'defaultHighInputLatency': 0.021333333333333333}, {'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': -1.0, 'maxInputChannels': 0L, 'structVersion': 2L, 'hostApi': 0L, 'index': 3, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 2L, 'name': u'front', 'defaultHighInputLatency': -1.0}, {'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': -1.0, 'maxInputChannels': 0L, 'structVersion': 2L, 'hostApi': 0L, 'index': 4, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 2L, 'name': u'surround40', 'defaultHighInputLatency': -1.0}, {'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': -1.0, 'maxInputChannels': 0L, 'structVersion': 2L, 'hostApi': 0L, 'index': 5, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 2L, 'name': u'surround51', 'defaultHighInputLatency': -1.0}, {'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': -1.0, 'maxInputChannels': 0L, 'structVersion': 2L, 'hostApi': 0L, 'index': 6, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 2L, 'name': u'surround71', 'defaultHighInputLatency': -1.0}, {'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': -1.0, 'maxInputChannels': 0L, 'structVersion': 2L, 'hostApi': 0L, 'index': 7, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 8L, 'name': u'hdmi', 'defaultHighInputLatency': -1.0}, {'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': 0.008707482993197279, 'maxInputChannels': 32L, 'structVersion': 2L, 'hostApi': 0L, 'index': 8, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 32L, 'name': u'pulse', 'defaultHighInputLatency': 0.034829931972789115}, {'defaultSampleRate': 48000.0, 'defaultLowOutputLatency': 0.021333333333333333, 'defaultLowInputLatency': -1.0, 'maxInputChannels': 0L, 'structVersion': 2L, 'hostApi': 0L, 'index': 9, 'defaultHighOutputLatency': 0.021333333333333333, 'maxOutputChannels': 2L, 'name': u'dmix', 'defaultHighInputLatency': -1.0}, {'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': 0.008707482993197279, 'maxInputChannels': 32L, 'structVersion': 2L, 'hostApi': 0L, 'index': 10, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 32L, 'name': u'default', 'defaultHighInputLatency': 0.034829931972789115}]
I've also tried changing the chunk_size value to 8192 and the problem persist.
Thanks in advance! NB
Hi @nbulian,
For some reason, it seems like you have a device on index 1, but not index 0. You can get around this by using Microphone(device_index=1)
instead of Microphone()
in your code.
Hi @Uberi Thanks for your response! I did what you propose, but the problem with ALSA persist, but at least in another line!
Any way, thanks for your awesome work and your help.
ALSA lib pcm_dsnoop.c:606:(snd_pcm_dsnoop_open) unable to open slave ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_direct.c:1562:(_snd_pcm_direct_get_slave_ipc_offset) Invalid value for card ALSA lib pcm_direct.c:1562:(_snd_pcm_direct_get_slave_ipc_offset) Invalid value for card
@nbulian, can you post the code you're using, verbatim?
This is the code I'm using:
import speech_recognition import pyttsx
speech_engine = pyttsx.init('espeak') speech_engine.setProperty('rate', 150)
def speak(text): speech_engine.say(text) speech_engine.runAndWait()
recognizer = speech_recognition.Recognizer()
def listen(): with speech_recognition.Microphone() as source: recognizer.adjust_for_ambient_noise(source) audio = recognizer.listen(source)
try: return recognizer.recognize_sphinx(audio) except speech_recognition.UnknownValueError: print("Could not understand audio") except speech_recognition.RequestError as e: print("Recog Error; {0}".format(e))
return ""
speak("Say something!") speak("I heard you say " + listen())
I'm having a same problem
"a moment of silence please.. Set minimum threshold to 48.5477227879 say something! " ALSA lib pcm_dmix.c :1022:(snd_pcm_dmix_open) unable to open slave
here is my output from audio.get_device_info_by_index(i)
python -c "import pyaudio;audio=pyaudio.PyAudio();print([audio.get_device_info_by_index(i) for i in range(audio.get_device_count())])" ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave [{'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultLowInputLatency': -1.0, 'maxInputChannels': 0L, 'structVersion': 2L, 'hostApi': 0L, 'index': 0, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 2L, 'name': u'bcm2835 ALSA: - (hw:0,0)', 'defaultHighInputLatency': -1.0}, {'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultLowInputLatency': -1.0, 'maxInputChannels': 0L, 'structVersion': 2L, 'hostApi': 0L, 'index': 1, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 2L, 'name': u'bcm2835 ALSA: IEC958/HDMI (hw:0,1)', 'defaultHighInputLatency': -1.0}, {'defaultSampleRate': 48000.0, 'defaultLowOutputLatency': -1.0, 'defaultLowInputLatency': 0.007979166666666667, 'maxInputChannels': 1L, 'structVersion': 2L, 'hostApi': 0L, 'index': 2, 'defaultHighOutputLatency': -1.0, 'maxOutputChannels': 0L, 'name': u'USB Device 0x46d:0x81a: Audio (hw:1,0)', 'defaultHighInputLatency': 0.032}, {'defaultSampleRate': 48000.0, 'defaultLowOutputLatency': -1.0, 'defaultLowInputLatency': 0.021333333333333333, 'maxInputChannels': 128L, 'structVersion': 2L, 'hostApi': 0L, 'index': 3, 'defaultHighOutputLatency': -1.0, 'maxOutputChannels': 0L, 'name': u'sysdefault', 'defaultHighInputLatency': 0.021333333333333333}, {'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': 0.008707482993197279, 'maxInputChannels': 32L, 'structVersion': 2L, 'hostApi': 0L, 'index': 4, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 32L, 'name': u'pulse', 'defaultHighInputLatency': 0.034829931972789115}, {'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': 0.008707482993197279, 'maxInputChannels': 32L, 'structVersion': 2L, 'hostApi': 0L, 'index': 5, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 32L, 'name': u'default', 'defaultHighInputLatency': 0.034829931972789115}, {'defaultSampleRate': 48000.0, 'defaultLowOutputLatency': 0.042666666666666665, 'defaultLowInputLatency': 0.021333333333333333, 'maxInputChannels': 2L, 'structVersion': 2L, 'hostApi': 2L, 'index': 6, 'defaultHighOutputLatency': 0.042666666666666665, 'maxOutputChannels': 2L, 'name': u'system', 'defaultHighInputLatency': 0.021333333333333333}]
here is my cat /proc/asound/cards
0 [ALSA ]: bcm2835 ...... 1 [U0x ... }: USA-AUdio - USB Device 0x46d:0x81a .....
I'm using RPi3 and logitec webcam with mic to record, the input sound is loud and clear
@santhoshrsk, which part is slow, specifically?
@nbulian, actually, device_index=0
is correct, not device_index=1
as I said originally. Does this work for you? Also, there seems to be something wrong with your ALSA configuration; can you use arecord
to obtain microphone recordings?
@hoangpx, try Microphone(device_index=2)
- notice that the entry at index 2 is your actual USB sound card.
@Uberi ,When i use usb microphone, it is working only sample rate 44100 and i increased chunk size also to max of 8192 and when i speak it takes minimum 1 to 3 minutes to recognise and analyse takes some more time ,final result is taking about 5 to 7 minutes every time,even for a single word.
@Uberi I have a similar problem with speech_recognition, I ran you code on terminal it gave me below output
python -c "import pyaudio;audio=pyaudio.PyAudio();print([audio.get_device_info_by_index(i) for i in range(audio.get_device_count())])"
It gave me following output
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
[
{
'defaultSampleRate': 44100.0,
'defaultLowOutputLatency': 0.005804988662131519,
'defaultLowInputLatency': 0.005804988662131519,
'maxInputChannels': 2L,
'structVersion': 2L,
'hostApi': 0L,
'index': 0,
'defaultHighOutputLatency': 0.034829931972789115,
'maxOutputChannels': 2L,
'name': u'HDA Intel: 92HD71B7X Analog (hw:0,0)',
'defaultHighInputLatency': 0.034829931972789115
},
{
'defaultSampleRate': 44100.0,
'defaultLowOutputLatency': 0.005804988662131519,
'defaultLowInputLatency': -1.0,
'maxInputChannels': 0L,
'structVersion': 2L,
'hostApi': 0L,
'index': 1,
'defaultHighOutputLatency': 0.034829931972789115,
'maxOutputChannels': 2L,
'name': u'HDA Intel: 92HD71B7X Digital (hw:0,1)',
'defaultHighInputLatency': -1.0
},
{
'defaultSampleRate': 44100.0,
'defaultLowOutputLatency': 0.005804988662131519,
'defaultLowInputLatency': -1.0,
'maxInputChannels': 0L,
'structVersion': 2L,
'hostApi': 0L,
'index': 2,
'defaultHighOutputLatency': 0.034829931972789115,
'maxOutputChannels': 8L,
'name': u'HDA Intel: HDMI 0 (hw:0,3)',
'defaultHighInputLatency': -1.0
},
{
'defaultSampleRate': 48000.0,
'defaultLowOutputLatency': 0.021333333333333333,
'defaultLowInputLatency': 0.021333333333333333,
'maxInputChannels': 128L,
'structVersion': 2L,
'hostApi': 0L,
'index': 3,
'defaultHighOutputLatency': 0.021333333333333333,
'maxOutputChannels': 128L,
'name': u'sysdefault',
'defaultHighInputLatency': 0.021333333333333333
},
{
'defaultSampleRate': 44100.0,
'defaultLowOutputLatency': 0.005804988662131519,
'defaultLowInputLatency': -1.0,
'maxInputChannels': 0L,
'structVersion': 2L,
'hostApi': 0L,
'index': 4,
'defaultHighOutputLatency': 0.034829931972789115,
'maxOutputChannels': 2L,
'name': u'front',
'defaultHighInputLatency': -1.0
},
{
'defaultSampleRate': 44100.0,
'defaultLowOutputLatency': 0.005804988662131519,
'defaultLowInputLatency': -1.0,
'maxInputChannels': 0L,
'structVersion': 2L,
'hostApi': 0L,
'index': 5,
'defaultHighOutputLatency': 0.034829931972789115,
'maxOutputChannels': 2L,
'name': u'surround40',
'defaultHighInputLatency': -1.0
},
{
'defaultSampleRate': 44100.0,
'defaultLowOutputLatency': 0.005804988662131519,
'defaultLowInputLatency': -1.0,
'maxInputChannels': 0L,
'structVersion': 2L,
'hostApi': 0L,
'index': 6,
'defaultHighOutputLatency': 0.034829931972789115,
'maxOutputChannels': 2L,
'name': u'surround51',
'defaultHighInputLatency': -1.0
},
{
'defaultSampleRate': 44100.0,
'defaultLowOutputLatency': 0.005804988662131519,
'defaultLowInputLatency': -1.0,
'maxInputChannels': 0L,
'structVersion': 2L,
'hostApi': 0L,
'index': 7,
'defaultHighOutputLatency': 0.034829931972789115,
'maxOutputChannels': 2L,
'name': u'surround71',
'defaultHighInputLatency': -1.0
},
{
'defaultSampleRate': 44100.0,
'defaultLowOutputLatency': 0.005804988662131519,
'defaultLowInputLatency': -1.0,
'maxInputChannels': 0L,
'structVersion': 2L,
'hostApi': 0L,
'index': 8,
'defaultHighOutputLatency': 0.034829931972789115,
'maxOutputChannels': 2L,
'name': u'iec958',
'defaultHighInputLatency': -1.0
},
{
'defaultSampleRate': 44100.0,
'defaultLowOutputLatency': 0.005804988662131519,
'defaultLowInputLatency': -1.0,
'maxInputChannels': 0L,
'structVersion': 2L,
'hostApi': 0L,
'index': 9,
'defaultHighOutputLatency': 0.034829931972789115,
'maxOutputChannels': 2L,
'name': u'spdif',
'defaultHighInputLatency': -1.0
},
{
'defaultSampleRate': 44100.0,
'defaultLowOutputLatency': 0.005804988662131519,
'defaultLowInputLatency': -1.0,
'maxInputChannels': 0L,
'structVersion': 2L,
'hostApi': 0L,
'index': 10,
'defaultHighOutputLatency': 0.034829931972789115,
'maxOutputChannels': 8L,
'name': u'hdmi',
'defaultHighInputLatency': -1.0
},
{
'defaultSampleRate': 44100.0,
'defaultLowOutputLatency': 0.008707482993197279,
'defaultLowInputLatency': 0.008707482993197279,
'maxInputChannels': 32L,
'structVersion': 2L,
'hostApi': 0L,
'index': 11,
'defaultHighOutputLatency': 0.034829931972789115,
'maxOutputChannels': 32L,
'name': u'pulse',
'defaultHighInputLatency': 0.034829931972789115
},
{
'defaultSampleRate': 48000.0,
'defaultLowOutputLatency': 0.021333333333333333,
'defaultLowInputLatency': -1.0,
'maxInputChannels': 0L,
'structVersion': 2L,
'hostApi': 0L,
'index': 12,
'defaultHighOutputLatency': 0.021333333333333333,
'maxOutputChannels': 2L,
'name': u'dmix',
'defaultHighInputLatency': -1.0
},
{
'defaultSampleRate': 44100.0,
'defaultLowOutputLatency': 0.008707482993197279,
'defaultLowInputLatency': 0.008707482993197279,
'maxInputChannels': 32L,
'structVersion': 2L,
'hostApi': 0L,
'index': 13,
'defaultHighOutputLatency': 0.034829931972789115,
'maxOutputChannels': 32L,
'name': u'default',
'defaultHighInputLatency': 0.034829931972789115
}
]
Below is my code, I am trying to execute
import aiml
import pyttsx
import pyaudio
import speech_recognition as sr
import os
kernel = aiml.Kernel()
r = sr.Recognizer()
engine = pyttsx.init('espeak')
rate = engine.getProperty('rate')
engine.setProperty('rate', rate-50)
if os.path.isfile("bot_brain.brn"):
kernel.bootstrap(brainFile = "bot_brain.brn")
else:
kernel.bootstrap(learnFiles = "std-startup.xml", commands = "load aiml b")
kernel.saveBrain("bot_brain.brn")
# Press CTRL-C to break this loop
while True:
with sr.Microphone() as source:
print("Say something!")
audio = r.listen(source)
try:
print("You said : " + r.recognize_google(audio))
input = r.recognize_google(audio)
# input = raw_input("Enter your message >> ")
response = kernel.respond(input)
print response
engine.say(response)
engine.runAndWait()
except sr.UnknownValueError:
print("I could not understand what you just said")
except sr.RequestError as e:
print("Could not request results".format(e))
$ cat /proc/asound/cards
0 [Intel ]: HDA-Intel - HDA Intel
HDA Intel at 0xdd000000 irq 32
I also tired using device_index=0
, but it gave me below error.
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Traceback (most recent call last):
File "startup.py", line 24, in <module>
with sr.Microphone(device_index=0) as source:
File "/usr/local/lib/python2.7/dist-packages/speech_recognition/__init__.py", line 116, in __enter__
input = True, # stream is an input stream
File "/usr/local/lib/python2.7/dist-packages/pyaudio.py", line 750, in open
stream = Stream(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pyaudio.py", line 441, in __init__
self._stream = pa.open(**arguments)
IOError: [Errno -9997] Invalid sample rate
Can you please guide me where I am going wrong... Thanks in advance.
I am having the same problem. Even when I specify device_index=2 when creating a microphone object I still get the errors. I have tried numerous things such as changing the device index manually which didn't work. It works with arecord but that's it. If you want them I can post the errors.
It seems like things worked out for @hoangpx and @nbulian in this thread, so:
Microphone(sample_rate=44100)
- your microphone's default sample rate seems to be 44.1 kHz.Hi, great work @Uberi . I would like to bring in your notice that it worked perfectly when i initially tested examples but later i got same problem.
import speech_recognition as sr
# obtain audio from the microphone
r = sr.Recognizer()
with sr.Microphone(sample_rate = 44100) as source:
print("Say something!")
audio = r.listen(source)
# recognize speech using Wit.ai
WIT_AI_KEY = "********************************" # Wit.ai keys are 32-character uppercase alphanumeric strings
try:
print("Wit.ai thinks you said " + r.recognize_wit(audio, key=WIT_AI_KEY))
except sr.UnknownValueError:
print("Wit.ai could not understand audio")
except sr.RequestError as e:
print("Could not request results from Wit.ai service; {0}".format(e))
ALSA lib pcm_dsnoop.c:606:(snd_pcm_dsnoop_open) unable to open slave ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave Say something!
Here is more info
{'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': -1.0, 'maxInputChannels': 0L, 'structVersion': 2L, 'hostApi': 0L, 'index': 0, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 8L, 'name': u'HDA Intel HDMI: 0 (hw:0,3)', 'defaultHighInputLatency': -1.0},
{'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': 0.008707482993197279, 'maxInputChannels': 2L, 'structVersion': 2L, 'hostApi': 0L, 'index': 1, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 2L, 'name': u'HDA Intel PCH: ALC3227 Analog (hw:1,0)', 'defaultHighInputLatency': 0.034829931972789115},
{'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': -1.0, 'maxInputChannels': 0L, 'structVersion': 2L, 'hostApi': 0L, 'index': 2, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 8L, 'name': u'hdmi', 'defaultHighInputLatency': -1.0},
{'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': 0.008707482993197279, 'maxInputChannels': 32L, 'structVersion': 2L, 'hostApi': 0L, 'index': 3, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 32L, 'name': u'pulse', 'defaultHighInputLatency': 0.034829931972789115},
{'defaultSampleRate': 44100.0, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultLowInputLatency': 0.008707482993197279, 'maxInputChannels': 32L, 'structVersion': 2L, 'hostApi': 0L, 'index': 4, 'defaultHighOutputLatency': 0.034829931972789115, 'maxOutputChannels': 32L, 'name': u'default', 'defaultHighInputLatency': 0.034829931972789115}`
And how do you identify Mic from this info?
Edit:
cat /proc/asound/cards
0 [HDMI ]: HDA-Intel - HDA Intel HDMI
HDA Intel HDMI at 0xb5710000 irq 48
1 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xb5714000 irq 47
hi @Uberi this is the error i am getting when i run the code below
please help me in
I am also getting this error
ALSA lib pcm_dsnoop.c:606:(snd_pcm_dsnoop_open) unable to open slave ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave Cannot lock down 82274202 byte memory area (Cannot allocate memory)
Here is my code
i have tried all the solutions given above but nothing works for me.
Hi @jatinkatyal ,
I am getting the same error as you posted. Were you able to narrow down the issue?
I am testing the microphone example with sphinx:
Any help would be appreciated! Thank you.
Hi @soumya-gk, @jatinkatyal,
We now have a new troubleshooting entry, https://github.com/Uberi/speech_recognition#the-recognizer-hangs-on-recognizer_instancelisten-specifically-when-its-calling-microphonemicrophonestreamread, which may be a solution for that issue. Give that a try!
Thank you @Uberi . I tried with different device indices and although that does not remove the error messages - the recognition worked. Currently it is working without providing any index too.
I have the same problem My output is:
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_lfe
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
Microphone with name "HDA Intel HDMI: 0 (hw:0,3)" found for `Microphone(device_index=0)`
Microphone with name "HDA Intel HDMI: 1 (hw:0,7)" found for `Microphone(device_index=1)`
Microphone with name "HDA Intel HDMI: 2 (hw:0,8)" found for `Microphone(device_index=2)`
Microphone with name "HDA Intel PCH: ALC283 Analog (hw:1,0)" found for `Microphone(device_index=3)`
Microphone with name "hdmi" found for `Microphone(device_index=4)`
Microphone with name "pulse" found for `Microphone(device_index=5)`
Microphone with name "default" found for `Microphone(device_index=6)`
Microphone with name "/dev/dsp1" found for `Microphone(device_index=7)`
Hi @Bobbyissad,
Did you try to troubleshooting advice? Does it work when you select the correct device index?
Hi @Uberi , I'm having the same problem, I tried every index, it doesn't seem to work, could it be because I'm using built-in microphone on laptop or it doesn't matter?
me too. the same
I'm getting following output
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
when i try to execute the following code
import speech_recognition as sr
miclist=sr.Microphone.list_microphone_names()
@SimeonAleksov, @alex-sch-acc, the microphone being internal should not matter, but it's strange that it's not showing up in the PyAudio devices list. Can you post the output of the debugging instructions in a new issue?
@harsh8398, I'd be happy to take a look in a new issue. For now, I'm closing this one since the original problem seems to have been resolved.
python -c "import pyaudio;audio=pyaudio.PyAudio();print([audio.get_device_info_by_index(i) for i in range(audio.get_device_count())])"
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
[{'index': 0, 'structVersion': 2, 'name': 'HDA Intel PCH: CA0132 Analog (hw:0,0)', 'hostApi': 0, 'maxInputChannels': 2, 'maxOutputChannels': 2, 'defaultLowInputLatency': 0.005804988662131519, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultHighInputLatency': 0.034829931972789115, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 1, 'structVersion': 2, 'name': 'HDA Intel PCH: CA0132 Analog Mic-In2 (hw:0,2)', 'hostApi': 0, 'maxInputChannels': 2, 'maxOutputChannels': 0, 'defaultLowInputLatency': 0.005804988662131519, 'defaultLowOutputLatency': -1.0, 'defaultHighInputLatency': 0.034829931972789115, 'defaultHighOutputLatency': -1.0, 'defaultSampleRate': 44100.0}, {'index': 2, 'structVersion': 2, 'name': 'HDA Intel PCH: HDMI 0 (hw:0,3)', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 8, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 3, 'structVersion': 2, 'name': 'HDA Intel PCH: CA0132 What U Hear (hw:0,4)', 'hostApi': 0, 'maxInputChannels': 2, 'maxOutputChannels': 0, 'defaultLowInputLatency': 0.005804988662131519, 'defaultLowOutputLatency': -1.0, 'defaultHighInputLatency': 0.034829931972789115, 'defaultHighOutputLatency': -1.0, 'defaultSampleRate': 44100.0}, {'index': 4, 'structVersion': 2, 'name': 'HDA Intel PCH: HDMI 1 (hw:0,7)', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 8, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 5, 'structVersion': 2, 'name': 'HDA Intel PCH: HDMI 2 (hw:0,8)', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 8, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 6, 'structVersion': 2, 'name': 'HDA Intel PCH: HDMI 3 (hw:0,9)', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 8, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 7, 'structVersion': 2, 'name': 'HDA Intel PCH: HDMI 4 (hw:0,10)', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 8, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 8, 'structVersion': 2, 'name': 'HDA NVidia: HDMI 0 (hw:1,3)', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 8, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 9, 'structVersion': 2, 'name': 'sysdefault', 'hostApi': 0, 'maxInputChannels': 128, 'maxOutputChannels': 128, 'defaultLowInputLatency': 0.021333333333333333, 'defaultLowOutputLatency': 0.021333333333333333, 'defaultHighInputLatency': 0.021333333333333333, 'defaultHighOutputLatency': 0.021333333333333333, 'defaultSampleRate': 48000.0}, {'index': 10, 'structVersion': 2, 'name': 'front', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 2, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 11, 'structVersion': 2, 'name': 'surround40', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 2, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 12, 'structVersion': 2, 'name': 'surround51', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 2, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 13, 'structVersion': 2, 'name': 'surround71', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 2, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 14, 'structVersion': 2, 'name': 'hdmi', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 8, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.005804988662131519, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 15, 'structVersion': 2, 'name': 'pulse', 'hostApi': 0, 'maxInputChannels': 32, 'maxOutputChannels': 32, 'defaultLowInputLatency': 0.008707482993197279, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultHighInputLatency': 0.034829931972789115, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}, {'index': 16, 'structVersion': 2, 'name': 'dmix', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 2, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.021333333333333333, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.021333333333333333, 'defaultSampleRate': 48000.0}, {'index': 17, 'structVersion': 2, 'name': 'default', 'hostApi': 0, 'maxInputChannels': 32, 'maxOutputChannels': 32, 'defaultLowInputLatency': 0.008707482993197279, 'defaultLowOutputLatency': 0.008707482993197279, 'defaultHighInputLatency': 0.034829931972789115, 'defaultHighOutputLatency': 0.034829931972789115, 'defaultSampleRate': 44100.0}]
i have faced the same issue. ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
getting this errors. need help from you @Uberi
I have the same issue when I'm runnig the code,shuts this message: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map 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 JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
@Uberi please can you help me or any one here is my code import speech_recognition as sr import pyaudio
r = sr.Recognizer()
with sr.Microphone() as source: print('say something') audio = r.listen(source) voice_data = r.recognize_google(audio) print(voice_data)
and i get this output
ALSA lib pcm_dsnoop.c:641:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
say something
Traceback (most recent call last):
File "/root/PycharmProjects/jj/venv/Main.py", line 8, in
Process finished with exit code 1 can you help me to solve this please i'm still using it on my computer
ALSA lib pcm_dsnoop.c:641:(snd_pcm_dsnoop_open) unable to open slave ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2642:(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 connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory) attempt to connect to server failed connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory) attempt to connect to server failed ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory) attempt to connect to server failed
help me
i am having exac same errors as @kartikbisht2006 please help
same issue with @kartikbisht2006 but yet could not solve it. will be appreciated if anyone could help
Seems like an ALSA installation/configuration problem not specific to this particular project. I don't have the solution yet.
me too same problem
Here's my code `import speech_recognition as sr
Listener = sr.Recognizer()
def take_commands(): try: with sr.Microphone(device_index=0) as source: print('listening') audio = Listener.listen(source) text = Listener.recognize_google(audio) print(text) except: print('retry')
take_commands() **Here's my output**
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(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
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
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
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
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
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1513
Expression 'ValidateParameters( inputParameters, hostApi, StreamDirection_In )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2813
retry
(flask) mtula345@mtula345-ThinkPad-T520:~/python projects/timathon-jan/Timathon$ python commands.py
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(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
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
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
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
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
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card`
what to do
On Fri, 8 Jan 2021 at 15:30 M.Tuladhar Reddy notifications@github.com wrote:
what to do
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Uberi/speech_recognition/issues/100#issuecomment-756756352, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKOU2PJR7FUPC3QIPH2BKE3SY4CHLANCNFSM4B7NZBJA .
You are using which editor...??
first you must know your threshold !! to find out threshold type in terminal
then you will get a result - "Set minimum energy threshold to 1567.0664869865125" now copy the threshold then add this to your program like as
listener = sr.Recognizer()
listener.energy_threshold = 1568
listener.dynamic_energy_threshold = True
this way i solved my problem ! now its working
Yeah! It works here. Thank-you, Luban6887 !
Steps to reproduce
Initially when i was working with this program in my raspberry pi running jessie, everything went so fine. But from today morning it is not picking any audio from usb microphone and always setting threshold values as 48.5477227879 even high noise and low noise situation.
so i tried to reinstall program again, eventhough it didnt worked for me.
after running main.py program it shows
"a moment of silence please.. Set minimum threshold to 48.5477227879 say something! "
thats it, after this nothing is happening.
After some time i tried to run it through terminal, it shiows error as " ALSA lib pcm_dmix.c :1022:(snd_pcm_dmix_open) unable to open slave" say some thing
what shall i do now to make this program run.
Expected behaviour
Run program without error and recognise speech.
Actual behaviour
scenario 1: Running from python
program running , no error, it shows "a moment of silence please.. Set minimum threshold to 48.5477227879 say something! "
and stay like this for whole time.
scenario 2: Running from terminal
"ALSA lib pcm_dmix.c :1022:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm.c:2289:(snd_pcm_open_noupdate) unknown PCM cards.pcm rear ALSA lib pcm.c:2289:(snd_pcm_open_noupdate) unknown PCM cards.pcm center_lfe ALSA lib pcm.c:2289:(snd_pcm_open_noupdate) unknown PCM cards.pcm side ALSA lib pcm.c:2289:(snd_pcm_open_noupdate) unknown PCM cards.pcm hdmi ALSA lib pcm.c:2289:(snd_pcm_open_noupdate) unknown PCM cards.pcm hdmi ALSA lib pcm.c:2289:(snd_pcm_open_noupdate) unknown PCM cards.pcm modem ALSA lib pcm.c:2289:(snd_pcm_open_noupdate) unknown PCM cards.pcm modem ALSA lib pcm.c:2289:(snd_pcm_open_noupdate) unknown PCM cards.pcm phoneline ALSA lib pcm.c:2289:(snd_pcm_open_noupdate) unknown PCM cards.pcm phoneline ALSA lib pcm_dmix.c :1022:(snd_pcm_dmix_open) unable to open slave Say something"
and stay like this at all, no more recognition.
System information
My SpeechRecognition library version is <3.3.3>.
My PyAudio library version is <0.2.9>
I installed PocketSphinx from Debian repositories.