[chbot] Determining delay between two similar signals

Robin Gilks robin at gilks.org
Sun Jul 5 06:27:33 BST 2020

Me again!

I'm still getting nowhere with my project that will use ultrasonic
transducers to measure wind speed.

I understand that I need to run a cross correlation between the original
transmitted signal and the delayed received one in order to work out the
delay and hence (with a fixed distance between transducers) the speed of
the wind.

Trouble is, when I try to find basic information I end up in a cloud of
matlab and scipy mazes that don't help me at all. I just don't seem to be
able to make the leap from basic idea to usable code on an embedded
system. It really doesn't help me to read that I need to an FFT when I
wouldn't know an FFT from a dead elephant!

A typical example of what I find is thus (from

"A well-known solution to estimate delay is to calculate the
cross-correlation between the two signals. An efficient implementation
calculates |ifft(fft(a) .* fft(b)|, using FFT for cyclic convolution.
A peak in the result indicates the integer-sample delay with best alignment."

warblefarblegarble :(

Thought a couple of times that I'd found a code snippet that delivered the
goods but on trying them out they don't actually work. e.g.
I feed in 2 audio files, one of which I have trimmed a 150ms from the
front of with Audacity and it tells me the delay is 3-4 times what I'd
actually created.


Robin Gilks zl3rob/g8ecj

More information about the Chchrobotics mailing list