# Sound Source Location

I have four microphones which I want to use to locate the direction of an audio source. Is there any Python module that implements an algorithm that, given the recordings of the four microphones, will give me a vector pointing to/angles of the audio source? Thanks in advance

• i don't have any Python anything. but i am curious, how are your 4 microphones arranged geometrically? – robert bristow-johnson Oct 13 '18 at 1:04
• Their geometry is [[0,0,r],[-r,0,0],[0,0,-r],[0,r,0]]. – Samuel Oct 13 '18 at 1:12
• i might suggest as a tetrahedron. that would be the 4 corners of a cube such that none are adjacent. i think it might be $[1,0,0], \ [0,1,0], \ [0,0,1], \ [1,1,1]$ . – robert bristow-johnson Oct 13 '18 at 1:17
• Sadly, I can not rearrange them. – Samuel Oct 13 '18 at 1:25
• it's an arrangement that will measure elevation angle best since the spacing of the microphones along the $z$-axis is $2r$. if you place a source at $[0,0,0]$, that should be equidistant from all microphones. do you get identical signals in all 4 channels? – robert bristow-johnson Oct 13 '18 at 1:43

I wish I could say that there are 2 different approaches to determining the direction of a source relative to some phase center of an array but that wouldn’t be correct.

Firstly I don’t think there is a Python module that does it generally because there are no algorithms that are completely general.

Having said that there are not 2 general classes of algorithms, I’m going to ignore what I just said. There is beamforming and there is cross correlation.

Beamforming seeks to use coherent gain to determine direction.

Cross Correlation seeks to determine the relative delays between the sensors and then pick the best solution.

Both categories are based on the principle that a propagating wave can be described by a wave front which is a surface in 3 or 2 dimensions of stationary phase. In a homogeneous 3 d free space, a point source the wavefront consists of expanding spheres where the amplitude drops off as $$1/r$$. Far enough away from the point source, the wavefront is sufficiently flat to assume a plane wave.

So in a real problem you have to make some assumptions about the propagating wavefronts. We can also have non radiating field components near the source.

The most typically standard approach is to assume plane waves from point sources impinging on your sensors. There are other kinds of assumptions that can be made like near point sources having wavefronts that have some curvature but you only have 4 sensors.

In beamforming we apply a set of delays to each received signal based on the assumption that it came from some direction and stack them up and sum them. The set of delays from the correct direction would produce the greatest coherent gain. This means that you have to form a lot of beams for a lot of proposed directions. Being off a little bit means that the estimated direction would be off a little as well. Beamforming is expensive in real time. Old fashioned RADAR solved the problem by scanning with a rotating parabolic antenna. In SONAR, rotating parabolas are mechanically undesirable and forming multiple beams is the better way to go.

The cross correlation method goes after the delays but you have to do all pairs and then you need to figure out which direction produced those delays.

There is something called split aperture beamforming which is a combination of the two.

When you have more than one source the basic ideas mostly hold but there are issues that are best left for a book or 2 or 10.

If your sensors are too close together, there are problems.