Classes | UGens > FFT

SpecFlatness : UGen : AbstractFunction : Object

Spectral Flatness measure


Given an FFT chain this calculates the Spectral Flatness measure, defined as a power spectrum's geometric mean divided by its arithmetic mean. This gives a measure which ranges from approx 0 for a pure sinusoid, to approx 1 for white noise.

The measure is calculated linearly. For some applications you may wish to convert the value to a decibel scale - an example of such conversion is shown below.

Class Methods



an FFT chain.

Inherited class methods

Instance Methods

Inherited instance methods



{ // Example - vary mixture of white noise and pure tone with the mouse
    var in, chain, flat, flatdb, flatdbsquish;

    in =,,,1));
    chain = FFT(LocalBuf(1, 2048), in);, in * 0.1);

    flat =;

    flatdb = 10 * flat.log; // Convert to decibels
    flatdbsquish =, -45, -1.6, 0, 1).max(-10); // Rescale db roughly to 0...1.

    flat.poll(10, "flatness: ");
    flatdb.poll(10, "flatness (db): ");

    [flat, flatdbsquish]

{ // Now try with your own voice
    var in, chain;
    in =[0,1]).mean;
    chain = FFT(LocalBuf(1, 2048), in);, [in,, "flatness: ")]);