I want to find the direction of a sound source in 2D space. I use two microphones and one sound source for that. I have recorded audio data into two arrays. When a sound is detected, it starts to record data into arrays and stop the recording when no sound is detected. I am confusing about the next step.

  • How I take the cross-correlation of these two signals using python3?
  • How I find TDOA using that data?
  • $\begingroup$ You cannot use TDOA with only two data arrays recorded from two signal receivers (microphones), even in 2D, without data recorded directly from a sound source (a "third array") and a distance between the receivers measured independently. And even with these data, there remains an ambiguity in the direction discovery: you can easily see it from the geometry of trilateration in your scenario. Resolve the geometry issue, and we return to cross-correlation and python3 code questions. $\endgroup$ – V.V.T Nov 12 '20 at 9:45
  • $\begingroup$ On second thought: maybe your goal is a binaural direction finder rather than a "geolocation" device? The direction finder can be implemented with the setup proposed in your question, although I doubt that it requires a TDOA technique sort of that used in geolocation. May be a hardware implementation of binaural hearing direction finding in living creatures will fit your purpose? After all, a more detailed description is needed of your intended design and scenario of use, if you want to receive a practical recommendation. $\endgroup$ – V.V.T Nov 12 '20 at 15:58

Your 2-mic array can provide an angle-of-arrival estimate with front-back ambiguity, using cross-correlation to estimate TDOA and then calculating AOA from TDOA and microphone spacing. The front-back ambiguity can be removed with sufficiently directional microphones, or just by constraining the geometry, putting the microphones against walls, for example. You will also have a multi-path effect. If the space is cluttered, if you lose the direct path, or if the sound source is directional, this multi-path effect will be strong and the errors it produces may be overwhelming.

But even in ideal conditions, the two mics produce a single geo-observable, the TDOA, and thus can calculate only one geometric constraint. In other words, you have only one "known" and thus can solve only one "unknown", not a full 2D position.

If the sound source and the sampling at the microphones can be synchronized, you can also measure propagation delay directly to get distance estimates from each mic - two "knowns". Such absolute distance estimates are also very powerful for resolving the multi-path problem. If the source and receivers cannot be synchronized, you will need a third microphone to produce a second independent TDOA measurement, a second "known". At this point, you can use the same pseudorange/light-cone cost-minimization calculations that are used in GPS receivers, or just take the two TDOAs and try to intersect the AOA lines.

These are the general principles.

(My comments are based on personal experience with geolocation of radio emitters in several success projects, but the same principles apply to sound.)


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.