Help on FIR decimation

Started by May 14, 2013
```Hi all
I have a FIR decimation code, which is meant to decimate audio from 44100
Hz to 11025.
My problem is the output is complex, but I need to get this data back to
real number, as the complex
don't mean nothing to me. How do I do it?

The author gives the following information:

-- A 35-tap FIR decimation filter to frequency shift and subsample real
fastsamps
--  at 44100 samps/sec into complex slosamps at 11025 samps/sec. Because
the
--  decimation is complex the FIR filter is split into a 17-tap asymmetric
(real)
--  part and an 18-tap symmetric (imaginary) part. The filter is derived
from
--  QED filter FIR lowpass: sampfreq 40000, passfreq 3680, stopfreq 4970,
--  passripple -0.7, stopripple -26, 35 taps, -18dB/oct.

The coefficients are:

#define coeff0  +0.4101162
#define coeff2  -0.2934394
#define coeff4  +0.0616462
#define coeff6  +0.0735599
#define coeff8  -0.0455736
#define coeff10 -0.0334244
#define coeff12 +0.0464220
#define coeff14 -0.0009260
#define coeff16 -0.0212082

// coefficients for the 18-tap (imaginary) FIR:
#define coeff1  +0.3787480
#define coeff3  -0.1776784
#define coeff5  -0.0274270
#define coeff7  +0.0755676
#define coeff9  -0.0028674
#define coeff11 -0.0508556
#define coeff13 +0.0261172
#define coeff15 +0.0173308
#define coeff17 -0.0107808

Is there any book or article to help me?

```
```On May 14, 6:40&#4294967295;am, "joaoneves" <95126@dsprelated> wrote:
> Hi all
> I have a FIR decimation code, which is meant to decimate audio from 44100
> Hz to 11025.
> My problem is the output is complex, but I need to get this data back to
> real number, as the complex
> don't mean nothing to me. How do I do it?
>
> The author gives the following information:
>
> -- A 35-tap FIR decimation filter to frequency shift and subsample real
> fastsamps
> -- &#4294967295;at 44100 samps/sec into complex slosamps at 11025 samps/sec. Because
> the
> -- &#4294967295;decimation is complex the FIR filter is split into a 17-tap asymmetric
> (real)
> -- &#4294967295;part and an 18-tap symmetric (imaginary) part. The filter is derived
> from
> -- &#4294967295;QED filter FIR lowpass: sampfreq 40000, passfreq 3680, stopfreq 4970,
> -- &#4294967295;passripple -0.7, stopripple -26, 35 taps, -18dB/oct.
>
> The coefficients are:
>
> #define coeff0 &#4294967295;+0.4101162
> #define coeff2 &#4294967295;-0.2934394
> #define coeff4 &#4294967295;+0.0616462
> #define coeff6 &#4294967295;+0.0735599
> #define coeff8 &#4294967295;-0.0455736
> #define coeff10 -0.0334244
> #define coeff12 +0.0464220
> #define coeff14 -0.0009260
> #define coeff16 -0.0212082
>
> // coefficients for the 18-tap (imaginary) FIR:
> #define coeff1 &#4294967295;+0.3787480
> #define coeff3 &#4294967295;-0.1776784
> #define coeff5 &#4294967295;-0.0274270
> #define coeff7 &#4294967295;+0.0755676
> #define coeff9 &#4294967295;-0.0028674
> #define coeff11 -0.0508556
> #define coeff13 +0.0261172
> #define coeff15 +0.0173308
> #define coeff17 -0.0107808
>
> Is there any book or article to help me?
>

To get back to a real signal you are going to have to do a frequency
shift,  interpolate and then take the real component of what you get.
That's just an outline - you will have to really understand what you
are doing to do it properly.

The original coder uses a frequency shift - so in essence, it's like
doing a bandpass filter.

The real solution and probably the easiest is to understand the
complex numbers and use the result of what has been coded directly.

Cheers,
Dave
```
```On Tue, 14 May 2013 05:40:44 -0500, joaoneves wrote:

> Hi all
> I have a FIR decimation code, which is meant to decimate audio from
> 44100 Hz to 11025.
> My problem is the output is complex, but I need to get this data back to
> real number, as the complex
> don't mean nothing to me. How do I do it?
>
> The author gives the following information:
>
> -- A 35-tap FIR decimation filter to frequency shift and subsample real
> fastsamps
> --  at 44100 samps/sec into complex slosamps at 11025 samps/sec. Because
> the
> --  decimation is complex the FIR filter is split into a 17-tap
> asymmetric (real)
> --  part and an 18-tap symmetric (imaginary) part. The filter is derived
> from
> --  QED filter FIR lowpass: sampfreq 40000, passfreq 3680, stopfreq
> 4970, --  passripple -0.7, stopripple -26, 35 taps, -18dB/oct.
>
> The coefficients are:
>
> #define coeff0  +0.4101162
> #define coeff2  -0.2934394
> #define coeff4  +0.0616462
> #define coeff6  +0.0735599
> #define coeff8  -0.0455736
> #define coeff10 -0.0334244
> #define coeff12 +0.0464220
> #define coeff14 -0.0009260
> #define coeff16 -0.0212082
>
> // coefficients for the 18-tap (imaginary) FIR: #define coeff1
> +0.3787480
> #define coeff3  -0.1776784
> #define coeff5  -0.0274270
> #define coeff7  +0.0755676
> #define coeff9  -0.0028674
> #define coeff11 -0.0508556
> #define coeff13 +0.0261172
> #define coeff15 +0.0173308
> #define coeff17 -0.0107808

OK.  Your tree has some very nice looking bark.  That's nice.  What does
the forest look like?

What are you trying to _do_ with the signal once it's being sampled at
11025Hz?  The filter specification you have seems to point to some sort
of a data demodulation application, if anything.

--
My liberal friends think I'm a conservative kook.
My conservative friends think I'm a liberal kook.
Why am I not happy that they have found common ground?

Tim Wescott, Communications, Control, Circuits & Software
http://www.wescottdesign.com
```
```>On Tue, 14 May 2013 05:40:44 -0500, joaoneves wrote:
>
>> Hi all
>> I have a FIR decimation code, which is meant to decimate audio from
>> 44100 Hz to 11025.
>> My problem is the output is complex, but I need to get this data back
to
>> real number, as the complex
>> don't mean nothing to me. How do I do it?
>>
>> The author gives the following information:
>>
>> -- A 35-tap FIR decimation filter to frequency shift and subsample real
>> fastsamps
>> --  at 44100 samps/sec into complex slosamps at 11025 samps/sec.
Because
>> the
>> --  decimation is complex the FIR filter is split into a 17-tap
>> asymmetric (real)
>> --  part and an 18-tap symmetric (imaginary) part. The filter is
derived
>> from
>> --  QED filter FIR lowpass: sampfreq 40000, passfreq 3680, stopfreq
>> 4970, --  passripple -0.7, stopripple -26, 35 taps, -18dB/oct.
>>
>> The coefficients are:
>>
>> #define coeff0  +0.4101162
>> #define coeff2  -0.2934394
>> #define coeff4  +0.0616462
>> #define coeff6  +0.0735599
>> #define coeff8  -0.0455736
>> #define coeff10 -0.0334244
>> #define coeff12 +0.0464220
>> #define coeff14 -0.0009260
>> #define coeff16 -0.0212082
>>
>> // coefficients for the 18-tap (imaginary) FIR: #define coeff1
>> +0.3787480
>> #define coeff3  -0.1776784
>> #define coeff5  -0.0274270
>> #define coeff7  +0.0755676
>> #define coeff9  -0.0028674
>> #define coeff11 -0.0508556
>> #define coeff13 +0.0261172
>> #define coeff15 +0.0173308
>> #define coeff17 -0.0107808
>
>OK.  Your tree has some very nice looking bark.  That's nice.  What does
>the forest look like?
>
>What are you trying to _do_ with the signal once it's being sampled at
>11025Hz?  The filter specification you have seems to point to some sort
>of a data demodulation application, if anything.
>
>--
>My liberal friends think I'm a conservative kook.
>My conservative friends think I'm a liberal kook.
>Why am I not happy that they have found common ground?
>
>Tim Wescott, Communications, Control, Circuits & Software
>http://www.wescottdesign.com
>

This is part of a VLF receiver code, which is meant to record data of
lightning noise called "Sferics".
As the internet bandwidth of the time that this code was done was small the
data were decimated to 1/4 of the common audio card sample rate, which is
the ADC used in my instrument.

I had some progress studing the data produced by this code using Matlab,
but as I'm meteorologist, I dont have enough experience in DSP.

Thanks for the response

```
```>Hi all
>I have a FIR decimation code, which is meant to decimate audio from 44100
>Hz to 11025.
>My problem is the output is complex, but I need to get this data back to
>real number, as the complex
>don't mean nothing to me. How do I do it?

Nothing about a decimation filter requires the output to be complex.  If
you can figure out why the author made the decision to make it complex,
then conversion back to real data will reveal itself.
```
```Purely a guess.

If you are looking for an event like a lightning strike, you might want to look for a rapid change in the magnitude of the analytic signal, in which case you need a complex signal.

Bob

```
```>Purely a guess.
>
>If you are looking for an event like a lightning strike, you might want to
look for a rapid change in the magnitude of the analytic signal, in which
case you need a complex signal.
>
>
>Bob
>
>

It works, but it's not time accurated. I want to apply a method on some
historical data recorded using this filter. This new method would require
resample to 44100 Hz and calculations in the frequency domain.

Thanks

```
```Do you mean that the data you have is already filtered and decimated, and you want to re-sample to get back up to 44.1khz? If so, you will not recover the original bandwidth. Maybe your new frequency-domain algorithm will have an easier time of estimating time-of-arrival or direction at the higher sample rate, but fundamentally you have lost information that you can't get back.

Bob
```
```On May 14, 2:43&#4294967295;pm, "dszabo" <62466@dsprelated> wrote:
> >Hi all
> >I have a FIR decimation code, which is meant to decimate audio from 44100
> >Hz to 11025.
> >My problem is the output is complex, but I need to get this data back to
> >real number, as the complex
> >don't mean nothing to me. How do I do it?
>
> Nothing about a decimation filter requires the output to be complex. &#4294967295;If
> you can figure out why the author made the decision to make it complex,
> then conversion back to real data will reveal itself.

The data is mixed to shift the center frequency. This disturbs the
symmetry of real signals. The input into the low-pass filter is
complex and therefore the output of the filter is then complex.

This is just an alternative way of obtaining complex envelope instead
of using Hilbert transforms.

Dave
```
```On May 15, 8:21&#4294967295;am, Dave <dspg...@netscape.net> wrote:
> On May 14, 2:43&#4294967295;pm, "dszabo" <62466@dsprelated> wrote:
>
> > >Hi all
> > >I have a FIR decimation code, which is meant to decimate audio from 44100
> > >Hz to 11025.
> > >My problem is the output is complex, but I need to get this data back to
> > >real number, as the complex
> > >don't mean nothing to me. How do I do it?
>
> > Nothing about a decimation filter requires the output to be complex. &#4294967295;If
> > you can figure out why the author made the decision to make it complex,
> > then conversion back to real data will reveal itself.
>
> The data is mixed to shift the center frequency. This disturbs the
> symmetry of real signals. The input into the low-pass filter is
> complex and therefore the output of the filter is then complex.
>
> This is just an alternative way of obtaining complex envelope instead
> of using Hilbert transforms.
>

gotta have really sharp filters to do that.  back in my ham radio days
(the 1970s), we didn't have hilbert transformers and we needed very
sharp IF filters (they were electro-mechanical crystal-lattice
filters).

r b-j
```