Sign in

Not a member? | Forgot your Password?

Search compdsp

Search tips

Find us on Facebook!





Free PDF Downloads

A Quadrature Signals Tutorial: Complex, But Not Complicated

Understanding the 'Phasing Method' of Single Sideband Demodulation

Complex Digital Signal Processing in Telecommunications

Introduction to Sound Processing

C++ Tutorial

Introduction of C Programming for DSP Applications

Fixed-Point Arithmetic: An Introduction

Cascaded Integrator-Comb (CIC) Filter Introduction

Discussion Groups

FIR Filter Design Software

Free Online Books

See Also

Embedded SystemsFPGA

Discussion Groups | Comp.DSP | Designing a FIR pre-emphasis filter

There are 9 messages in this thread.

You are currently looking at messages 1 to .


Is this discussion worth a thumbs up?

0

Designing a FIR pre-emphasis filter - Gary Marsh - 2004-06-10 10:02:00

I'm attempting to create a FIR pre-emphasis filter. Here's the
criteria:

sampling frequency = ~100KHz
pre-emphasis curve = 75uS from 0 to 15KHz.
As little gain as possible from 15KHz above.

I think the application is obvious ;)

I have a FIR filter design on my desk which does an excellent job of
pre-emphasis as well as attenuation after 15kHz - however, the filter
was designed for a different sampling frequency (75KHz) and it was
designed using an obscure filter design program by someone I have no
contact information for. So I know it's possible, but I don't know
how.

Methods I've tried so far to replicate this design include..

- ifft+window; the preemphasis curve is distorted too much unless I
use an obscene # of taps.
- using Matlab's remez() function, called with a bunch of segments
calculated from the ideal pre-emphasis curve. Hours of playing with
segment weights still produces results that aren't that great.

Really, the shape of the pre-emphasis curve isn't *that* different
from an inverse sinc (CIC compensation) filter so I'm hoping the same
kind of techniques can be used to design them; however I'm struggling
to find any good online literature on the design of these.

Any hints/suggestions/other ideas from anyone? Thanks!

- Gary Marsh, g...@engr.mun.ca
>

Re: Designing a FIR pre-emphasis filter - Allan Herriman - 2004-06-10 10:39:00

On 10 Jun 2004 07:02:54 -0700, g...@engr.mun.ca (Gary Marsh) wrote:

>I'm attempting to create a FIR pre-emphasis filter. Here's the
>criteria:
>
>sampling frequency = ~100KHz
>pre-emphasis curve = 75uS from 0 to 15KHz.
>As little gain as possible from 15KHz above.
>
>I think the application is obvious ;)

... in which case the phase response is also important.  The
corresponding deemphasis circuit is (equivalent to) a continuous time
single pole IIR filter.

You should select the phase response of your preemphasis filter such
that the combined response of the two filters results in a flat
magnitude response and (here's the bit you're missing) a linear phase
response, up to 15kHz.  IOW, the preemphasis filter is equivalent to a
continuous time filter with a single zero.
Note that this is *not* the same as a linear phase preemphasis filter,
which is what most FIR design programs will give you.

Note that many parts of the world use 50us instead of 75us.  You might
want to make your design switchable in some way.

Regards,
Allan.


Re: Designing a FIR pre-emphasis filter - Dan Mills - 2004-06-10 18:46:00

Allan Herriman wrote:

> On 10 Jun 2004 07:02:54 -0700, g...@engr.mun.ca (Gary Marsh) wrote:
> 
>>I'm attempting to create a FIR pre-emphasis filter. Here's the
>>criteria:
>>
>>sampling frequency = ~100KHz
>>pre-emphasis curve = 75uS from 0 to 15KHz.
>>As little gain as possible from 15KHz above.
>>
>>I think the application is obvious ;)
> 
> ... in which case the phase response is also important.  The
> corresponding deemphasis circuit is (equivalent to) a continuous time
> single pole IIR filter.

How about this? 
Implement a 1 pole highpass going over at 20Khz or so, with appropriate gain
then sum with the original signal. By varying the gain I think you can vary
the overall 3db point?

Question: Is this really equivalent to a standard FM pre-emph network?

