# What is the amplitude range of a spectrogram?

Is there an upper and lower bound to a spectrogram representation of an audio signal? The range of the amplitude values of the audio signal is from 0 to 1.

• If you change some details in your question, like amplitude -1 to 1, and Fourier Transform magnitude instead of spectrogram. For the discrete time case, an argument along the lines of a DFT matrix having a condition number of one, would imply that there is an upper bound and lower bound.
– user28715
Oct 13, 2017 at 15:58

Recall how a spectrogram is computed. You place a window of length $N$ around a sample of interest in your signal $x$ and then compute its DFT. This corresponds to one column of the spectrogram. In symbols, a fixed column is given by a DFT operation:

$$X(k) = \sum_{n=0}^{N-1} x(n) w(n) e^{\frac{-j 2 \pi k n}{N}}.$$

I believe you want an upper and lower bound on the magnitude of the spectrogram. An obvious lower bound is $0$. To find an upper bound:

\begin{eqnarray} |X(k)| &=& \left | \sum_{n=0}^{N-1} x(n) w(n) e^{\frac{-j 2 \pi k n}{N}} \right|\\ &\leq& \sum_{n=0}^{N-1} |x(n)||w(n)|\cdot 1\\ &\leq& \sum_{n=0}^{N-1} 1\\ &=& N. \end{eqnarray} where I assumed that the window function has a maximum value of $1$.

This means that the magnitude of any element in the spectrogram matrix must be between $0$ and $N$ where $N$ is the window length.

Note that there are other ways of scaling a spectrogram which will change these calculations. Some people plot squared magnitude instead of magnitude, or $20\;\log_{10}(\cdot)$ of the magnitude. Some people like putting a $\frac{1}{N}$ normalization. Matlab provides 'psd' and 'power' options and scipy provides 'density' and 'spectrum' options which scale things differently.

STFT or filterbank outputs are often passed thru a log function and then a colormap lookup table on the way to the display. Depending on the contents of the colormap table, the range of the final spectrogram display is limited to the dimensions and color gamut of your chosen graphics monitor.