DSPRelated.com
Forums

spectral band energy detection

Started by hurry September 17, 2008
Hi,

Am intersted in measuring low band (0 to F Hz)  and high band energy
(F to fs/2) from a single frame of audio. The cut-off freq (F Hz) is
fixed. My initial motive was to use a QMF but later using FFT looked
attractive considering the cost involved (number of multiplications
and additions). In case of FFT I end up calculating every bin's
magnitude (and calculate energy by taking root under sum of the
magnitude squares of the freqs. of interest) which, looks like a over-
kill for my application. So my hunch is that there must be some better
way of doing it rather than FFT.

Pls pour in your thoughts.

Regards,
Hari.
hurry  <hurrynarain@gmail.com> wrote:

>Am intersted in measuring low band (0 to F Hz) and high band energy >(F to fs/2) from a single frame of audio. The cut-off freq (F Hz) is >fixed. My initial motive was to use a QMF but later using FFT looked >attractive considering the cost involved (number of multiplications >and additions). In case of FFT I end up calculating every bin's >magnitude (and calculate energy by taking root under sum of the >magnitude squares of the freqs. of interest) which, looks like a over- >kill for my application. So my hunch is that there must be some better >way of doing it rather than FFT.
Would a low pass filter followed by energy measurement do the trick? That's go to be the cheapest possible method. Steve
On Sep 17, 12:52&#4294967295;pm, spop...@speedymail.org (Steve Pope) wrote:
> hurry &#4294967295;<hurrynar...@gmail.com> wrote: > >Am intersted in measuring low band (0 to F Hz) &#4294967295;and high band energy > >(F to fs/2) from a single frame of audio. The cut-off freq (F Hz) is > >fixed. My initial motive was to use a QMF but later using FFT looked > >attractive considering the cost involved (number of multiplications > >and additions). In case of FFT I end up calculating every bin's > >magnitude (and calculate energy by taking root under sum of the > >magnitude squares of the freqs. of interest) which, looks like a over- > >kill for my application. So my hunch is that there must be some better > >way of doing it rather than FFT. > > Would a low pass filter followed by energy measurement do > the trick?
Let's suppose the answer to this question is "Yes". How would he do the energy measurement after the low-pass filter? -Le Chaud Lapin-
Le Chaud Lapin  <jaibuduvin@gmail.com> wrote:

>On Sep 17, 12:52&#4294967295;pm, spop...@speedymail.org (Steve Pope) wrote:
>> hurry &#4294967295;<hurrynar...@gmail.com> wrote:
>>>Am intersted in measuring low band (0 to F Hz) &#4294967295;and high band energy >>>(F to fs/2) from a single frame of audio. The cut-off freq (F Hz) is >>>fixed. My initial motive was to use a QMF but later using FFT looked >>>attractive considering the cost involved (number of multiplications >>>and additions). In case of FFT I end up calculating every bin's >>>magnitude (and calculate energy by taking root under sum of the >>>magnitude squares of the freqs. of interest) which, looks like a over- >>>kill for my application. So my hunch is that there must be some better >>>way of doing it rather than FFT.
>> Would a low pass filter followed by energy measurement do >> the trick?
>Let's suppose the answer to this question is "Yes".
>How would he do the energy measurement after the low-pass filter?
The first post referred to "a single frame of audio". I interpret a frame as being a finite-length signal. So, the sum of the magnitude-squared of all samples in the lowpass filtered frame would be the energy. I see no need for any further windowing in this case, unless and until the results are somehow undesirable. Steve
On Sep 17, 2:00&#4294967295;pm, spop...@speedymail.org (Steve Pope) wrote:

> >> Would a low pass filter followed by energy measurement do > >> the trick? > >Let's suppose the answer to this question is "Yes". > >How would he do the energy measurement after the low-pass filter? > > The first post referred to "a single frame of audio". &#4294967295;I interpret a > frame as being a finite-length signal. &#4294967295;So, the sum > of the magnitude-squared of all samples in the lowpass filtered > frame would be the energy. > > I see no need for any further windowing in this case, unless and > until the results are somehow undesirable.
Right. I was wondering if the OP was aware that you were invoking the principle of duality: 1/sqrt(2*pi) frequency-domain-integral = 1/sqrt(2*pi) time-domain- integral I just typed in "Fourier duality" on Google and good illustration of the relation. -Le Chaud Lapin-
Le Chaud Lapin  <jaibuduvin@gmail.com> wrote:

