tags:

views:

57

answers:

2

Hi all,

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.

+2  A: 

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.

Gilbert Le Blanc
+1  A: 

Option B does not make sense. Option A, which amounts to convert the signal to mono, is OK (if you are interested in a global spectrum). Your problem (double freq) is surely related to some misunderstanding in the use of your FFT routines.

leonbloy