I’m not entirely sure what the relationship between these two are because the reference is a bit confusing.
Spectral centroid: “This is the point that splits the spectrum in 2 halves of equal energy.”
Rolloff: “This indicates the bin under which 95% of the energy is included.”
(p.s. both still reference bin numbers instead of Hz, which is no longer correct)
So that makes sense until I look at the numbers. For just about all the audio I can feed into the algorithm the spectral rolloff is lower (often, much lower) than the centroid. Now it could be me just not understanding the maths of “two halves” vs “95%”, but since both are talking about energy, I interpret centroid being the point “under which 50% of the energy is included”, which would seemingly put the rolloff always above it.
A quick way to test/compare is just running this and turning off the ezdac~
randomly:
----------begin_max5_patcher----------
1070.3ocwXssiihCD84juBDOM6prH7EtMus6S6+vpQibClzdZBFYL8sQS912
xFS5jNtSS5lUKJhXbJ6iOmpJ6h7y0qBuQ9HuOL3qA+SvpU+b8pU1tLcrx87p
vcrGKaX8VyB663kZ0vtJE6g8gaFsnV1pqYkbiEwt9DUV6k27i+H4X65EOasC
gilLscXmnsgqsHPeoS4fdpWzQyPKamcFB+Skf0LM2cLc4sh1seWAKvQFgwo.
FAzjhnD3q3XySnT3qfu4F0HD5m53iCILL3ale4WqWatsYlpRK+AfnSKEM+Q6
JHbnsiUdWPbz4eBOWlRC8oGHu5Q1ayZJMh.WTRg6JyvciZGjPyMegwWRApaj
Lc3lOTiOj3UIJ0Q2K3O3QSPYWgnDekhxXbAJADE3hfhcWvugfADujgBVRZiF
J4sZkTT8k+94e6qA8cJNap8c7GZ488eQwzBIzwcCJsrW7RGJYSirtdz75Fl1
Zd0eAOUp38ZaSexn+XqrKlqMWYjL+XKiJHjsL0SKZd1uuGxnPd3M0KswWKsI
YYVdmcf2XfoT69IT76S6dw1VXmpkjxsRQOeuGJSthDlKQYRw4TFkXIKM8+EJ
2ee8dXcEC95Tew3dINwKwoWKwyQFJmMehu4hsVRY44lfxaYsa4dzj7jqHA.e
c48jLjY6yzYnIFlunbttYPTEMVKBqo+VVGeObHWgu3Br2pOH9q9.c0JC4UQK
EfxPRrUZ.muXjFxkjlFQu9iKO7mqXk91E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