Digital Filtering

1. Digital Filtering

This text discusses some of the theory underlying both analog and digital filters and related systems, but as yet is limited to some narrowly defined applications related to sound synthesis.

1.1 Introduction

Analog filters in for instance sound synthesizers have characteristics that are pleasing in a musical sense, can be modeled to contain non-linearities in ways known to yield interesting sounds, and can be modeled and synthesized using long standing techniques, with ample theoretical backup.

Digital filters have a shorter history, though they might currently be even more in use than their analog counterparts. They too have a theoretical foundation, but are not general of a form that gives sound synthesists the most satisfaction. There are objective reasons for this, of which the main one pertains to the type of filter used, and its correspondance with physical systems. Analog filters have one on one correspondences with n-th order linear physical systems (e.g. spring -mass systems), whereas such relationships are not always as clear with commonly applied digital filters.

The reasons for this is that digital models of analog circuits are not the most straightforward implementations of filter type of transfer functions. The are straightforward implementations of analog circuits, bt they are often discarded because of their undesirable properties with respect to samplng noise and stability. The first aim of this text is to give a theoretically founded digital model of a standard type of analog filter that can be made to respond with sufficient and known accuracy.

As time permits, a discussion will be added on the, not completely unrelated, waveguide type of element.

1.2 General filter models and types

As a foundation for the discussion of the target filter types,

1.2.1 The `s' Transform

Observing that many physical processes and signals have exponential shape, and that exponentials can by introducing complex numbers instantly be turned into sinusodials, it is a reasonable idea to compute the correlation of a signal with all possible exponentials and characterize it by the results. Let X(t) be a signal, and let X(s) its s-transform, then the la Place transform of x(t) is defined as:



ax(t)+by(t) aX(s)+bY(s)

Transfer function

y(x(t)) Y(s)X(s)

differential operators


impulse response

(t) 1,

where is the Dirac function, zero everywhere except a differential interval around zero, with a surface integral of 1. This implies that the response of a system to an impuls excitationi is equal to the transfer function transformed back to the t axis.

standard transforms

                 x(t)                    X(s)                                     
(t)                                      1                                        
step(t)                                  1/s                                      

inverse transform by identifying linear and operator components

fraction splitting

1.2.2 The Fourier Transform

In electrical engineering (and other serious branches of mathematics and science), many processes and related variable progressions are characterized by sinusodial components. A major reason, apart from the obvious comparison with the harmonic oscilator, is the possiblity of defining a signal by its frequency components. The means to arrive at a frequency (plus phase) characterization of a signal is the Fourier tranform, which is related to the s transform mentioned in the previous section by substituting the real-valued s variable by the complex value j. The fourier tranform F(t) of a signal x(t) can thus be expressed as:


by substitution, where B is the maximum bandwidth of the signal x(t).


The same properties hold as for the s-transform above.

1.2.3 Function theory applied to tranfer functions, adding feedback
1.2.4 Quantizing the time variable

Shannon's sampling theorem

Sinc functions and bandwidth limited signals

Orthogonality of sync functions

Back transform as sum of sync functions

Perfect reconstruction as a infinite delay filter

Backtransform considerations

Examination of the sinc function easily leads to the observation that samples have a large span of impact on the amplitude of a signal. Though it should be immedeately remarked that there are cancelling efects that dimish the effect, samples may notacibly influence a perfectly reconstructed signal as far as over half a second away in a CD quality (16 bit, 44.1 kHz) signal.

1.2.5 The z transform

Delay as integrator

1.2.6 Filter types

Perfect filters only exist as operators on infinite sequences or signals and can not be implemented as causal units. Causal means that a unit can only output data that a relation with data that has previously been fed to one of its inputs, in other words it may not be clearvoyant: only observed data has an effect on its state and its output. It is habitual to consider a filter as a unit that has input pins, output pins, and a state, which represents that which the unit has remembered from the past. Formally speaking, it can be seen as an operator the maps its previous state and its inputs to a new state and output signals, which is not different than saying that the memory in the filter (for instance the charge on a capacitor) is in some way affected by the input and the filter's internals, and the output signal has some connection with the input pins and the internal storage elements.

pass band amplitude stability

Butterworth (all pole)

minimal ripple

Thomson polynomials

constant phase

constant amplitude `all pass'

Infinite versus finite impulse response for digital filters

In digital filter theory, filters are distinguished in to major groups by considering the way in which they remember data from the past. When thay merely feed data through their memory elements, and discard data that is older than the `length' of the filter, the filter is called an finite impulse response filter, because this

automatically means that the output of the the unit in response to a single dirac pulse (that is an input sample row with only one non-zero sample)

1.3 A IIR model of an analog low pass circuit

1.3.1 Model of a single RC low-pass filter

1.3.2 Time and amplitude sampling considerations

1.3.3 Cascading 4 sections for a 24dB/Octave filter

1.3.4 Adding resonance control

1.3.5 Discussion of alternatives

1.4 The waveguide

1.4.1 transmission medium approach

A one dimensional transmission line is a row of differentially small filter elements with near oscilating transfer functions, and inputs from its neighbours, modeled as a subset of all nodes, conveniently modeled by their (physical or sample id) distance.

Some simplifications

There are simplifications to the above model that do not directly impact the generality of the model. Others, such as the assumed homogeneousness, the one-dimensionality of the system, and the linearity of the coupling and self-oscilation functions need to be lifted to obtain more realistic models.

For now, assume a linearly indexed one dimensional array to represent the sections of the transmission medium.

Comparison with `coaxial cable'

Phase behaviour, group speed

Amplitude behaviour, transfer function

Coupling: the characteristic impedance

1.4.2 Sampling a transmission line

Amplitude quantization

The above strictly speaking holds for a continous transmission line and continuous input signals. In a discrete version, the amplitude of the signals are quantized, which is usually a bearable (albeit non-linear) transformation, often modelled as adding a stochastic (white) noise source with an amplitude related to the lowest (effective, in a floating point representation) value bit. More accurate (less noisy) results are achieved simply by adding more bits. Two pitfalls are the case of `near' unstable or oscilating units, such as the elements of waveguides, where eventually the noise does not reduce to zero by exponential damping, but simply keeps adding up, and the mismodeling of the noise as stochastic, i.e. as being unrelated to the signal that is sampled. It is in fact very related, and this easily shows up as clearly distinguishable signal distortion components, especially when the signal dependence is repeatedly of the same nature.

Samping in time

It is temping to apply Shanon's theory directly to elements in a waveguide, in other words to not distinguish the longitudinal representation of a wave in sampled sections from the sample in an (audio) sample, where it is sufficient to make sure that the signal that is contained in the sample is bandwidth limited. The number of samples in a transmission line cannot be directly derived from such an argument, since coupled harmonic oscilators (or resonators) have different (usually second order) interrelations than subsequent elements in a list of equal time spaced amplitude samples.