Time Delay of Arrival

    May 27 2008 | 8:54 pm
    Hi all,
    I'm new to MAX/MSP and I would like to do a simple cross-correlation between two incoming microphone signals and then extract at what lag the maximum value occurs at in this correlation. I've figured how to calculate the cross-correlation but, now how do I extract this lag information?
    Thanks for any pointers or help.

    • Jan 26 2012 | 12:01 am
      Hi!! i'd love to do this too... unfortunately i'm a math-n00b :D i'd like to build something similar to the DELAY TRACKER found in the software SMAART of Rational Acoustics.
      i've started to research something and fell into this link: https://ccrma.stanford.edu/~jos/st/FIR_System_Identification.html
      anyway i have no idea of how to build this in max
    • Jan 26 2012 | 9:32 am
      You need to search the cross-correlation for a suitably large peak. Often you normalise the cross-correlation to have a peak of one, and take the first peak that is greater than threshold (0-1). Alternatively you can skip normalisation and take the first peak that is > thresh * peak, which is equivalent. A very simple algorithm would simply always take the peak.
      Once you have the peak location you might wish to interpolate to get sub-sample accuracy (soemthing like this for fft peak detection is described here - https://ccrma.stanford.edu/~jos/parshl/Peak_Detection_Steps_3.html).
      The peak position in samples then represents the lag....