leaving pyaudio stream open
I have four microphones, and I am currently working on determining the direction of arrival for sound. I am writing the code in Python on a MacBook. The problem arises when I run a test code to measure amplitude; I only receive inputs from two microphones, while the other two show an amplitude of 0. In the code, I use threading to record in parallel and keep the PyAudio stream open until the end, instead of closing it after each recording session. Previously, when I would open and close the stream for each recording, all four microphones worked. How can I solve the issue of the two microphones not recording anything? By the way, there is nothing wrong with the microphones or the ports. I have also tried using the sounddevice library.
I appreciate the help
12 Replies
I'd be cool if we could get some code. Apart from that did you check drivers are working ok?
Yeah
this is the test code i am running.
What output do you get?
Also there seems to be only 3 microphones
In your code
the set3 is the mic that is not working. i removed a mic to see if there would be any change
Also are you taking into account that there is delay?
I'm presuming you are
If you put the device as only set3 does it work?
yes
if they are either one or two mics, the code is working.
the conclusion i could arrive on is that there is a hardware restriction or pyaudio doesnt support multiple streams being opened for long time at all.
Have you tried a callback based approach?
I partially tried it but that was just limited to frames.