[PD] cross-correlation in pd ?

Charles Henry czhenry at gmail.com
Mon Jun 18 06:01:57 CEST 2007


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 at 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 at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sxcov~.pd
Type: application/octet-stream
Size: 1414 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070617/41a0dddb/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sxcov~-test.pd
Type: application/octet-stream
Size: 1219 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070617/41a0dddb/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: conj_mult~.pd
Type: application/octet-stream
Size: 551 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070617/41a0dddb/attachment-0002.obj>


More information about the Pd-list mailing list