Holiday notice: Cycling '74 will be closed Monday, October 9th. Manual authorization, support cases, and manual order processing will be delayed.

Sep 20 2012 | 2:36 pm

Hello,

I'm trying to compute the spectral centroid in max.
The spectral centroid can be see as the barycentre of the magnitudes of the spectrum of frequencies..
I know there are some externals which does that, but I'd like to implement it myself to understand how msp works.

This is what I did. This patch is inspired by the MSP tutorial 26. I use the edge~ object on the third outlet of the fft, to compute the centroid frame by frame.

How you can see, it seems to work if there in only one frequency in the fft (message box 1). In the case of a "real" signal (message box 2, cycle~440). It's not stable at all.

Why ? Any idea ?

Thanks a lot for your help.