Digital Filters
41
As we have anticipated in sec. 2.2.1, the time constant is determined by
evaluating the distance of one of the poles from the unit circumference. In the
specific case that we are examining, such a time constant is
n
=
ln 0.01
ln r
=
ln 0.01
ln 0.95
90 samples ,
(47)
and we can verify from fig. 19 that this value makes sense.
Example 3. With the example that follows we face the problem of doing a
practical implementation of a filter. The platform that we adopt is the CSound
language (see appendix B.2) and our prototypical implementation is the second-
order all-pole IIR filter. This simple example can be extended to higher-order
filters.
We design an "orchestra" of two instruments: an excitation instrument and
a filtering block. The excitation block generates white noise. The filtering block
extracts from the noise the components in a band around a center frequency,
passed as a parameter, that corresponds to the phase of the pole
parameter is the decay time of the response of the resonant filter, which is
related to the resonance bandwidth. The Csound orchestra that implements our
two blocks is:
; res.orc: authored by Francesco Scagliola and Davide Rocchesso
sr=44100
kr=44100
ksmps=1
nchnls=1
ga1
init 0
gamp
init 30000
instr 1
; white noise generator
a1
rand gamp
ga1
=
a1 ; sound to be passed to the filter
endin
instr 2
; p4
central frequency
; p5
decay time
ipi
= 3.141592654
ithres = 0.01
; the duration of the frequency response is measured in seconds
; until the response goes below the threshold 20*log10(ithres)
8
Indeed, the central frequency of the passing frequency band is not coincident with the
phase of the complex pole, since the conjugate pole can exert some influence and slightly
modify the frequency response in the neighborood of the other pole. However, for our purposes
it is not dangerous to mix the two concepts, provided that the resulting spectrum corresponds
to our needs.