Pyaudio does not recognize ReSpeaker usb microphones InputChannels

I have connected an USB microphone (ReSpeaker 4 Mic Array (UAC1.0)) to my Gentoo linux machine.

I would like to use that usb microphone for recording with pyaudio.

Pyaudio detects the USB device but does not detect its Input Channels.



This is the relevant part of the output from:

</s> import pyaudio p = pyaudio.PyAudio() for i in range(p.get_device_count()): print p.get_device_info_by_index(i)<e>

[code]> […]

‘maxOutputChannels’: 2L, ‘name’: u’HDA Intel PCH: AD198x Analog
(hw:0,0)’, ‘defaultHighInputLatency’: -1.0}

{‘defaultSampleRate’: 16000.0, ‘defaultLowOutputLatency’: 0.024,
‘defaultLowInputLatency’: -1.0, ‘maxInputChannels’: 0L,
‘structVersion’: 2L, ‘hostApi’: 0L, ‘index’: 1,
‘defaultHighOutputLatency’: 0.096, ‘maxOutputChannels’: 2L, ‘name’:
u’ReSpeaker 4 Mic Array (UAC1.0): USB Audio (hw:1,0)’,
‘defaultHighInputLatency’: -1.0}

{‘defaultSampleRate’: 44100.0, ‘defaultLowOutputLatency’: -1.0,
‘defaultLowInputLatency’: 0.008707482993197279, ‘maxInputChannels’:
2L, ‘structVersion’: 2L, ‘hostApi’: 0L, ‘index’: 2,
‘defaultHighOutputLatency’: -1.0, ‘maxOutputChannels’: 0L, ‘name’:
u’PrimeSense Device: USB Audio (hw:2,0)’, ‘defaultHighInputLatency’:
0.034829931972789115}

[…][/code]


wheras

</s> $ arecord -l<e>

Succesfully detected the mic as input device.
</s><i> </i> **** List of CAPTURE Hardware Devices **** card 0: PCH [HDA Intel PCH], device 0: AD198x Analog [AD198x Analog] Subdevices: 0/2 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 card 1: ArrayUAC10 [ReSpeaker 4 Mic Array (UAC1.0)], device 0: USB Audio [USB Audio] Subdevices: 0/1 Subdevice #0: subdevice #0 card 2: Device [PrimeSense Device], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: Phone [MT65xx Android Phone], device 0: USB Audio [USB Audio] Subdevices: 0/1 Subdevice #0: subdevice #0<e>

I Suppose arecord and pyaudio are indepenedent from each other, but

what can i do to have the Microphone recognized by Pyaudio as Mcrophone?

Is there some configuration file that has to be adapted?



Any help very much appreciated.

Hi there~



Please follow below link to get the index of the mic array. thanks.



<LINK_TEXT text=“http://wiki.seeedstudio.com/ReSpeaker_M … ract-voice”>http://wiki.seeedstudio.com/ReSpeaker_Mic_Array_v2.0/#extract-voice</LINK_TEXT>

[code]import pyaudio

p = pyaudio.PyAudio()
info = p.get_host_api_info_by_index(0)
numdevices = info.get(‘deviceCount’)

for i in range(0, numdevices):
if (p.get_device_info_by_host_api_device_index(0, i).get(‘maxInputChannels’)) > 0:
print "Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get(‘name’)[/code]

</s>seeed@seeed01:~$ seeed@seeed01:~$ python getindex.py ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map Input Device id 0 - HDA Intel PCH: ALC887-VD Analog (hw:0,0) Input Device id 2 - HDA Intel PCH: ALC887-VD Alt Analog (hw:0,2) Input Device id 5 - ReSpeaker 4 Mic Array (UAC1.0): USB Audio (hw:2,0) Input Device id 6 - sysdefault Input Device id 13 - pulse Input Device id 15 - default<e>

Thanks but the python code wont give the Index of the ReSpeaker Microphone since ‘maxInputChannels’: 0L …



I managed to solve it myself in the meantime:



check my stackoverflow post



<LINK_TEXT text=“https://stackoverflow.com/questions/570 … utchannels”>https://stackoverflow.com/questions/57054059/pyaudio-does-not-recognize-respeaker-usb-microphones-inputchannels</LINK_TEXT>