I am trying to display the spectrogram of an input audio signal (a newcomer to all things spectral here). The amplitudes of my audio signal can be assumed to be normalized between -1 and +1.
Suppose for the frequency $f$ in the DFT's output, the corresponding coefficient is $c$, in general a complex number. I would like to display the "amplitude" information contained in $c$ as a corresponding colored region on the spectrogram. Ideally to plot the spectrum, I would need a number that ranges from 0 to 1. 0 will represent the lowest amplitude I will record, and 1 the highest. There are a few ways I can think of to achieve this:
- Since the $|c| \le N$, where $N$ is the number of samples, I can normalize the magnitude of $c$ with respect to $N$ ($v = |c|/N$) and display the resulting $v$ as a spectral colour.
- Same as 1, but normalize $|c|$ wrt to $M$, the maximum magnitude of all Fourier coefficients. But this has the disadvantage of having to scan the entire data before the spectrum can be displayed, and will be a problem for large files. Also, this means that the spectrum display is relative to the intensity levels present in the current audio signal, and not valid in an "objective" sense.
- Convert $|c|$ into decibels, say $d = 20 \log_{10}(|c|/b)$, where $b$ is a base magnitude. I will then normalize $d$ from say $l$ (where $l$ is a lowest dB value I will register) to $u = 20 \log_{10}(N/b)$. I can then use $d$ in displaying the spectrum. But in this case, what should $b$ be?
My question: what is the exact physical significance of the magnitudes of the Fourier coefficients in the DFT of audio signals and how can it be best displayed? I have tried all the above approaches, but am wondering which of them is the most proper or if I am missing any others.