speech_recognition icon indicating copy to clipboard operation
speech_recognition copied to clipboard

OSError: No Default Input Device Available

Open ambarmendez opened this issue 6 years ago • 3 comments

Steps to reproduce

  1. Everything started when trying out the installation of the package with
python -m speech_recognition

Then, execute the following commands:

sudo apt-get install portaudio19-dev python-all-dev python3-all-dev
sudo apt-get install python-pyaudio python3-pyaudio
conda install -c conda-forge portaudio
conda install -c anaconda pyaudio
  1. Despite having installed PyAudio, because of the microphone, got another error:
Traceback (most recent call last):
  File "/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/anaconda3/lib/python3.6/site-packages/speech_recognition/__main__.py", line 4, in <module>
    m = sr.Microphone()
  File "/anaconda3/lib/python3.6/site-packages/speech_recognition/__init__.py", line 86, in __init__
    device_info = audio.get_device_info_by_index(device_index) if device_index is not None else audio.get_default_input_device_info()
  File "/anaconda3/lib/python3.6/site-packages/pyaudio.py", line 949, in get_default_input_device_info
    device_index = pa.get_default_input_device()
OSError: No Default Input Device Available

Expected behaviour

A moment of silence, please...
Set minimum energy threshold to 600.4452854381937
Say something!

Actual behaviour

It does not detect any default microphone even though there is just one input device working properly because it was tested by executing the commands arecord and then aplay.

python -c "import speech_recognition as sr;print(sr.Microphone.list_microphone_names())"
[]

System information

My system is Linux version 4.19.0-4-amd64

My Python version is Python 3.6.8 :: Anaconda, Inc.

My Pip version is pip 19.0.3 from /anaconda3/lib/python3.6/site-packages/pip (python 3.6)

My SpeechRecognition library version is 3.6.3

My PyAudio library version is 0.2.11

My working microphones are: (Checked by running arecord -L.)

**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VC Analog [ALC269VC Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

ambarmendez avatar May 10 '19 13:05 ambarmendez

HI,

I have the same error and I can't resolve it.

Could you resolve it?

Thanks,

luisoto98 avatar Dec 04 '20 08:12 luisoto98

i have same error

Anjali11110 avatar Jan 29 '24 07:01 Anjali11110