Daniel Wolf
Daniel Wolf

Reputation: 41

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

I am attempting to run a simple python file that uses pyaudio to record input. However whenever I run this file I end up with this error. I had it working once and I have no idea what changed. I have tried

import pyaudio
pa = pyaudio.PyAudio()
print(pa.get_device_count())
0

So I am seeing that it does not detect any valid devices. Is there anyway to specify to pyaudio/portaudio where to look for my input devices. I am running elementary os freya. Any help would be appreciated!

Upvotes: 4

Views: 6330

Answers (3)

Karl Wolf
Karl Wolf

Reputation: 198

I got this error because I accidentally ran

# p = pyaudio.PyAudio()
# ...
p.terminate()

and then tried to open another stream.

Upvotes: 4

julio
julio

Reputation: 79

Silly as it may seem, I had the same error, and I have been thinking: Drivers missing? Audio board missing? Microphone turned off by the OS?

No, I only needed to plug in the microphone (the actual, material, device).

Upvotes: 3

Bas van Dijk
Bas van Dijk

Reputation: 21

The code you paste works on my machine: I get 24. Try to reinstall your audio drivers, I'm assuming you are sure you have a working device connected.

Upvotes: 0

Related Questions