Reputation: 161
I'm trying to create a python program to record and loop audio tracks using PyAudio with Ubuntu 16.04. I'm getting an error saying that "no default input device found". When I query the default device and try to list the total device I get the same result. But if I check within the Ubuntu OS itself all the devices can be seen. What could be the issue here? I have found some other threads saying that it could be an issue within the PortAudio library but don' know where to go from there?
info = audio.get_host_api_info_by_index(0)
numDevices = info.get('deviceCount')
print ("Number of sounds devices: " + str(numDevices))
for i in range(0, numDevices):
if audio.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels') > 0:
print("Input Device ID "+ i + " - " + audio.get_dev-ce_info_by_host_api_index(0,i).get('name'))
output: Number of sounds devices: 0
audio.get_default_output_device_info()
output:
Traceback (most recent call last):
File "query_sound_devices.py", line 9, in <module>
audio.get_default_output_device_info()
File "/usr/local/lib/python3.5/dist-packages/pyaudio.py", line 962, in get_default_output_device_info
device_index = pa.get_default_output_device()
OSError: No Default Output Device Available
OS output
root@osboxes:# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: I82801AAICH [Intel 82801AA-ICH], device 0: Intel ICH [Intel 82801AA-ICH]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: I82801AAICH [Intel 82801AA-ICH], device 1: Intel ICH - MIC ADC [Intel 82801AA-ICH - MIC ADC]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: C310 [Plantronics C310], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
Upvotes: 4
Views: 4071
Reputation: 87
This issue generally arises when you are using anaconda to install pyaudio and portaudio.
conda install nwani::portaudio nwani::pyaudio
conda remove pyaudio
conda remove portaudio
pip install pyaudio
Either of them will fix your issue.
Upvotes: 2