Centroid from a list
Hello everyone!
I am beginning to work with spectral analysis and I am using melband descriptors... I would like to calculate the centroid of my bands, but just struggle to figure out the right expression for doing this.
I found the mathematical formula here (page 7), but I'm not getting it...
Could someone here help me? This would be great!
there is an example coming with max but it´s gen~
[pfft~ gen~.centroid 1024 4]
for pfft~ / signal there should be also a bunch of third party externals.
otherwise, in theory it is a simple calculation... find the mean of each (frequency multiplied by its amplitude).
Thanks a lot for your response...
I already had a look at the gen~.centroid, and I couldn't figure the solution to my problem...
This should indeed be a simple calculation of a weighted mean. I am not dealing with signal here but a list stream, whose elements correponds to the energy for each melband.
I am trying to find the proper way to weight this list elements, if you have some idea of how it could be done I'd be very happy.
I actually got help I came up with a solution.
I post it here in case this is of any help for someone else!
vexpr a*b followed by zl sum is what i would have suggested. :)