[PD] feature extraction

Mathieu Bouchard matju at artengine.ca
Sat Jul 16 00:59:45 CEST 2005


On Fri, 15 Jul 2005, Jacob Last wrote:

> Thanks, I would love to see the abstractions, as I was sort of shooting
> in the dark for a while implementing even the relatively simple spectral
> centroid. I originally thought I should be able to do the computation
> all in the signal domain from the [rfft~] object's outputs....is that
> possible? What I ended up doing is writing each analysis frame into an
> array, then using [bang~] to trigger the calculation for each frame,
> reading through the array.

you can compute the centroid of signal chunks using a [phasor~] tuned to
ramp up exactly synched with each block, one or two [*~] and then summing
or averaging all values in each chunk ([lop~] could do it but there are
better ways that I can't think of now).

you can compute higher-order moments using powers. e.g. multiplying a 
signal with itself for squaring, or [expr~ pow($v1,3)] for cubing, etc. 
And you insert that right after the [phasor~].

the mean (the centroid) is the 1st-order moment.

the variance is the 2nd-order moment minus the square of the mean, or the 
other way around...

there are formulæ for skewness and kurtosis that are quite simple
combinations of moments.

Entropy is not obtainable using moments, but has a similar formula. You 
have to do [expr~ $v1*log($v1)] after the [phasor~], or something.



,-o--------o--------o--------o-. ,---. irc.freenode.net #dataflow |
| The Diagram is the Program tm| | ,-o-------------o--------------o-.
`-o------------o-------------o-' | | Mathieu Bouchard (Montréal QC) |
  | téléphone:+1.514.383.3801`---' `-o-- http://artengine.ca/matju -'




More information about the Pd-list mailing list