>On Sep 17, 2:00&#4294967295;pm, spop...@speedymail.org (Steve Pope) wrote:
>> >> Would a low pass filter followed by energy measurement do >> >> the trick? >> >Let's suppose the answer to this question is "Yes". >> >How would he do the energy measurement after the low-pass filter? >> >> The first post referred to "a single frame of audio". &#4294967295;I interpret a >> frame as being a finite-length signal. &#4294967295;So, the sum >> of the magnitude-squared of all samples in the lowpass filtered >> frame would be the energy. >> >> I see no need for any further windowing in this case, unless and >> until the results are somehow undesirable.
>Right. I was wondering if the OP was aware that you were invoking the >principle of duality:
>1/sqrt(2*pi) frequency-domain-integral = 1/sqrt(2*pi) time-domain- >integral
>I just typed in "Fourier duality" on Google and good illustration of >the relation.
Since I'm doing absolutely nothing in the frequency domain, I am not invoking any principle of duality. Steve
Hi Steve,
I had the same idea, but after some thought there is a point that I really
don't understand.   

Say we start with x[n], and run it through a low-pass filter to create
xl[n]. We then could form the matching high-pass filter by calculating
xh[n] = x[n] - xl[n].   Since x[n] = xl[n] + xh[n], the frequency responses
of the two filters should add to unity, as we would like.  

The problem is, working through the algebra, the energy in xl[n] plus the
energy in xh[n] doesn't seem to add up to the energy in the original signal
x[n].  What am I missing here?
Regards,
Steve
SteveSmith <Steve.Smith1@SpectrumSDI.com> wrote:

>Hi Steve,
>I had the same idea, but after some thought there is a point that I really >don't understand.
>Say we start with x[n], and run it through a low-pass filter to create >xl[n]. We then could form the matching high-pass filter by calculating >xh[n] = x[n] - xl[n]. Since x[n] = xl[n] + xh[n], the frequency responses >of the two filters should add to unity, as we would like.
>The problem is, working through the algebra, the energy in xl[n] plus the >energy in xh[n] doesn't seem to add up to the energy in the original signal >x[n]. What am I missing here?
If the low-pass filter were zero-phase, then the energy would be equal. However if there is phase shift through the low-pass filter, then you are right it does not add up. To illustrate this, consider the case of a frequency at which the lowpass filter has a gain of 0.1 and a phase shift of 180 degrees. Depending on your application and your signal, if using this approach you may need to use a zero-phase-shift filter, or you may get away with a (simpler) filter that has some phase shift but does not give too much of an incorrect result. Steve
On Sep 17, 3:00&#4294967295;pm, spop...@speedymail.org (Steve Pope) wrote:
> Le Chaud Lapin &#4294967295;<jaibudu...@gmail.com> wrote: > >> I see no need for any further windowing in this case, unless and > >> until the results are somehow undesirable. > >Right. I was wondering if the OP was aware that you were invoking the > >principle of duality: > >1/sqrt(2*pi) frequency-domain-integral = 1/sqrt(2*pi) time-domain- > >integral > >I just typed in "Fourier duality" on Google and good illustration of > >the relation. > > Since I'm doing absolutely nothing in the frequency domain, > I am not invoking any principle of duality.
Yes. I was writing more for the OP, than for everyone else (you, etc.) since, if he is thinking about FFT's, his mind is already in the frequency domain, and seeing the duality formula might have jarred memory or removed momentatrily lapse of reason, since notion of signal energy and bandlimiting in time-domain is so basic, was highly unlikely that he would not have encountered this in his studies. [See, I am doing again - There is nothing to "encounter". One simply band-limits the signal with filter and take energy.] -Le Chaud Lapin-
On Sep 17, 10:52&#4294967295;pm, spop...@speedymail.org (Steve Pope) wrote:
> hurry &#4294967295;<hurrynar...@gmail.com> wrote: > >Am intersted in measuring low band (0 to F Hz) &#4294967295;and high band energy > >(F to fs/2) from a single frame of audio. The cut-off freq (F Hz) is > >fixed. My initial motive was to use a QMF but later using FFT looked > >attractive considering the cost involved (number of multiplications > >and additions). In case of FFT I end up calculating every bin's > >magnitude (and calculate energy by taking root under sum of the > >magnitude squares of the freqs. of interest) which, looks like a over- > >kill for my application. So my hunch is that there must be some better > >way of doing it rather than FFT. > > Would a low pass filter followed by energy measurement do > the trick? > > That's go to be the cheapest possible method. > > Steve
Hi Steve This (idea of low pass) was my first thought but, say if I use a filter with say 10 coeff. then wouldnt it mean, for a frame length of 1024, I would end up with approx 1024*10 multiplications and 1024*9 additions. And whereas with fft it is (N/2)log2 (N) multiplications where N = 1024.