ArmDeveloperEcosystem / microphone-library-for-pico

Capture audio from a microphone on your Raspberry Pi Pico or any RP2040 based board. 🎤
Apache License 2.0
253 stars 50 forks source link

Support mic array? #3

Open nanfang2000 opened 3 years ago

nanfang2000 commented 3 years ago

Is it possible to support multiple PDM microphone and as USB microphone?

sandeepmistry commented 3 years ago

Hi @nanfang2000,

This should be possible to do for stereo PDM microphone input, however it is currently not supported by this library.

sandeepmistry commented 3 years ago

Happy to review a pull request for this feature. At this time there are no plans for our team to develop this feature.

CaydenPierce commented 2 years ago

Hey @nanfang2000 , did you make any progress here?

@sandeepmistry I am trying to do this and will PR if successful, any idea if we could go past two microphones, given that the microphone uses RP2040 PIO, which there are only two of?

CaydenPierce commented 2 years ago

I have done this here: https://github.com/CaydenPierce/MSA

Modifying the system to support multiple microphones at once with a master PIO state machine for data and clock and slave PIO state machines for just data. Currently I have 4 microphones streaming data in.

@sandeepmistry my repo is a fork of a fork, but I would be up to PR this stuff if we can make it work, checkout the repo

StuartIanNaylor commented 2 years ago

I have done this here: https://github.com/CaydenPierce/MSA

Modifying the system to support multiple microphones at once with a master PIO state machine for data and clock and slave PIO state machines for just data. Currently I have 4 microphones streaming data in.

@sandeepmistry my repo is a fork of a fork, but I would be up to PR this stuff if we can make it work, checkout the repo

Caydan that is really cool you also managed 48k x4 ? Anyone done this with I2S than PDM as notice the aliexpress modules seem to be much cheaper and also you could use ADC's.

This is really cool as respeaker do a collection of hats using TDM on the single pi port and there is no way to guarantee the channel order and in my mind totally useless even if sold by various vendors.

On the Pi I molested some code to do a delay-sum beamformer where really the only load is the GCC-PHAT to get TDOA. https://github.com/StuartIanNaylor/ProjectEars/tree/main/ds 2 channels on a zero2 runs about 60% on a single core but never progressed as the respeaker hats and clones because of the lack of TDM sync are sort of garbage. Also have fixed mics of a geometry ill suited for delay sum, due to aliasing makes them even more pointless.

Invensense did a great app note on simple beamforming https://invensense.tdk.com/download-pdf/an-1140-microphone-array-beamforming/

Where at 48Khz your 2 channel broadside should be approx 60-75mm which works in my above code molestation and if anyone is capable of providing a better neon optimised FFT then please do. It occured to me you could make a 4 channel directional array with only the overhead of GCC-Phat of 2 mics as likely the 2nd rear broadside can use the same TDOA as the front and the 21mm spacing between those 2 is static and likely could be calculated via the angle of the TDOA than running GCC_Phat gain. Never got round to implementing it due to the bad TDM/Fixed geometry implementation of the respeaker hats but the Pico/USB is sounding very interesting. Also wonder if you could get another port for an ADC that could be hardware loopback channels even though only one needed.

longhd2 commented 9 months ago

I have done this here: https://github.com/CaydenPierce/MSA

Modifying the system to support multiple microphones at once with a master PIO state machine for data and clock and slave PIO state machines for just data. Currently I have 4 microphones streaming data in.

@sandeepmistry my repo is a fork of a fork, but I would be up to PR this stuff if we can make it work, checkout the repo

I have built according to your git. But when copying to Pico it doesn't work. Although when building for 1 mic pdm thep git in the main branch it still works. Can you help me find out what's wrong?

lukeinator42 commented 1 month ago

@CaydenPierce I am also interested in how to get this working. I built your firmware and wired my mics up similar to the pcb schematic (I changed mics 3 and 4 to GPIO 14 and 15), but the usb device doesn't show up.

Did you need to overclock the pico? When I overclock mine, the device shows up but doesn't work as an audio device.