BTW: Why are you running the preemph at such a high sample rate? I have been
playing with running it at 44.1Khz then upsampling to the final rate just
prior to overshoot limiting and MPX generation. This seems to work ok.
Obviously clipping is kind of hard to implement with this scheme....

The upsampler impulse can conviniently also provide the 15Khz LPF. 

If anyone out there knows how to design a sharp low pass filter that does
not overshoot with any input signal could they please tell us, it is boring
having to give up 10Khz of perfectly good modulation to bloody filter
overshoot. I have a few ideas but they are not suitable for real time (in
the sense of having a well bounded execution time) use.

Regards, Dan (Who has code just waiting for a CVS repository to be setup). 
-- 
Any sufficiently advanced communication is indistinguishable from noise! 
The email address  *IS*  valid, do not remove the spamblock.


Re: Designing a FIR pre-emphasis filter - Allan Herriman - 2004-06-10 23:55:00

On Thu, 10 Jun 2004 23:46:06 +0100, Dan Mills
<d...@spamblock.demon.co.uk> wrote:

>Allan Herriman wrote:
>
>> On 10 Jun 2004 07:02:54 -0700, g...@engr.mun.ca (Gary Marsh) wrote:
>> 
>>>I'm attempting to create a FIR pre-emphasis filter. Here's the
>>>criteria:
>>>
>>>sampling frequency = ~100KHz
>>>pre-emphasis curve = 75uS from 0 to 15KHz.
>>>As little gain as possible from 15KHz above.
>>>
>>>I think the application is obvious ;)
>> 
>> ... in which case the phase response is also important.  The
>> corresponding deemphasis circuit is (equivalent to) a continuous time
>> single pole IIR filter.
>
>How about this? 
>Implement a 1 pole highpass going over at 20Khz or so, with appropriate gain
>then sum with the original signal. By varying the gain I think you can vary
>the overall 3db point?
>
>Question: Is this really equivalent to a standard FM pre-emph network?

Yes.

Proof:

HPF has transfer function

  tau s
----------
tau s + 1

Add original signal with gain k:
  tau s
---------- + k
tau s + 1

   ((k+1)/k)tau s + 1
= --------------------
     tau s + 1

The result has a pole at s = -1/tau, which is the same as the original
20kHz or so LPF (tau would be about 7.5 us or so)
and a zero at s = -1/((k+1)/k)tau, which determines the preemphasis.

For 75us preemphasis, (k+1)/k needs to be about 10, which means k is
about 0.09091 or so.
(For 50us, k would be about 0.13)

This of course is *continuous time*.  The shape will vary slightly in
a discrete time system, and a (typically) FIR equaliser will be
needed.  As you noted, this eq can be part of the 15kHz brickwall LPF
and upsampler.

>BTW: Why are you running the preemph at such a high sample rate? I have been
>playing with running it at 44.1Khz then upsampling to the final rate just
>prior to overshoot limiting and MPX generation. This seems to work ok.
>Obviously clipping is kind of hard to implement with this scheme....
>
>The upsampler impulse can conviniently also provide the 15Khz LPF. 
>
>If anyone out there knows how to design a sharp low pass filter that does
>not overshoot with any input signal could they please tell us, it is boring
>having to give up 10Khz of perfectly good modulation to bloody filter
>overshoot. I have a few ideas but they are not suitable for real time (in
>the sense of having a well bounded execution time) use.

This is the fun part - clipping AND band limiting.  

>BTW: Why are you running the preemph at such a high sample rate?

Clipping (and most non-linear processing) is easier with a higher
sampling rate.

Regards,
Allan.


Re: Designing a FIR pre-emphasis filter - Allan Herriman - 2004-06-11 00:45:00

On Fri, 11 Jun 2004 13:55:50 +1000, Allan Herriman
<a...@ctam.com.au.invalid> wrote:

>On Thu, 10 Jun 2004 23:46:06 +0100, Dan Mills
><d...@spamblock.demon.co.uk> wrote:
>>If anyone out there knows how to design a sharp low pass filter that does
>>not overshoot with any input signal could they please tell us, it is boring
>>having to give up 10Khz of perfectly good modulation to bloody filter
>>overshoot. I have a few ideas but they are not suitable for real time (in
>>the sense of having a well bounded execution time) use.
>
>This is the fun part - clipping AND band limiting.  

