# Designing a FIR pre-emphasis filter

Started by June 10, 2004
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.

- 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, gmarsh@engr.mun.ca
On 10 Jun 2004 07:02:54 -0700, gmarsh@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.
Allan Herriman wrote:

> On 10 Jun 2004 07:02:54 -0700, gmarsh@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.
On Thu, 10 Jun 2004 23:46:06 +0100, Dan Mills
<dmills@spamblock.demon.co.uk> wrote:

>Allan Herriman wrote: > >> On 10 Jun 2004 07:02:54 -0700, gmarsh@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.
On Fri, 11 Jun 2004 13:55:50 +1000, Allan Herriman
<allan.herriman.hates.spam@ctam.com.au.invalid> wrote:

>On Thu, 10 Jun 2004 23:46:06 +0100, Dan Mills ><dmills@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.
"Allan Herriman" <allan.herriman.hates.spam@ctam.com.au.invalid> wrote in
message news:tldic0hd1aa6gigrq8hrfpvts1rgj020be@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
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!
"Gary Marsh" <gmarsh@engr.mun.ca> wrote in message