Coherence function

mike's icon

Hello Max fellows,

This is my first post.
I am a quite new max user so hopefully this is the right place to ask for help ;-)

I am trying to calculate a the coherence function for two signals.
https://en.wikipedia.org/wiki/Coherence_(signal_processing)

Could not find a statistics object or external to do such a calculation.
Perhaps someone has a hint for me where i can find some statistics examples.

I am asking because I dont want to reinvent the wheel ;-)

All the best,
Mike

Floating Point's icon

I think the zsa descriptors package might have a spectral coherence external:
http://www.e--j.com/index.php/download-zsa/
if not, it might help in building one yourself

mike's icon

Hello Floating Point,

Thank you very very much for looking into this problem.

I also checkt the zsa descriptors package.
Sadly there is no abstraction for a coherence ...
There is only a basic statistic external.
zsa.ampstats~: Report min/mean/max/sum of a signal vector or a FFT frame.

But i found a gen example for detecting a delay with the correlation function.
Perhaps you could give me a hint, how to transform it into a coherence function ;-)
My math is a bit rusty .....

Max Patch
Copy patch and select New From Clipboard in Max.

All the best,
Mike

Floating Point's icon

I think they're different beasts, one works in the freq domain, the other in the time domain, so no simple translation as such.

I had a look at the link, but there's something I don't get: if the convolution squared of two signals is divided by the magnitudes of the two signals multiplied by each other (in the freq domain) then the answer will always be 1, so there's something I don't understand in the formula, otherwise I could probably whip up a pfft patch to do it...

loadmess's icon

Hello,
I'm also interested in this. Any other advancements since the last post?
Or if anyone has a paper or some good links about how to do it.

thank you