Mathieu's right here... It can be done with abstractions. I'm not sure that mine are all correct, but I've used this technique a couple times without making complete abstractions for it... Here's an abstraction for computing a symmetric cross-covariance, this way. It outputs the cross-covariance, xcov(k)=sum(i=-32,...,31; s1(i+k)*s2(i)) It's still pretty ugly, and the details of the math confuse me a bit. I'm still working on the one-sided cross covariance function for delays, like from [0,63] instead of [-32,31]
This one works within block sizes of 64, by using an [block~ 128 2] . It is formatted very tricky using lrshift, but I think you will see that it's continuous. The test patch uses zexy for z~. If you want to compute xcov on larger block sizes, just change all the numbers according to the size you need.
Do you think I've got it right? Should the output be reversed? This abstraction also could be improved to make running calculations of cross-correlation, which add up the variance in s1 and s2 and normalize the output.
Jamie Bullock has cc~ in his flib collection. It computes cross correlation in the time domain, and cross-covariance using the freq. domain. I worked on it a while back...but have been lazy about trying to change the cross-covariance into a cross-correlation. Sorry, Jamie.
Chuck
On 6/17/07, Mathieu Bouchard matju@artengine.ca wrote:
On Sun, 17 Jun 2007, Tania Habib wrote:
I was wondering if some body can tell me if there is an object to generate the cross correlation of two signals. If there is, please let me know which library has it.
Do it with [fft~] just like for signal convolution, except that in computing the [*~]s you replace the [-~] by a [+~].
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada _______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list