# Getting audio samples from power spectrum

Let's say I have a signal sig in a form of a .wav file, I've read that file, and now I have an array of samples of that audio, after that I've performed FFT on that array and got an array of complex numbers, that'll be fft, which consists of positive as well as negative values. After that I've computed power spectrum, ps using this formula:

ps[a] = sqrt(fft[a].real^2 + fft[a].imag^2).

So, basically process looks like this: sig$\rightarrow$ fft$\rightarrow$ ps. Now, the question is: can I go backwards, meaning: ps$\rightarrow$ fft$\rightarrow$ sig?

• The short answer is no. There is no way to fully reconstruct the original signal, once you dropped the phase of your signal.
– jojek
Aug 2, 2016 at 18:51
• To put it another way: there are many different signals that have the same power spectrum.
– MBaz
Aug 2, 2016 at 21:48

## 1 Answer

No, the power spectrum only holds half of the information that the DFT'ed signal held, which held all the information that the original audio signal held.

Sadly, that half is important, and not reconstruction is possible. You might come up with an estimator that "guesses" the phase information you're losing by doing the magnitude square, but it will not recover the original signal in the general case. I'm not aware of any such estimators that do something useful.

In short: you can reverse the DFT, it's a reversible operation. You cannot revert calculating the magnitude square of complex numbers – that is a irreversible operation, and hence, you can't recover the original signal from a PSD estimate.

To illustrate this:

Imagine you record one hour (let's say from $t=-18000$ to $t=1800) of perfect silence, and in the middle of that is one second of a pure 100 Hz sine tone. The DFT of that is pretty simple: In time domain, it's a sine (which is infinite) multiplied with a unit rectangular window. We know the spectrum of that; it's the convolution of the Fourier transform of the sine (which is dirac with "area"$\frac 12j$at the positive frequency, and$-\frac12j$at the negative frequency) convolved with the Fourier transform of a rectangular window (which is always some scaled$\text{sinc}$function). Hence, we know that the DFT of that recording must be the sum of two shifted sincs, one of those being "mirrored" on the frequency axis. Now, we estimate the PSD by just calculating the magnitude square point-wise, and we end up with something that looks like two positive lumps at the positive and negative frequencies. For obvious reasons, it's symmetric to the magnitude axis. We call the DFT$X(f)$, and that leaves us with the PSD estimate$|X(F)|^2$We now decide that the 1s of tone shouldn't be at the$t=0$, but let's say at$t=900$; now, instead of recalculating the whole spectrum, we just apply the time-shift property of Fourier transform: a$\Delta t$shift in time domain is a multiplication with$e^{j2\pi f \Delta t}$in frequency domain. That way, we just need to multiply with this function in frequency domain. And lo! Let$X(f)\cdot e^{j2\pi f \Delta t}$be our spectrum, and$|X(f)\cdot e^{j2\pi f \Delta t}|^2$be our PSD estimate. Observe that the modulation with the complex$e\$xponential doesn't change magnitude square – hence, you can't tell time shifts from your PSD alone.

• I think in the second paragraph you mean and now reconstruction is not possible.
– jojek
Aug 3, 2016 at 7:48
• @MarcusMüller ok, and if I still have corresponding phase spectrum to each power spectrum ? Is there a way to use those two to rebuild the signal ? Aug 4, 2016 at 18:19
• well, sqrt(power)==magnitude, and with magnitude and phase, you have the original signal! (magnitude & phase is equivalent to real & imaginary. See Euler's formula) Aug 4, 2016 at 19:25
• @MarcusMüller so, after performing DFT, I calculate power spectrum with sqrt(fft[a].real^2 + fft[a].imag^2) and phase with tan^-1*(fft[a].real/fft[a].imag) and I'll have enough information to reconstruct signal with help of Euler's formula, am I right ? Why everyone said that this is not possible ? Am I missing something ? Aug 5, 2016 at 18:13
• @YuriyKravets: You might want to accept this answer if it answers your question. We are trying to avoid un-answered questions here...
– jojek
Aug 29, 2016 at 8:50