DSPRelated.com
Forums

FFT and Decibels

Started by Fred A. November 14, 2006
Randy Yates <yates@ieee.org> writes:

> Jerry Avins <jya@ieee.org> writes: > >> cincydsp@gmail.com wrote: >>>>> Don't. Either use x[n] = (L+R)/2 or FFT the two channels individually >>>>> and then compute the average. >>>> Why bother dividing by 2? That's just a scale factor. >>> If you're implementing this in a fixed-point system (although it >>> sounds >>> like the original problem is on a PC), then you could have overflow >>> issues if L and R were both full-scale. Dividing by 2 avoids this and >>> gives a more natural "average" of the two channels. >> >> (L + R)/2 overflows just as easily as L + R. > > Not in most DSP architectures, which have 2N+G bits in the accumulator, > where N is the native datapath length. The extra G bits keep you from > overflowing.
Nix that! You only need N+1 bits to do the sum, so any GPP that has at least this many bits in the accumulator will do. I guess I was thinking of two multiply-accumulates. -- % Randy Yates % "With time with what you've learned, %% Fuquay-Varina, NC % they'll kiss the ground you walk %%% 919-577-9882 % upon." %%%% <yates@ieee.org> % '21st Century Man', *Time*, ELO http://home.earthlink.net/~yatescr
Jerry Avins skrev:
> Rune Allnor wrote: > > Fred A. skrev: > >> I would like to have a amplitude as well as a decibel display in my program > >> of 16-bit stereo audio. > >> > >> 1) First I take the data from both channels as L,R,L,R,etc and feed it into > >> the FFT as one signal. > > > > Don't. Either use x[n] = (L+R)/2 or FFT the two channels individually > > and then compute the average. > > Why bother dividing by 2? That's just a scale factor.
Others already covered the overflow issue. Not that it matters; I only realized after I posted the reply that the OP needs to process the channels separately. Rune