Localizing sound in space: part 3 (experimentation)

Time to put the whole in a (I hope) great experimentation…

The first step is to validate theÂ theoryÂ and theÂ algorithm and its configuration. So first expected results is to determine ifwe’re able to know if the sound if coming from left, or right. In a second step, we’ll try to precisely know the angle.

1. Hardware

So, we first need to build two sound sensors. These are justÂ LM386 base pre-amp for electret microphone. Here’s a little picture. It has been deisgned to be as smaller as possible. I’ll later add the complete diagrams and build instruction directly within theÂ SirBot Project.

The sound sensors are connected to theÂ mainboard, through a bread board. Not shown here, but during the experimentation, the mics are about 15cm distant from each other. Since we’re not going to measure angle, we don’t have to worry being inaccurate, what is important is this distance is greater than 2.75cm (see theory).

2. Software

The Jal program, as describe in part 2 (algorithm), will count the delay occurring when the sound will hit the first mic, then the second. It handlesÂ timeoutÂ if no sound could be detected with the second mic. Note there’s a delay occurring when data is available. Without this delay (see first experiment), there’s too much data, inconsistent and useless. The program is availableÂ here.

3. Attempt #1

TheÂ first experimentÂ consists in:
  1. knocking 3 times near the left mic
  2. knocking 3 times between the mics
  3. knocking 3 times near the right mic
  4. knocking 3 times between the mics
  5. knocking 3 times near the left mic
In this experiment, no delay is occurring when data is available (sound localized). Plotting what the first and the second mic have received (shift with delay), this clearly shows all the expected peaks.

Looking deeply into the data also show there’s no consistent results. Given one peak, the program alternatively detects the sound coming from left, right, left, etc… Kind of saturation…This can be shown when plotting the delay:Â if the delay is positive, the sound is coming from the left, if negative, it’s coming from the right. We’re thus expecting a clear distribution above and below 0 (and a mix when the sound is centered). The following figure shows this distribution is far from what we’re expecting…

While I first thought about a bug in the jal program, worse a bug in the theory/algorithm, I then tried to add the delay…

4. Attempt #2

If this case, as soon as the data is available, the program sends the result and wait a little time. Thus, most of the sound wave is ignored, except the very first point, which what we need. Note this experiment consists in:

  1. knocking 3 times near the left mic
  2. knocking 3 times near the right mic
  3. knocking 3 times near the left mic
  4. knocking 3 times near the right mic

We clearly seeÂ the delay is alternatively positive (left) and negative (right)Â (point with delay = 0 is an artifact and should be ignored).

Knocking near the mic has been done so theÂ sound wave is very narrowÂ (with plastic pieces). The delay is long enough so the next time we’re acquiring data, that’ll be for the next knock. Now, with the same delay, knocking a glass (sound is resonating) doesn’t give the same results… (knocking 2 times near the left mic, then 2 times near the right one).

There’re still something to say… The two first peaks seems to come from the left (ignoring null delays), but for the two last peaks, it’s hard to say, even if the delay is more important when negative than when positive…

So… This costs me a *lot* of time, but results are interesting:Â if we’re waiting enough (but not too long) between data acquistions, we’re able to localize sound quite nicely… This delay is clearly important and depends on the type of sound waves we’re listening to.

Next, I’ll try to determine where the sound comes from, computing the angle.


