[sdiy] Digital interpolation filtering
Eric Brombaugh
ebrombaugh1 at cox.net
Sat May 30 17:23:47 CEST 2009
Tom Wiltshire wrote:
> I've never done digital filtering before though, and I've got some
> questions;
>
> Am I better off with an odd or even number of taps? Odd seems more
> logical somehow, since there is a "middle" sample, but I'm really just
> going on a gut feeling.
Generally it doesn't matter. The critical issues in digital filtering
are frequency response and processing bandwidth. Use whatever gets the
job done. There are some situations where it makes a difference, but
those are pretty unusual.
That said, a bit more detail about your filtering requirements would
help tailor a solution. How much are you interpolating? What are the
out-of-band rejection requirements?
> What's the value of the sinc function at zero? sin(x)/x is a division by
> zero so doesn't give a sensible value, and I never saw a filter that
> could handle a coefficient of infinity. How do people cope with this?
sin(x)/x @ x=0 is 0. The rationale comes from a calculus concept called
L'Hopital's rule: since the rate of change of sin(x) near 0 = 1 and the
rate of change of x near 0 = 1 also, they're both going towards 0 at
exactly the same rate, so the ratio is 1.0.
http://en.wikipedia.org/wiki/L%27H%C3%B4pital%27s_rule
> Are there are any good tools or tutorials for this stuff? I'm looking
> for something really practical and implementation based. Equations with
> complex numbers in are no use to me yet, even if they are the underlying
> theory.
My favorite tool for fooling around with signal processing stuff is
Matlab, with a free alternative work-alike called Octave:
http://www.gnu.org/software/octave/
The syntax is C-like but the data structures are arbitrary vectors or
matrices. There are lots of built-in DSP routines for filtering and
filter design and decent online help. I always use this for exploring
digital filters prior to committing to code.
> How do I work out what the hell the cutoff of the filter is from the
> coefficients? I've got two variables in the code that builds the
> coefficients. One controls the frequency (width) of the raised cosine
> window, and the other controls the frequency of the sinc function (eg
> sin(fx)/fx).
There are a lot of ways to design a filter - what method are you using?
What lead you to choose this particular solution? Where did you get the
algorithm?
> Any clues, pointers or ideas appreciated. I'm well out of my depth here!
http://www.dsprelated.com/
http://www.dspguide.com/
http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
http://ccrma.stanford.edu/~jos/filters/
etc
Eric
More information about the Synth-diy
mailing list