ODP: Filters
Brigman, Corley
corley.brigman at intel.com
Tue Jan 12 01:58:00 CET 1999
>especially compared to using "FIR" and "IIR" methods, which will probably
be
>just as good for doing analog-synth style filtering (anyone have any
>opinions here?).
ok, i don't know a whole lot about filtering (some from a DSP class), and I
answered this for the below instead, but: most real filters can be better
approximated with IIR filters. the main difference between FIR filters and
IIR
filters is that the FIR filter uses a finite number of data points and the
IIR
filter an infinte number of data points. infinite, you say? how's that?
well,
FIR filters take as input only samples in the input data stream; an IIR
filter
also takes samples in the output data stream. which is to say, that if x is
the
input stream, y is the output stream, and a is an array of constants:
FIR:
y[n] = a[n-k]x[n-k] + ... + a[n]x[n] + a[n+1]x[n+1] + ... + a[n+k]x[n+k]
where as:
IIR:
y[n] = a[n-k]x[n-k] + ... + a[n]x[n] + a[n+1]x[n+1] + ... + a[n+k]x[n+k] +
b[n-k]y[n-k] + ... + b[n]y[n] + b[n+1]y[n+1] + ... + b[n+k]y[n+k]
Theoretically, k can be infinity, but practically of course it's not :)
Since
the y[n] for the IIR is recursive, however, it kind of implicitly goes to
infinity since even the simple:
y[n] = .9y[n-1] + x[n]
depends on EVERY previous data point back to -infinity.
IIR filters usually require less terms and are much easier to implement
realtime. At least, AFAIK - i've never actually done one :) I will
eventually....
>(i've written a windows
>softsynth with labview that does this, incidentally.. not in real time
>though. if anyone would like to play with it, let me know).
i would! i built something similar (no filters yet though), except it really
was
additive i.e. no ifft. and definitely not real time. so there's no problem
with
harmonics not becoming "harmonic". the filter contour just affects the gain
of
each harmonic, so adding a filter becomes just a simple multiplication per
harmonic.
the main problem with the FFT-based implementation is, afaik, that each
"window"
of the FFT don't have a 1:1 correspondence to frequency. i.e.: at 44.1KHZ,
if
you take a sample of 512 samples, then each sample corresponds to approx. 43
HZ
(iirc) and I THINK it is linear?? can't remember for sure. increasing the
window
size helps, but for each band you are increasing/decreasing a frequency
RANGE
and not a frequency per se - i guess this is why you have the "harmonic"
problems? note that I'm not real familiar
with the iFFT math (it's simpler than FFT math, right?) but doing it as
straight
sines can be very precise, allowing specific detuning, etc. (which is
included
in the program I wrote) phase doesn't matter at this point, although I did
include it :) also, given some memory it can be very fast. you can use a
kind of
"phase accumulator" (at least this is what I though you guys meant when you
were
first talking about it) where you divide 2pi by the number of samples per
cycle
(yes, this can be a fraction) giving you the increment to phase, which is
then
fed into a sine function (there are several ways to speed this up, i think,
one
way is lookup tables, but there are many others - you can trade accuracy for
speed here if desired). one more multiplication per harmonic gives you
filter,
just like the FFT version. i don't know if it's simpler or more complex, but
it's different.
a preview of the (dos) version of this program is at
http://members.xoom.com/elev8. it's early and is a VERY simple additive
synth
with no filters. i wrote it to send basic waveforms to my prophet 3000
sampler,
which has nice cem3387 analog filters....
anyway, i plan to add modulations (envs, lfos, etc), a formant filter which
will
have several models that are mathematically pure as well as a user-definable
X-band graphic EQ. as well as other waveforms for the additive engine (this
won't work for the formant filter, at the moment). the k5000 formant filter
is a
128-band graphic EQ. an FFT-based system might work better here, since
that's
kind of what it is, for non-sinewave base waveform. but maybe an FFT-type
analyzer might give me a good harmonic list here, which I could use to add
together instead.. anyway this is heavy into additive. although they are
very
related.
one more advantage of this is that I plan to have FM-style feedback loops
available as well i.e. in addition to the envelopes for each harmonic, the
harmonics themselves can be used as modulation sources, which could modulate
volume of other harmonics for instance or pitch (FM) of another harmonic.
i'm
planning to allow phase mod too for those casio CZ-style patches :) anyway i
wrote the above program in a couple of days a few months ago, with not much
progress since. time to get cracking again....
<design idea>
sounds very cool.
corley brigman
intel corp.
corley.brigman at intel.com
speaking for me, not for intel.
More information about the Synth-diy
mailing list