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

懵懂的女人 提交于 2019-12-12 13:03:30

问题


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!


回答1:


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




回答2:


I got this error because I accidentally ran

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

and then tried to open another stream.




回答3:


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.



来源:https://stackoverflow.com/questions/33382305/pyaudio-ioerror-errno-invalid-input-device-no-default-output-device-9996

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!