# Time delay estimation using ultrasound

I have a sound source that generates an ultrasonic pulse. I have two microphones seperated by a distance which are at a distance from the source. I want to find the time delay of arrival of the ultrasonic pulse at the mics. I am filtering out all the frequencies other than my source frequency from the outputs of the mics. Due to noise and other reasons, the shape of the pulse received at each mic is not same. I am using cross-correlation to find the time delay but the results are inconsistent. I observed that when I use low frequencies (100~300hz), results are consistent. But I want to find using ultrasonic sound. I am using the below code for finding time delay

[xc,lags]=xcorr(x1,x2);
[m,i]=max(xc);
timeDelay=lags(i);


Can anyone please tell me what is it that I am doing wrong and how to correct it? I posted a similar question here, but couldnt understand the provided answer. In some articles, it is mentioned that cross-correlation works only for cases when the signal shapes are identical. If so, how can I find the delay? I was also wondering if the voice tracking cameras used in video conferencing use some technique other than cross-correlation.

• How long a pulse? With what ruse/fall time? At what sample rate? Are there any potential audio reflections or reflectors in the environment? Commented Mar 1, 2014 at 16:02
• can you show your pulse in a figure? how different between the two pulses? do they have the same number of peaks? Commented Mar 1, 2014 at 16:54
• Commented Mar 1, 2014 at 19:52
• @hotpaw2, my pulse details are: total duration:0.5s, rise/fall time: 0.05s, sample rate: 44100 and audio reflections can be neglected. Commented Mar 3, 2014 at 4:34

The transient edge or pulse shape of a tone burst represents a modulation. The resulting modulated signal will contain frequency components higher than the tone frequency. Thus you may need a sample rate much higher than just over 2X the tone frequency to reproduce a waveform accurately enough for cross-correlation to match the edges of the pulse envelopes. This is likely true for your low tones and for voices, where the sample rate can be 10X to 200X higher than the tone or forment frequencies.

Filtering out frequencies just below the tone carrier can also remove any lower sidebands of the modulation, thus likely increasing the error in envelope matching by cross-correlation.

• So you mean to say that my sampling frequency should be at least 10x my tone frequency? If so, I cannot sample more than my current frequency. Are there any good alternate methods to cross-correlation for time delay calc? Commented Mar 3, 2014 at 4:37