Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Are complex-input FFTs really useful for audio analysis? (Read 2246 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Are complex-input FFTs really useful for audio analysis?

Since I've made the project "Spectrum analyzer and spectrogram using custom FFT", which has a feature to display multiple channels and Mid/Side representation (which foo_enhanced_spectrum_analyzer lacks thereof), I wonder what does "Treat channel pairs as complex input" (both in Left/Right and even Mid/Side signals) have any useful purposes for audio, not just I/Q signals in radio?

BTW, what I mean by "complex-input FFTs" is treating stereo signal as complex numbers (real part = left channel, imaginary part = right channel) and fed into FFT instead of doing two FFTs for each stereo pair

Re: Are complex-input FFTs really useful for audio analysis?

Reply #1
BTW, what I mean by "complex-input FFTs" is treating stereo signal as complex numbers (real part = left channel, imaginary part = right channel) and fed into FFT instead of doing two FFTs for each stereo pair

Since the real and imaginary parts of the transform are orthogonal, this is the same as performing a real-valued FFT once for each input and then combining the individual outputs. 

See this derivation for a more detailed explanation:  http://www.hyperdynelabs.com/dspdude/papers/COMPUTING%20THE%20FFT%20OF%20TWO%20REAL%20SIGNALS%20USING%20A%20SINGLE%20FFT.pdf


Re: Are complex-input FFTs really useful for audio analysis?

Reply #2
Its just smart optimization, to make faster processing.
Using 2 FFT transforms for real-only inputs is stupid, if you insist on using separate transforms use RDFT and not FFT.
Please remove my account from this forum.

Re: Are complex-input FFTs really useful for audio analysis?

Reply #3
Its just smart optimization, to make faster processing.
Using 2 FFT transforms for real-only inputs is stupid, if you insist on using separate transforms use RDFT and not FFT.
That's why treating the stereo input as complex numbers (useful for SDR-related I/Q signals, but idk for audio, assuming you skipped the process of turning into a stereo FFT) in the aforementioned CodePen project is faster than without, and that could be helpful optimization for @Crossover's foo_enhanced_spectrum_analyzer when comes to a feature request to display multiple channels but I'd imagine it only works on stereo pairs (especially on surround sound formats where you have center and LFE channels in-addition to usual channel pairs)

Re: Are complex-input FFTs really useful for audio analysis?

Reply #4
Since the real and imaginary parts of the transform are orthogonal, this is the same as performing a real-valued FFT once for each input and then combining the individual outputs. 

See this derivation for a more detailed explanation:  http://www.hyperdynelabs.com/dspdude/papers/COMPUTING%20THE%20FFT%20OF%20TWO%20REAL%20SIGNALS%20USING%20A%20SINGLE%20FFT.pdf


Yes, I've tried that one and it is faster (more noticeable when you use non-power of two FFT sizes like 14400 samples on multichannel FFT, while it is faster than naive DFT, it is still notoriously slow for very large sizes) than doing it separately and BTW for those who don't have access to complex numbers, here's the formula for "unscrambling" complex-input FFT (commonly used for SDR-related things) into two-channel stereo FFT:
Code: [Select]
const j = complexSpectrum.length-i;
      x = idxWrapOver(i, complexSpectrum.length),
      y = idxWrapOver(j, complexSpectrum.length);
spectrum1[i] = Math.hypot(complexSpectrum[x].re+complexSpectrum[y].re, complexSpectrum[x].im-complexSpectrum[y].im)/Math.SQRT2;
spectrum2[i] = Math.hypot(complexSpectrum[x].im+complexSpectrum[y].im, complexSpectrum[x].re-complexSpectrum[y].re)/Math.SQRT2;
where "i" is FFT bin index,
Code: [Select]
function idxWrapOver(x, length) {
  return (x % length + length) % length;
}
and "complexSpectrum" is a complex-valued FFT data

Also, I think this topic is little bit de-railed; it went into performance improvements of multichannel audio spectrum analyzers by using complex-input FFTs, which is true considering calculating two or more FFTs can have significant performance impact. But what I really mean is that is complex-input FFT as in spectrum of I/Q signals in SDR really useful for analysis of stereo audio, which is basically the same minus the "unscrambling" operation?

Re: Are complex-input FFTs really useful for audio analysis?

Reply #5
For the last sentence can you cite relevant non-pseudo scientific papers?
Please remove my account from this forum.

Re: Are complex-input FFTs really useful for audio analysis?

Reply #6
Also, I think this topic is little bit de-railed; it went into performance improvements of multichannel audio spectrum analyzers by using complex-input FFTs, which is true considering calculating two or more FFTs can have significant performance impact. But what I really mean is that is complex-input FFT as in spectrum of I/Q signals in SDR really useful for analysis of stereo audio, which is basically the same minus the "unscrambling" operation?

I don't see any reason you would want the scrambled output when you could have the regular unscrambled one instead. 

Re: Are complex-input FFTs really useful for audio analysis?

Reply #7
Also, I think this topic is little bit de-railed; it went into performance improvements of multichannel audio spectrum analyzers by using complex-input FFTs, which is true considering calculating two or more FFTs can have significant performance impact. But what I really mean is that is complex-input FFT as in spectrum of I/Q signals in SDR really useful for analysis of stereo audio, which is basically the same minus the "unscrambling" operation?

I don't see any reason you would want the scrambled output when you could have the regular unscrambled one instead. 
Perhaps, it could be a different (but possibly novel) way to visualize stereo audio spectrum (higher amplitude on one graph than other means closer to 90 degrees out-of-phase on certain frequencies, as opposed to full 180 degrees out-of-phase as in traditional L/R spectrum analyzers), where two differently-colored graphs represent magnitude part of complex-valued FFT; the first one is as it is, and the second one is same as the first, but the order is flipped since the input to the FFT data is complex-valued, thus not symmetric in the full FFT output and to be able to visualize complex-input FFTs with the frequency range of 20Hz to 20kHz and a logarithmic frequency scale

 

Re: Are complex-input FFTs really useful for audio analysis?

Reply #8
For the last sentence can you cite relevant non-pseudo scientific papers?
I'll answer this for later (probably if there are either reliable source about this as in my last sentence being cited over or a satisfactory answer that isn't about performance improvements on this miscellaneous reference desk on Wikipedia) as there aren't many non-pseudescientific papers that details the usefulness of complex-valued FFT as in I/Q signals but on audio analysis or even processing stereo audio

BTW, what I call this method a "joint stereo FFT"