Uberi / speech_recognition

Speech recognition module for Python, supporting several engines and APIs, online and offline.
https://pypi.python.org/pypi/SpeechRecognition/
BSD 3-Clause "New" or "Revised" License
8.21k stars 2.39k forks source link

OSError: No Default Input Device Available #414

Open ambarmendez opened 5 years ago

ambarmendez commented 5 years ago

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
  2. 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
luisoto98 commented 3 years ago

HI,

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

Could you resolve it?

Thanks,

Anjali11110 commented 6 months ago

i have same error

DhruvGagani24 commented 2 months ago

i have same error