4

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!

Braiam
  • 1
  • 11
  • 47
  • 78
Daniel Wolf
  • 41
  • 1
  • 2

3 Answers3

4

I got this error because I accidentally ran

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

and then tried to open another stream.

Karl Wolf
  • 188
  • 3
  • 10
3

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).

julio
  • 69
  • 7
0

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.