Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Spectral flatness for audio signals and auditory spectrograms

`flatness = spectralFlatness(x,f)`

`flatness = spectralFlatness(x,f,Name,Value)`

`[flatness,arithmeticMean,geometricMean] = spectralFlatness(___)`

specifies options using one or more `flatness`

= spectralFlatness(`x`

,`f`

,`Name,Value`

)`Name,Value`

pair arguments.

`[`

returns the spectral arithmetic mean and spectral geometric mean.`flatness`

,`arithmeticMean`

,`geometricMean`

] = spectralFlatness(___)

The spectral flatness is calculated as described in [1]:

$$\text{flatness}=\frac{{\left({\displaystyle \prod _{k={b}_{1}}^{{b}_{2}}{s}_{k}}\right)}^{\frac{1}{{b}_{2}-{b}_{1}}}}{\frac{1}{{b}_{2}-{b}_{1}}{\displaystyle \sum _{k={b}_{1}}^{{b}_{2}}{s}_{k}}}$$

where

*s*is the spectral value at bin_{k}*k*.*b*_{1}and*b*_{2}are the band edges, in bins, over which to calculate the spectral spread.

[1] Johnston, J.d. "Transform Coding
of Audio Signals Using Perceptual Noise Criteria." *IEEE Journal on Selected Areas
in Communications*. Vol. 6, Number 2, 1988, pp. 314–323.