SuperCollider CLASSES


Find a percentile of FFT magnitude spectrum
Inherits from: UGen : AbstractFunction : Object


Given an FFT chain this calculates the cumulative distribution of the frequency spectrum, and outputs the frequency value which corresponds to the desired percentile.

For example, to find the frequency at which 90% of the spectral energy lies below that frequency, you want the 90-percentile, which means the value of fraction should be 0.9. The 90-percentile or 95-percentile is often used as a measure of spectral roll-off.

The optional third argument interpolate specifies whether interpolation should be used to try and make the percentile frequency estimate more accurate, at the cost of a little higher CPU usage. Set it to 1 to enable this.

Class Methods

*kr (buffer, fraction: 0.5, interpolate: 0)



an FFT chain.


Inherited class methods

Instance Methods

Inherited instance methods


b = Buffer.alloc(s,2048,1);

// Simple demo with filtering white noise, and trying to infer the cutoff freq.
// Move the mouse.
var in, chain, realcutoff, estcutoff;
realcutoff =,22050);
in =, realcutoff);
chain = FFT(b, in);
estcutoff =, 0.9), 1);
realcutoff.poll(, "real cutoff");
estcutoff.poll(, "estimated cutoff");, in);, estcutoff * 22050.0.reciprocal);

// Audio input - try different vowel/long-consonant sounds and see what comes out.
// Specifically, change from "ssss" through to "aaaa" through to "wwww".
var in, chain, perc;
in =[0,1]).mean;
chain = FFT(b, in);
//, in * 0.1);
perc =, 0.5);,, perc)); //NB Outputting to right channel - handy on PowerBooks, perc * 22050.0.reciprocal);