I'm looking for an algorithm which can accurately estimate the time-offset/delay between two audio signals in real-time. One audio signal is a loudspeaker signal and the other signal is the microphone signal.

Audio is processed in blocks of 10ms (sample frequency 16kHz).

  • There is light office noise embedded in the signals
  • The algorithm must be able to estimate delays up to 500ms.
  • The delay is usually constant for a period of time (with some variability -10ms to 10ms), but occasionally the delay "jumps". Those sudden jumps can be in the order of 50 to 80 ms. The algorithm must be able to handle that.

I've read that GCC PHAT is one algorithm which can be used, but I'm not sure how it would work in a real-time environment.


There are a variety of techniques available. See this thesis for a nice write-up.

See the list of algorithms:

enter image description here

In particular, note that they recommend pre-whitening the signals before correlation --- to ensure that the cross-correlation has a nice, narrow peak for better "localization".

  • $\begingroup$ GCC-Phat, here PHAT does the pre-whitening thing in order to make correlation peak accurate even in a noisy environment. $\endgroup$ Sep 17 at 11:44
  • $\begingroup$ @KhubaibAhmad Yes, see this answer for more details. $\endgroup$
    – Peter K.
    Sep 17 at 13:18
  • $\begingroup$ this is amazing thanks. $\endgroup$ Sep 17 at 13:24

Cross correlation is what you want. If the two signals are similar then the cross correlation should produce a large peak. The location of the peak would tell you what the sample offset is, and the sample offset together with the sample frequency tells you the time delay between the two.


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.