Kyma Forum
  Tips & Techniques
  Coherence Function

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Coherence Function
gustl
Member
posted 30 July 2014 06:21         Edit/Delete Message   Reply w/Quote
Hi there,

I want to calculate the coherence function of a stereo signal for individual frequencies.
So far I did:
- Calculate the FFT of left and right signal
- Split the signal into groups of bins - I think I need some kind of averaging here?
- Build the complex conjugate of right signal my multiplying the imaginary part by (-1) with a ScaleAndOffset module
- Complex Product of left FFT signal and complex conjugate of right FFT signal
- IFFT of the result should give me the cross-correlation, right? it looks like...

Now how do I get the coherence function? From what I've understand I need to divide the correaltion by the product of the magnitude squared FFT of left and right signal?

I admit that this is some kind of too much for my DSP skills Any help here?

Thanks,
Gustl


IP: Logged

SSC
Administrator
posted 30 July 2014 12:38         Edit/Delete Message   Reply w/Quote
Do you want the coherence function as described on these pages?

DSP Book and Wikipedia ?

If so, you would do an FFT of the left channel and another one for the right channel. Next, you would do some time averaging (the second link uses a straight average, but you could use variants of the smoother you and Pete use to do a similar-type of time averaging).

You would then create the spectra:

Xm -- smoothing of left channel FFT (complex spectrum)
Ym -- smoothing of right channel FFT (complex spectrum)

Xm2 -- smoothing of magnitude squared of left channel FFT (real-only spectrum)
Ym2 -- smoothing of magnitude squared of right channel FFT (real-only spectrum)

Zm -- smoothing of magnitude squared of the { conjugate( Xm ) * Ym } (real-only spectrum)

final coherence function value would be

Zm / ( Xm2 * Ym2 )

The final result is a real-only time-varying spectrum, which is how "correlated" the left and right channels are at each frequency.

[This message has been edited by SSC (edited 30 July 2014).]

IP: Logged

gustl
Member
posted 31 July 2014 06:40         Edit/Delete Message   Reply w/Quote
Perfect formula to kyma translation - Thanks

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c