3
$\begingroup$

I have noticed that the spectrogram for a audio signal is often calculated in different ways when the result from the DFT is transformed into real numbers; some tend to compute $|k|$ or $|k|^2$ while others use the formula $Re(k)^2 + Im(k)^2\ \ $ for each DFT bin $k$. What is the theoretic difference between these and what should be considered as the standard (if any)?

$\endgroup$
3
$\begingroup$

Firstly $$abs(z)^{2}=Re \left \{ z \right \}^{2}+Im \left \{z \right \}^{2}=z*z^{^{'}}$$

These are all mathematically identical, so either one will work.

That leaves the question of whether the square should be applied or not. In nearly all cases the original signal will represent a "linear" quantity such as voltage, current, force, pressure, particle velocity, volume velocity, etc. The physical power is always related to the square (or more precise the product) of these quantities. So if you are interested in actual physical power (or energy or intensity), then you to need to apply the square. That is indeed to convention for audio signals.

[Geek Mode on]: One caveat is that simply squaring a linear quantity makes an implicit assumption about the impedance which can be misleading. For example, if you measure with a microphone reasonably far away from a loudspeaker the acoustic intensity (at this spot) is indeed proportional to the square of the measured pressure. Close up to the speaker that's not the case any more since particle velocity and pressure are not in phase. [Geek Mode off]

| improve this answer | |
$\endgroup$
2
$\begingroup$

To better approximate human perceptual response (see Weber-Fechner law) to the input data in a simplified mathematical formula, often a spectrogram displays the log of the DFT magnitudes. Thus to square the magnitude or not disappears into the graph scaling or brightness/coloring gain after taking the log().

So, no difference at all (disregarding arbitrary scaling).

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.