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

  • 1
    $\begingroup$ i don't have any Python anything. but i am curious, how are your 4 microphones arranged geometrically? $\endgroup$ Oct 13 '18 at 1:04
  • $\begingroup$ Their geometry is [[0,0,r],[-r,0,0],[0,0,-r],[0,r,0]]. $\endgroup$
    – Samuel
    Oct 13 '18 at 1:12
  • 1
    $\begingroup$ 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]$ . $\endgroup$ Oct 13 '18 at 1:17
  • $\begingroup$ Sadly, I can not rearrange them. $\endgroup$
    – Samuel
    Oct 13 '18 at 1:25
  • $\begingroup$ 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? $\endgroup$ 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.

If your source is distributed some adjustments will help.

One good aspect of these problems is the Bessel Fourier relationship because like Fourier series in time, an arbitrary wavefront at a temporal frequency can be described by a sum of plane waves.

There is a very very large literature on direction finding. I sometimes wonder if there are more papers than there are actual arrays but that is getting less true (not actually true) as time goes on.

  • $\begingroup$ This was very informative. Do you have any links that go more into the math of the three methods you described, like, how do I tell from which direction the sound came from the delay? I need to find one source in a 3D space and I am confused on how to get the elevation and azimuth. $\endgroup$
    – Samuel
    Oct 16 '18 at 1:23
  • $\begingroup$ books are better than links Nielsen, Richard O. Sonar signal processing. Artech House, Inc., 1991. $\endgroup$
    – user28715
    Oct 16 '18 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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