shichao-an / soundmeter

Simple real-time sound meter
https://soundmeter.shichao.io
BSD 2-Clause "Simplified" License
82 stars 27 forks source link

IOError: [Errno -9996] Invalid input device (no default output device) #7

Open erikvold opened 8 years ago

erikvold commented 8 years ago

I'm getting the following error with osx 10.11 python 2.7.10

$ soundmeter --collect --seconds 10 -v
Traceback (most recent call last):
  File "/usr/local/bin/soundmeter", line 9, in <module>
    load_entry_point('soundmeter==0.1.3', 'console_scripts', 'soundmeter')()
  File "/Library/Python/2.7/site-packages/soundmeter/meter.py", line 310, in main
    m = Meter(**kwargs)
  File "/Library/Python/2.7/site-packages/soundmeter/meter.py", line 66, in __init__
    frames_per_buffer=FRAMES_PER_BUFFER)
  File "/Library/Python/2.7/site-packages/pyaudio.py", line 750, in open
    stream = Stream(self, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/pyaudio.py", line 441, in __init__
    self._stream = pa.open(**arguments)
IOError: [Errno -9996] Invalid input device (no default output device)
shichao-an commented 8 years ago

This sounds more like a pyaudio/portaudio error related to your audio hardware/driver. Since soundmeter is very high-level, which uses these library, it's difficult to tell what the problem is, especially when it's working on my side.

My suggestions are:

I searched symptoms for possible solutions:

You may want to take a look at these, and possibly use the following method to see if you have a default input device:

>>> import pyaudio
>>> pa = pyaudio.PyAudio()
>>> pa.get_default_input_device_info()
liguo-jlu commented 6 years ago

I run the function 'get_device_count' but got a 0.Is it the problem of my Operating System?

gatoatigrado commented 6 years ago

I got the same issue on Linux, and resolved it by first installing the ALSA dev library, re-building PortAudio, and then re-installing PyAudio. When you build PortAudio, the output from ./configure will tell you which backends it has available,

  Target ...................... x86_64-unknown-linux-gnu
  C++ bindings ................ no
  Debug output ................ no

  ALSA ........................ yes
  ASIHPI ...................... no

  OSS ......................... yes
  JACK ........................ no

I don't know about OS X, but maybe if you post your config here someone else can help?

sanjubaba123 commented 5 years ago

I am a linux user and I am gettnig same issue How I can resolve it

marvelous-ikechi commented 5 years ago

I have been struggling with the same issue for over a month now. Mine is OSError: No Default Input Device Available, and I think it's peculiar to my system as the same code runs on other systems.

import pyaudio pa = pyaudio.PyAudio() pa.get_default_input_device_info()

Trying to check my default input and output devices with the above lines of codes throws the same error.

Arch-gx commented 3 years ago

I got the same issue on Linux, and resolved it by first installing the ALSA dev library, re-building PortAudio, and then re-installing PyAudio. When you build PortAudio, the output from ./configure will tell you which backends it has available,

  Target ...................... x86_64-unknown-linux-gnu
  C++ bindings ................ no
  Debug output ................ no

  ALSA ........................ yes
  ASIHPI ...................... no

  OSS ......................... yes
  JACK ........................ no

I don't know about OS X, but maybe if you post your config here someone else can help?

Hello, my alsa display is installed successfully. But it still reported 9996 error. Could you tell me how to solve the problem。my system is ubuntu16.04

smarthand123 commented 3 years ago

On redhat, before compile install portaudio, first run yum install alsa*

xdtxAM commented 3 years ago

我也是遇到了这个问题 使用的是Pyaudio的Python程序。OSError: [Errno -9996] Invalid input device (no default output device)