1)The elliptical filter program
This wonderful piece of software was written before any of you were born, and the elliptical filters it uses were probably designed before Ken or I were born.
The filter uses a combination of two feedforward and two feedback terms,
and is normally cascaded in several sections, depending on the demands
of the design.
It will construct one passband and one or two stopbands.
The first thing you do is to design the filter. There are two ways to do this: through an interactive command line program called design_ellipse, to use with ein, or as part of a cmix script (in which case it is not interactive).
1) Commandline version (for ein):
Its instructions are
when f3 == 0, and f1 < f2, f1 is the end of the passband and f2 is the start of the stopband (lowpass);
You then specify the amount of ripple or deviation in the passband, in db,
and finally, the amount of attenuation in the stopband, in db.
You will then have two files in your current directory, fort.7 and fort.8
The command make.ell.ein will create an ein script called ell.ein, for use in ein.
2) The cmix version
The cmix instrument which implements the elliptical filter generates the coefficients with a cmix call.
There is an easy cmix script you can use to test this out.
doell inputfile outputfile f1 f2 f3 ripple db
The only thing you have to do before calling it is to create a header at the appropriate sampling rate for the output file. It will not write anything to the output file, however, but will instead just play the filtered sound as it is created. The output file must be in integer format. If it doesn't seem to work, run the arguments through the command line version to see if it is computing the coefficients properly.
If you want to write to the output file, the cmix instrument is called ell, and it has two commands
ellset(f1, f2, f3, ripple, db)
ell(start, dur, inputskip, inputchannel, outputchannel)
The minc script used by the doell script is /u/paul/m325/bin/ell.minc. The s_arg() and f_arg() commands are minc routines to read arguments from the command line, e.g.
ell inputfile outputfile 100 200 300 .1 90 < ell.minc
2)Parks/Mcclellan
This is an FIR (feedforward filter) only, and in just one section. The number of terms may be quite large, however.
Here are the author's instructions, posted in their code:
c
c-----------------------------------------------------------------------
c main program: fir linear phase filter design program
c
c authors: james h. mcclellan
c schlumberger
well services
c 12125 technology
blvd.
c austin, texas
78759
c
c thomas w. parks
c department
of electrical and computer engineering
c rice university
c houston, texas
77251-1892
c
c lawrence r.
rabiner
c bell laboratories
c murray hill,
new jersey 07974
c
c modified for terminal input by t.w. parks-9/85
c the filter specifications are written to the file "pmfil.lst"
c the impulse response is written to the file "response.dat"
c
c input:
c nfilt-- filter length
c jtype-- type of filter
c 1 = multiple
passband/stopband filter
c 2 = differentiator
c 3 = hilbert
transform filter
c nbands-- number of bands
c lgrid-- grid density, will be set to 16 unless
c specified otherwise
by a positive constant.
c
c edge(2*nbands)-- bandedge array, lower and upper edges for
each band
c
with a maximum of 10 bands.
c
c fx(nbands)-- desired function array (or desired slope if a
c
differentiator) for each band.
c
c wtx(nbands)-- weight function array in each band. for
a
c
differentiator, the weight function is inversely
c
proportional to f.
c
c sample input data setup:
c 32,1,3,0
c 0.0,0.1,0.2,0.35,0.425,0.5
c 0.0,1.0,0.0
c 10.0,1.0,10.0
c this data specifies a length 32 bandpass
filter with
c stopbands 0 to 0.1 and 0.425 to 0.5, and
passband from
c 0.2 to 0.35 with weighting of 10 in the stopbands
and 1
c in the passband. the grid density defaults
to 16.
c
c the following input data specifies a length
32 fullband
c differentiator with slope 1 and weighting
of 1/f.
c the grid density will be set to 20.
c 32,2,1,20
c 0,0.5
c 1.0
c 1.0
c
c-----------------------------------------------------------------------
Since the process is a bit more cumbersome I have not created a script-based approach.
To design the filter use pm, either build a set of arguments in a file and read by redirection (pm<script) , or enter them by hand at the prompts.
The edges of the bands are given as percentages of the sampling rate. You have to give a little room between the end of one band and the beginning of another.
The third group of arguments is used to specify whether the each band is pass (1.0) or stop (0.).
The fourth group of arguments specifies relative weights for the bands. The higher the weight, the more care is given to that band.
After creating the filter coefficients, use the command
make.pm.ein
which will leave behind an ein script called pm.ein.
(The cmix version is temporarily broken.)
3)gQ
To run the gQ app simply say 'gQ'. It has a help page and should
be fairly self explanatory