I'm reminded of an analog design I saw in the '80s.  It had a
brickwall 15kHz LPF made of cascaded 2nd order systems.  (I think the
overall response might have been Butterworth, but that's not
particularly important here.)

Normally one designs such systems with the lowest Q 2nd order system
at the input and the highest Q 2nd order system at the output.

The design I saw had the order reversed, and there was a clipper
between each stage.
The results looked good on a scope (flat topped waves without
overshoot).  I didn't get to hear it under ideal listening conditions
though, so I can't comment on the sound.

The lesson I learnt was that if you are trying to limit both amplitude
AND bandwidth, you do it in one step.   
Having separate limiters and brickwall LPFs doesn't give the best
possible result.  (I have no formal proof for that though.)

Regards,
Allan.


Re: Designing a FIR pre-emphasis filter - Jon Harris - 2004-06-11 13:37:00

"Allan Herriman" <a...@ctam.com.au.invalid> wrote in
message news:t...@4ax.com...
>
> I'm reminded of an analog design I saw in the '80s.  It had a
> brickwall 15kHz LPF made of cascaded 2nd order systems.  (I think the
> overall response might have been Butterworth, but that's not
> particularly important here.)
>
> Normally one designs such systems with the lowest Q 2nd order system
> at the input and the highest Q 2nd order system at the output.

Just curious, why is it done this way?  When I implemented a digital IIR
Butterworth filter with second order sections in series, I put the highest Q
section first.  My thinking was that the harmonic distortion due to finite
precision is worse with higher Q sections.  So I put those first so that some of
those distortion components could be filtered out by the subsequent lower
Q/lower distortion sections.  The difference was probably negligible, but since
there is no difficulty in choosing any particular ordering, I figured I might as
well do it this way.

Are there other considerations I'm missing?  Maybe clipping with analog filters?
My implementation was floating point, so digital clipping wasn't a concern.

-Jon


Re: Designing a FIR pre-emphasis filter - Gary Marsh - 2004-06-11 13:59:00

I think I'd get in trouble if I talked about why we're using such a
high sample rate, so I won't. ;)

I've already looked into an IIR approach, but dismissed it. A
single-zero filter works great, but I have to get the gain down beyond
15KHz - Putting zeroes beyond 15KHz warps the shape of the
pre-emphasis curve rather badly, and moving them further away (to fix
the shape) involves boosting a lot of noise and making life harder for
the >15KHz lowpass. Plus there's the list of FIR filter taps I have on
my desk that accomplishes both pre-emphasis and lowpass very nicely in
just one filter, but at the wrong sampling frequency.

I never thought of doing FIR equalization; maybe I'll give IIR another
chance. I think I'll be learning a few more Matlab commands today.

Thanks!


Re: Designing a FIR pre-emphasis filter - Fred Marshall - 2004-06-11 15:08:00

"Gary Marsh" <g...@engr.mun.ca> wrote in message
news:1...@posting.google.com...
> I'm attempting to create a FIR pre-emphasis filter. Here's the
> criteria:
>
> sampling frequency = ~100KHz
> pre-emphasis curve = 75uS from 0 to 15KHz.
> As little gain as possible from 15KHz above.
>
> I think the application is obvious ;)
>
> I have a FIR filter design on my desk which does an excellent job of
> pre-emphasis as well as attenuation after 15kHz - however, the filter
> was designed for a different sampling frequency (75KHz) and it was
> designed using an obscure filter design program by someone I have no
> contact information for. So I know it's possible, but I don't know
> how.
>
> Methods I've tried so far to replicate this design include..
>
> - ifft+window; the preemphasis curve is distorted too much unless I
> use an obscene # of taps.
> - using Matlab's remez() function, called with a bunch of segments
> calculated from the ideal pre-emphasis curve. Hours of playing with
> segment weights still produces results that aren't that great.

Gary,

You already have a FIR filter designed for 75kHz sample rate, right?
You didn't say if it was symmetric / linear phase or not.  That might /
might not make a difference in how one might approach this.  That is, are
the coefficients symmetric?  e.g. 1 2 3 4 5 4 3 2 1
You didn't say what sample rate you want to achieve.
Presumably you want the same frequency response below 15kHz.

