0
$\begingroup$

let's say we have signal in time domain. After we make FFT on it we will receive that signal in frequency domain. And as far as I know the real numbers mean magnitudes of each frequency bin, and imaginary numbers mean phase shifh of each frequency bin.

And then if we make inverse FFT we get again the the signal in time domain. And as far as I know that signal is expressed by real result of IFFT. But then what mean imaginary part of IFFT output?

And - what is also important - how to use it?

I am asking because I have problems with phase synchronising after IFFT so I wonder that maybe that imaginary part of IFFT has something to do?

What is very strange for me is that I have exactly the same algorithm and I get totally different results on two various computers.

I created the clean sine wave oscillator. And I use it to test my FFT->IFFT algorithm.

And on one machine it seems like phase is synchronised properly if my FFT->IFFT size is 4 times buffer size. I mean that for each one buffer (let's say size 512) I calculate FFT->IFFT size 2048. Where first 512 samples are my sine wave, and the rest 1536 samples are just zeros. And I get quite good results.

But on other machine with exact the same algorithm, the same buffer size 512 and the same sample rate 44100 I have phase issue that cause my signal sound awful.

I have no idea why it is happen. The only thing which come to my head is that the machine with awful IFFT signal is just slower and the awful sound is not caused by unsynchronised phase but because of gaps between each buffer. But I can't believe it while both machines are similarly powerfull.

So finally the main question is how to ensure phase is always synchronised after IFFT. And how to do that to work on all machines the same?

For any help great thanks in advance.

$\endgroup$
2
  • 2
    $\begingroup$ It sounds like you’ve gotten ahead of yourself. The (I)FFT is an algorithm for efficiently implementing a (I)DFT. A DFT is reversible, so if you do a DFT followed by an IDFT, your output equals your input. What does it mean if you get complex data when you were expecting real data? It means you did something wrong. Further, if you are building your own (I)FFT, you should be testing it against a known good result, such as FFTW, or an analytically obtained (I)DFT. $\endgroup$ – Dan Szabo Mar 31 at 23:49
  • $\begingroup$ Related $\endgroup$ – OverLordGoldDragon Apr 1 at 7:15
1
$\begingroup$

And as far as I know the real numbers mean magnitudes of each frequency bin, and imaginary numbers mean phase shifh of each frequency bin.

No. The magnitude of the complex spectrum $|X(k)|$ means magnitude of each freqency bin, and the phase angle of the complex spectrum $\angle X(k)$ represents phase shift.

But then what mean imaginary part of IFFT output?

If the input of IFFT is conjugate symmetric, the output of IFFT must be a real signal, and vice versa, FFT of a real signal must be conjugate symmetric.

$\endgroup$
18
  • $\begingroup$ Hmm... great thanks for your answer. Yes I was wrong with real=magnitude, imag=phase. Sorry my mistake, I've just forgot abot what you've told. But still I am not sure what exactly do you mean by "conjugate symmetric". How to ensure that symetric conjugate. And would it help with my phase issues after IFFT? $\endgroup$ – pajczur Mar 31 at 9:29
  • $\begingroup$ And if magnitude is in FFT is sqrt(real^2 + imag^2) then should I use the same after IFFT to achieve each sample (time domain) proper value? Or what? At the moment it looks like just using real as a sample value works fine, only the phase issues I have. $\endgroup$ – pajczur Mar 31 at 9:33
  • $\begingroup$ Recall the definition of DFT and check here dsp.stackexchange.com/questions/53706/… $\endgroup$ – ZR Han Mar 31 at 9:34
  • $\begingroup$ I will read that, thanks. What can I say now is that I've just tested sqrt(real^2 + imag^2) after IFFT for each sample in the buffer, but it gives totaly wrong results. I have something that is even not close to sine wave. $\endgroup$ – pajczur Mar 31 at 9:42
  • $\begingroup$ I don't quite get your point. If I understand correctly, you are trying to enframe a sine wave with 512 samples, apply zero-padding to 2048 samples, do FFT, and then take IFFT? While you didn't do anything between FFT and IFFT, why is the output of IFFT complex? $\endgroup$ – ZR Han Mar 31 at 9:56

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.