Better Theory

As I mentioned at the end of the last post, I’ve been assuming that the sound wave was flat, when in fact it is round. now as long as the distance to the source of the sound is much larger than the distance between the two microphones, then this is a pretty good approximation. But what if the source is closer? Consider this:

Now the difference in times is t=(|r2|-|r1|)/v, but we don’t know either r1 or r2, only their difference. We can try to solve for all the places where the difference in the distances is that value. Starting with the point along the line connecting the two, we can find all the points where difference in distances is vt:

v*t=rb-ra and rb+ra=d, so rb=(d+v*t)/2 and ra=(d-v*t)/2

I’ll spare you the detailed math, but the solution for possible locations is one branch of a hyperbola:

When the difference of the radii of two circles is a constant, their intersections trace a hyperbola
The intersections of all the circles where the radii are a constant difference is a hyperbola

In the limit, you may remember that a hyperbola asymptotically approaches a pair of lines (called asymptotes). These asymptotes are the approximations from my last post. However, with just the measurement from these two microphones, we couldn’t pin down the source any more accurately than somewhere along the hyperbola, but again if we use more than two microphones, we get multiple hyperbolas, and those should only intersect at one point. (hopefully)

Theory

The basic idea behind this project is to use an array of microphones to measure the relative time of a sound. Then, using the locations and arrangement of the microphones, we should be able to calculate where the sound originated.

Here’s how this will work. Let’s assume we have two microphones on an east-west line a distance d apart, and a sound wave is propagating past them at an angle Θ. Assuming we know the speed of propagation v, we can take the time difference t of the arrival at the two microphones, and calculate what Θ must be. It looks like the diagram at the top of the every page on this site:

So Θ=arcsin(v*t/d) and that gives us a rough direction to the source of the sound. The distance d can be measured with a measuring tape. The time difference t can be measured by a computer, and the velocity of sound can be calculated if we know the air temperature. Let’s assume some values to see it in action:

d = 20 meters (approximately 65 ft for those playing in the US)

v = 343.3 meters/second or 1126 feet/second (at 20°C / 77°F )

t = 1 millisecond = 0.001 seconds

So Θ = arcsin(343.3*0.001/20) = 0.01717 radians which is just a little less than 1 degree of arc.

Since the microphones are set on an east-west line, that means that the direction to the source of the sound is 1 degree west of north, or 359°.

Clever people will notice that I’ve glossed over a critical detail. I’ve assumed that the wave is propagating from the top of the page, rather than from the bottom. If it were propagating from the bottom, then the timing would be the same, but the bearing to the sound would be 1 degree west of south, or 181°. How do we figure out which of those is correct?

The answer is using more than 2 microphones. Let’s assume we had 4 microphones arranged in a square like so:

sound wave propagating past an array of 4 microphones
Full Array

The time between the arrival at Mic1 and Mic3 is here represented as t’, and and distance is represented by d’. Using similar logic to that above, if t’ = 58.2 milliseconds, and the distance is the same, then the bearing from these two mics is either 358° (if coming from the upper left) or 2° (if coming from the upper right). Since 358° and 359° are about the same, we can deduce the correct answer. Actually, with 4 microphones we have a total of 6 baselines to calculate with.

There’s only one problem left with this: It’s based on a false assumption that the sound wave is straight line, but it’s not. It’s an expanding circle (or actually sphere). Still this is a useful approximation, and will get it close enough to do a more subtle analysis. More on that next time.