It is my rough understanding that a typical spectrogram discards phase information by squaring only the real-valued part (magnitude) of the STFT (I know it's not quite this simple, but feel free to correct me if I'm wildly wrong here).
While many software libraries (e.g., scipy
) will, by default, produce a spectrogram of magnitude, they often also make it possible to instead compose a separate spectrogram for phase. My question is quite simple: if I had both of these matrices, could I reconstruct the original signal?
I suspect the answer to this question is 'not quite'. If so, what part of the process is problematic and are there any changes that could be made to make this goal achievable? I am currently using STFT.real
and STFT.imag
(where STFT
is a 2D matrix for the short time Fourier transform of some signal) and plotting of them separately. While I can reconstruct the original signal using this approach (which I need to be able to do), these plots are not as easy to read as actual spectrograms.
(For instance, I know that squaring the magnitude is clearly a problem for reconstruction as it destroys negative numbers).