Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to represent stereo audio data for FFT

Tags:

fft

How should stereo (2 channel) audio data be represented for FFT? Do you

A. Take the average of the two channels and assign it to the real component of a number and leave the imaginary component 0.

B. Assign one channel to the real component and the other channel to the imag component.

Is there a reason to do one or the other? I searched the web but could not find any definite answers on this.

I'm doing some simple spectrum analysis and, not knowing any better, used option A). This gave me an unexpected result, whereas option B) went as expected. Here are some more details:

I have a WAV file of a piano "middle-C". By definition, middle-C is 260Hz, so I would expect the peak frequency to be at 260Hz and smaller peaks at harmonics. I confirmed this by viewing the spectrum via an audio editing software (Sound Forge). But when I took the FFT myself, with option A), the peak was at 520Hz. With option B), the peak was at 260Hz.

Am I missing something? The explanation that I came up with so far is that representing stereo data using a real and imag component implies that the two channels are independent, which, I suppose they're not, and hence the mess-up.

like image 842
vroooom Avatar asked Jul 20 '10 07:07

vroooom


People also ask

What does FFT do to audio signal?

The "Fast Fourier Transform" (FFT) is an important measurement method in the science of audio and acoustics measurement. It converts a signal into individual spectral components and thereby provides frequency information about the signal.

What is FFT size in audio?

The FFT size defines the number of bins used for dividing the window into equal strips, or bins. Hence, a bin is a spectrum sample , and defines the frequency resolution of the window. By default : N (Bins) = FFT Size/2. FR = Fmax/N(Bins)

How FFT is used to represent a signal?

FFT convolution uses the principle that multiplication in the frequency domain corresponds to convolution in the time domain. The input signal is transformed into the frequency domain using the DFT, multiplied by the frequency response of the filter, and then transformed back into the time domain using the inverse DFT.


1 Answers

I don't think you're taking the average correctly. :-)

C. Process each channel separately, assigning the amplitude to the real component and leaving the imaginary component as 0.

like image 93
Gilbert Le Blanc Avatar answered Sep 19 '22 04:09

Gilbert Le Blanc