On Fri, 2008-01-18 at 15:47 +0100, matteo sisti sette wrote:
Thank you very much :)
By the way, I have just tried Spectral Flatness (as defined in Wikipedia) and it seems promising.
I attach an abstraction that outputs spectral flatness in PD-vanilla.
That's not actually a correct implementation of spectral flatness. What you've done is more like the arithmetic mean of the log-magnitude spectrum over arithmetic mean of the mag spectrum. Whereas the SFM is the _geometric_ mean of the mag spectrum over over its arithmetic mean.
The problem is that in order to obtain the geometric mean, you need to ignore bins containing 0, otherwise you will get an overall value of 0 if there are '0 bins' present. See attached for a more 'correct' implementation.
There is also an external that implements SFM in the CVS:
http://pure-data.cvs.sourceforge.net/pure-data/externals/postlude/flib/src/
See sfm~.c
However, the flib library in general is deprecated, and libxtract should be used instead.
At any rate, both of the Pd implementations using [fexpr~] are horribly inefficient, and SFM is inefficient to compute at the best of times because it requires at least two iterations over the the input vector. That's why I recommended Irregularity. It tells you roughly the same thing, but is a nicer feature in terms of computation cost, and things like avoiding NaNs and infs.
Jamie