Let's look at it this way:
The prototype filter (the one you have) has a sample rate and a temporal
length which together yield a length in samples or number of coefficients.
The temporal length determines the frequency resolution or the distance
between samples in frequency.
The sample rate determines the frequency span of the filter.

So, to keep the same frequency resolution you would at least need to keep
the temporal length of the filter the same.
However, to reduce the sample rate, this would reduce the number of
coefficients in the filter.
Now, this may be OK because you don't have to cover as wide a frequency
range as before.

I would be tempted to try this:
FFT the filter coefficients.
For a filter of length N, you will get N frequency samples.

(If the filter is symmetrical and if you center it properly (i.e. around
zero in time) in the FFT the result will be a real, even frequency response.
That makes it easier to look at / comprehend.  I think it's worth the
trouble).

At frequencies at some point above 15kHz and extending to the old sample
rate /2 , you want to make the frequency samples all zero.
You might do this with a tapered edge window that is all zero above the new
sample rate /2.
Now, scrunch the frequency coefficients so the zeroed region is gone.
This moves the old sample rate down to the new sample rate but keeps the
frequency sample interval the same.
When that's done, IFFT.

You should get a filter response that is quite close to the old one but at a
lower sample rate.

Example:  New sample rate is 44kHz.  The difference from 75kHz is 31kHz.
Assume the filter length is 64.
The FFT will be length 64 representing 1172 Hz per frequency sample.
15kHz is at 13 sample intervals or at the 14th sample.
22kHz (half of 44kHz) is at the 20th sample.

65-20E samples where the new sample rate resides.

So, you will zero all the frequency samples between 20 samples and 45
samples (plus or minus a sample for my poor arithmetic) - these are the
samples lying between 22kHz and 37.5kHz and thier mirror image above 37.5kHz
to 53kHz.
As above, you may wish to taper down to zero by reducing the samples
gradually from sample 14 to sample 20 and gradually from sample 50 to sample
44.

Now, create a new frequency array from sample 1 to sample 20 and from sample
44 to sample 64 by making sample 44 the new sample 21, etc.  The new array
is around length 40.  IFFT this array to get the new filter coefficients
with the lower sample rate.
Because the frequency sample interval stays the same and because the sample
rate is reduced, the filter is shorter.

The thing to look out for in using this method is temporal ringing due to
the effect of the window.  That's why the frequncy window is tapered.
However, most of the zeros you're introducing are in the stop band and
should have little effect.  So, testing is indicated.

Fred


Re: Designing a FIR pre-emphasis filter - Dan Mills - 2004-06-13 10:34:00

Gary Marsh wrote:

> I think I'd get in trouble if I talked about why we're using such a
> high sample rate, so I won't. ;)
> 
> I've already looked into an IIR approach, but dismissed it. A
> single-zero filter works great, but I have to get the gain down beyond
> 15KHz - Putting zeroes beyond 15KHz warps the shape of the
> pre-emphasis curve rather badly, and moving them further away (to fix
> the shape) involves boosting a lot of noise and making life harder for
> the >15KHz lowpass. 

<Snip>

Do you actually want preemph? Or do you want a band limited differentiator?
The advantage of the differentiator is that you can easily implement
sibilence limiting by putting a compressor on the output of the
differentiator before summing the original signal back in....

Ref filter overshoot, I amplaying with a system which has the main 15K LPF
implemented by the upsampler filter, which then feeds a zero crossing
clipper the output of which is then filtered by an IIR filter that goes
over at about 17K (by which point the input 15K LPF is well down). Thus the
only overshoot out of the final IIR is due to components generated by the
clipper. 
This seems to work ok so far. 

Query for those who actually have some DSP background - If I have a window
of say 50 odd samples over which I need to change the gain of a system in a
monotonic fasion between 2 levels, what is the best I can do in terms of
intermod products? 

I am guessing that making the gain curve follow sin (0 -> Pi/2) is about as
good as it gets, as at the ends of the transition dg/dt is zero, but is
there something that is better? I am trying to implememnt a sort of 'band
limited clipper' by looking ahead just far enougth that I can keep the
highest frequency component of the gain control waveform below say 3khz
while still hitting the required gain at each point.


Regards, Dan.
-- 
And on the evening of the first day, the lord said.... LX1, Go!
And there was light. 
The email address  *IS*  valid, do not remove the spamblock.