Posts: 19
Joined: Mon Sep 30, 2013 10:10 pm

triangulating with Microphones

Mon Sep 30, 2013 10:22 pm


My name is Daniel and i am just getting started with my new Raspberry Pi. Currently i want to localize a sound in the room. Provided i have 3 microphones with 120 degress between them, i should be able to triangulate any sounds in the areas.

God bless Python, that bit is easy.

However, given the layout of the board. What is the smartest way to plug in 3 microphones to the board in a way that they each act as an independent data source.

Another ideas or suggestions are greatly appreciated.



User avatar
Forum Moderator
Forum Moderator
Posts: 13234
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Microphones

Mon Sep 30, 2013 10:37 pm

Triangulate? How?

A thought experiment:

Question: What is the speed of sound? Answer: 343.2 metres per second, or sound travels a meter in 2.6 mS

What is the distance between the microphones? lets say its 10 cm, or 0.1 metres.

So if you know the above, you should be able to calculate the time the sound has to travel from one microphone to the next, to determine which microphone is closest to the sound source (it's the only way to estimate the direction the sound is coming from). Answer: 2.6 / 10 = 0.26 ms, or 260 µS.
If you do the calculations you will see that python is far too slow to see any difference!

What you want to do is (almost) impossible, using this "phase shift detection" method. Even if you manage to interface three microphones to the same USB device. Most USB soundcards will only do two (stereo), don't even think about using multiple sound cards, the latency (variations of time between detection of the signal, and transfer to the PI) between two different USB devices is far too big, far bigger than the 260 µS from one microphone to the next.

In fact this trick that the human ear and mind can master easily is almost impossible to re-create, except with dedicated electronic circuitry, and then only for short bursts of sounds.

Even if you try to simply use the difference in sound levels to "triangulate", (very error prone) to estimate directions, you still have the problem of multiple synchronized microphone inputs. If you are off by a few hundred µS you are comparing two different waves.

Posts: 3
Joined: Fri Feb 21, 2014 6:57 am

Re: triangulating with Microphones

Tue Apr 15, 2014 2:03 am

I would guess he's trying to triangulate based on the volume of the sound, not the offset of the speed of sound.

OP, did you ever get this working?

Return to “Beginners”