Some of you know a method to connect 4 microphones to a RPi and handle them seperate?

I want to calculate out when a soundwave hits the first microphone, the second, third and fourth (under water).

Can I just use 4 USB soundcards? Should it be possible? And do you have examples, maybe?

Or do you know a better option?

Best regards and thank you!!

  • If you're looking for fairly high resolution timing data you may be better off looking at Arduinos than Raspberry Pis, as the Pi's operating system has a tendency to get in the way. It's also worth considering whether you care about the content of the audio, in which case you'll need reasonable mics and sound cards, or whether you just care about the level of the audio, in which case you can get by with low end sensors mounted on breakouts that provide simple high/low outputs when audio crosses an amplitude threshold.
    – goobering
    Nov 27, 2016 at 11:40
  • @goobering I need the content of the audio. So i need USB soundcards and plug them directly to the RPi - right?
    – dessi
    Nov 27, 2016 at 12:20
  • How accurately do you need to know the timings? How do you plan to correlate the waveforms so you are comparing the same point in each sound?
    – joan
    Nov 27, 2016 at 16:28
  • It's combined with a speech recognition. So if there is a special word triggered on Mic1, start counter until it hits Mic2. Then it should calculate the direction where the sound came from (unter water :D). So it should be accurate but there is a tollerance that I can round/floor to a compass direction
    – dessi
    Nov 27, 2016 at 20:06

1 Answer 1


A sound card for the GPIO bus will be coming out soon which supports more then 2 channels input and 2 channels output, see here.

Until this happens, you will need to resort to multiple usb sound cards. The problem with multiple USB sound cards is that they will suffer clock drift. With that in mind, you can do the following (taken from the ALSA asoundrc page); Create the file ~/.asoundrc with the following in it (changing the hardware devices for the ones on your system and duplicating this example from 2 to 4 devices) :

# create a virtual four-channel device with two sound devices:
# This is in fact two interleaved stereo streams in
# different memory locations, so JACK will complain that it
# cannot get mmap-based access. see below.

pcm.multi {
        type multi;
        slaves.a.pcm "hw:0,0";
        slaves.a.channels 2;
        slaves.b.pcm "hw:1,0";
        slaves.b.channels 2;
        bindings.0.slave a;
        bindings.0.channel 0;
        bindings.1.slave a;
        bindings.1.channel 1;
        bindings.2.slave b;
        bindings.2.channel 0;
        bindings.3.slave b;
        bindings.3.channel 1;

# JACK will be unhappy if there is no mixer to talk to, so we set
# this to card 0. This could be any device but 0 is easy. 

ctl.multi {
        type hw;
        card 0;

# This creates a 4 channel interleaved pcm stream based on
# the multi device. JACK will work with this one.

pcm.ttable {
        type route;
        slave.pcm "multi";
        slave.channels 4;
        ttable.0.0 1;
        ttable.1.1 1;
        ttable.2.2 1;
        ttable.3.3 1;
# see above.
ctl.ttable {
        type hw;
        card 0;
  • This multitrack sound card (mentioned) is now available : audioinjector.net
    – Matt
    Jan 13, 2017 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.