# Time difference between two microphones

Hi everyone ;

I am trying to do sound localization with two microphones project . I have found many methods but I think correlation method is most fits to my problem .

My logic is, I have samples from microphones and correlation coefficient function works even the sound source doesn’t hit the microphones.

When the sound source hits the microphones it will change the samples and the correlation coefficient . I need to calculate the difference between the correlation coeff. which the sound source does not hit the microphones and coefficient that sound source hit the microphone .

I need to calculate d from d=c (speed of sound)*time differance (t) and I am going to apply trigonometric functions to find the angle of the sound source and find its location.

Can I find the time difference between those two correlation coefficients ?

( my sound source will be at fixed frequency and it will come continuously.)

Thank you for any help and sorry for my English)

. I have found many methods but I think correlation method is most fits to my problem .

I've never heard of that...

Does that mean you have a continuous sound (like talking or music, etc.) and you want to time-align the sound from the two mics, or find the time difference? That's kind-of like how the ear works, but you're going to need more memory and more processing power than an Arduino.

My logic is, I have samples from microphones and correlation coefficient function works even the sound source doesn't hit the microphones.

That doesn't make any sense. With no sound hitting the mics there is no data.

I need to calculate d from d=c (speed of sound)*time differance (t) and I am going to apply trigonometric functions to find the angle of the sound source and find its location.

I believe that can work if you have an impulse sound.

This idea has come up several times on the forum, but no one has demonstrated success (with Arduino, at least). Perhaps you could be the first to do so.

I'm curious if you have a reference for the described technique?

The equation provided seems to be left/right symmetric so one would at least need a third microphone to resolve the angle.

The difficulty with with this problem in general is the presence of reflected signal coming from directions other than the original source.

There are commercial devices that will indicate the direction and approximate location of a gunshot sound (for example), so the general idea is certainly workable.

A gun shot is like a ping, where the time difference between both channels can be determined. But with a ping it's also possible to determine the distance of the object, what's impossible with a distant sound source.

With a continuous sound it's only possible to determine the phase shift between both channels, where the real difference may include multiple waves. With discontinuous sound a stereo digitizer, memory size and processing power is required that is beyond the capabilities of 8 bit Arduinos.