subtractive synthesis and digital filters · cutoff frequency and signals are attenuated in the...

19
1 Mike Raznick Digital Audio Processing 1 Final Report Subtractive Synthesis AND Digital Filters An Introduction to Subtractive Synthesis A filter implies the use of subtractive synthesis where the amplitude values of unwanted spectral components in a signal are removed. A filter accepts an input signal, blocks specific frequency components, and passes the original signal minus those components to the output of the filter. 1 The characteristics of a filter can be described by its frequency response H(f), defined as the measurement of how the output level of an audio system varies at different frequencies. Inputting a sine wave into a filter and measuring the change at the output of the filter can determine frequency response. Frequency response consists of amplitude response (defined as the ratio of the amplitude of the sine wave at the output of the filter as compared to that at the input of the filter) and phase response (the amount of phase change that the sine wave experiences when applied to the filter). It should be noted that phase change varies with the frequency of the sine wave applied to the filter. Although a filter modifies the amplitude and phase of each spectral component of a signal, it does not actually alter the frequency of a signal. Instead, a filter merely attenuates the amplitudes in a given frequency range. Because frequency response clearly defines the behavior of a filter when its input signals are stationary, it can be said that the frequency response of a filter represents the steady-state response of the system. A filter is often distinguished by the shape of its’ amplitude response. Noise (defined as wide- band distributed spectra) and especially pulse generators (defined as a pulse waveform that has significant amplitude only during a brief interval of time) can be effectively used as filter input sources where the output determines the amplitude response of a filter. For signals that do not exhibit a steady state, an impulse response h(n), defined as a description of the filter’s response in the time domain to a very short pulse, can be used for filter characterization. In other words, by

Upload: others

Post on 22-Sep-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

1

Mike RaznickDigital Audio Processing 1Final Report

Subtractive Synthesis AND Digital Filters

An Introduction to Subtractive Synthesis

A filter implies the use of subtractive synthesis where the amplitude values of unwanted spectral

components in a signal are removed. A filter accepts an input signal, blocks specific frequency

components, and passes the original signal minus those components to the output of the filter.

1

The characteristics of a filter can be described by its frequency response H(f), defined as the

measurement of how the output level of an audio system varies at different frequencies. Inputting

a sine wave into a filter and measuring the change at the output of the filter can determine

frequency response. Frequency response consists of amplitude response (defined as the ratio of

the amplitude of the sine wave at the output of the filter as compared to that at the input of the

filter) and phase response (the amount of phase change that the sine wave experiences when

applied to the filter). It should be noted that phase change varies with the frequency of the sine

wave applied to the filter. Although a filter modifies the amplitude and phase of each spectral

component of a signal, it does not actually alter the frequency of a signal. Instead, a filter merely

attenuates the amplitudes in a given frequency range. Because frequency response clearly defines

the behavior of a filter when its input signals are stationary, it can be said that the frequency

response of a filter represents the steady-state response of the system.

A filter is often distinguished by the shape of its’ amplitude response. Noise (defined as wide-

band distributed spectra) and especially pulse generators (defined as a pulse waveform that has

significant amplitude only during a brief interval of time) can be effectively used as filter input

sources where the output determines the amplitude response of a filter. For signals that do not

exhibit a steady state, an impulse response h(n), defined as a description of the filter’s response

in the time domain to a very short pulse, can be used for filter characterization. In other words, by

Page 2: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

2

feeding an impulse waveform into the input of a filter (or any linear time-invariant system), the

filter’s output is defined as the impulse response of the system.

The impulse response can be used to determine the filter’s response to any type of change in the

input signal. The impulse response also provides an indication of how long the filter takes to

settle into a steady state, thereby indicating how stable the filter will be. For example, an impulse

response that continues oscillating in the long term indicates that a filter may be prone to

instability. A filter’s impulse response is equally effective in defining its characteristics when

compared with frequency response. For example, the impulse response of a non-recursive filter

can be used to reveal the frequency response of a filter in the frequency domain by performing a

Discrete Fourier Transform (DFT) of the impulse response of that filter. Because the inputted

impulse signal to the system contains a near infinite band of frequencies that are nearly uniform

in their amplitudes, the attenuation of particular frequencies over this near infinite band that

comprises the output response to the system therefore yields the frequency response of the

system.

A filter's response to different frequency components that constitute the input signal can be

classified as passband, stopband, or transition band (as illustrated on the following page). The

passband is the frequency region where a filter allows frequency components to pass through the

filter with little or no change. In contrast, frequencies within a filter's stopband are highly

attenuated. The transition band represents a smooth transition region between the passband and

stopband where frequencies are attenuated but are not completely removed from the output

signal. The cutoff frequency (fc) is defined as “that frequency at which the power transmitted by

the filter drops to one-half (-3 dB) of the maximum power transmitted in the passband.”2 The

cutoff frequency marks the frequency where passband and transition band meet. Slope (often

called roll-off) can be defined as the rate at which attenuation increases away from the cutoff

frequency within the transition band. Slope can be expressed as attenuation per unit interval (for

example, 30 dB per octave). The stopband frequency, (fs) marks the frequency where transition

band and stopband meet. A filter used for rejecting unwanted signals must have a steep roll-off

(for example in a lowpass filter that is used in an A/D converter).

There are four basic types of filters. A low-pass filter (below) permits frequencies below the

cutoff frequency to pass with little change while significantly reducing the amplitude of spectral

Page 3: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

3

components above the cutoff frequency. Conversely, a high-pass filter has a passband above the

cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency.

low-pass filter response diagram

A band-pass filter rejects both high and low frequencies and has a passband in between them.

band-pass filter response diagram

In a band-reject filter, the amplitude response can be considered to be the inverse to that of a

band-pass filter’s amplitude response. A band-reject filter will have a passband at

Page 4: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

4

both high and low frequencies and will exhibit a stopband in between them.

A band-pass filter can be characterized by its center frequency (CF) and bandwidth (BW) or by

its upper and lower cutoff frequencies (f1 and f2). The center frequency marks the center of the

passband. In a digital filter, the center frequency is defined as the average of the upper and lower

cutoff frequencies. The bandwidth is equal to the difference of the upper and lower cutoff

frequencies. The bandwidth is a measure of the selectivity of the filter and can describe a band-

pass filter as sharp (narrow) or broad (wide), depending on the width. The passband sharpness is

quantified by quality factor (Q): CF

Q = ------ BW

A high quality factor will result in a narrow bandwidth.

The order of a filter is defined as “the mathematical measure of the complexity of the filter.”3 In

a digital filter, the order determines the number of calculations performed on each sample. In an

analog filter, the order determines the number of electrical components used. The slope of

attenuation in the transition band of a filter is determined by the order of the filter. For example,

in an analog high or low-pass filter, the slope/roll-off is equal to 6 dB per octave multiplied by the

order of the filter. Therefore, it can be said that the higher the order of the filter, the steeper the

slope of the transition band that will result.

Using a Bank of Filters for Flexible Response

As a way to gain additional flexibility in filtering a signal, it is common to use the

aforementioned basic filter types as building blocks for achieving a more complex response.

Possible techniques for combining filters are discussed below.

A first technique combines two or more filters via a parallel connection, where filter elements

are connected in parallel. Consequently, all filters in a parallel connection are applied to the signal

simultaneously. Parallel connection filtering in effect sums the frequency responses of the filter

elements.

Page 5: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

5

A second technique combines two or more filters via a cascading connection. Using a cascading

connection, filter elements are connected together vertically, one after another. The output of the

first filter therefore feeds the input of the next filter. “The amplitude response of the complete

filter bank is calculated by multiplying” each of the individual responses together. For example,

“if expressed in decibels, the overall amplitude response at a given frequency is the sum of the

responses of the individual elements in dB at that frequency.”4

It should be noted that the order of a combined filter can be calculated by summing together all of

the orders of all individual filters. Therefore, the complete filter will have an increased slope,

based on all of the combined filter elements.

Balance Functions For Cascade Connection Filtering

When combining filters using a cascade connection with filter elements that have different center

frequencies, the amplitude response of the overall system can be relatively low since multiple

filters can cancel each other out. In order to freely use filters in a cascade connection, a signal

level reference point (which references the original amplitude value of the signal before it is fed

into the first element of the filter bank) should be specified prior to filtering of that signal. The

average power of the output signal can then be modified to equal the average power of the signal

at the reference point.

A balance function, which modifies the amplitude of the signal back to the value at the reference

point, can be performed at the output of the filter bank. However, this may only prove effective

when a significant amount of signal power lies within the passband. To determine the average

power of a signal, a balance function will rectify the signal. This process takes the absolute value

of all the samples (thereby changing all negative sample values to positive ones). While this is a

form of non-linear waveshaping, this process allows all even-harmonic components in the signal

to be emphasized. Furthermore, we can say that, “the higher the amplitude of the signal fed into

the rectifier, the larger the overall amplitude of the even harmonics.” 5 The output signal from the

rectifier is then fed into a low-pass filter that has a very low cutoff frequency. The low-pass filter

allows for attenuation of all components except for the zero-frequency term. The output of the

balance function can then be said to be proportional to the input signal amplitude.

Page 6: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

6

Filtering a Noise Source for Instrument Creation

Filtering a noise source can prove an effective means for instrument creation. Some useful

techniques for this are outlined here. For example, by specifying a bandwidth of approximately

5% of the center frequency in a band-pass filter, a clear pitch can be produced and can be used as

a melodic instrument. However, it should be noted that filtering a periodic source is not the same

as filtering a noise source. This is due to the fact that periodic sources are already pitched, and

that “the center frequency and bandwidth settings have no significant effect on pitch perception;

they only affect timbre.”6

Formants, defined as fixed resonances, may be desired in a filtered tone, and can be produced by

filtering a periodic source and setting the center frequency and bandwidth to a frequency that is

higher than the frequency of the highest pitch. A final technique for creating musical tones from a

periodic source includes harmonic enveloping, and can be implemented by applying an envelope

generator to the bandwidth input of a filter. The effect of this causes the relative strength of the

harmonic partials to be directly proportional to the amplitude of the tone (thereby changing with

time), affecting both waveform and timbre. For example, when used as a musical instrument, the

tone may start as a sine wave, and during the attack while the amplitude increases, the amplitude

of the higher harmonics also increase. As the tone decays, the reverse occurs where the higher

harmonics drop out first.

Linearity and Time-Invariance

Any filter can be classified as linear or nonlinear, and time-invariant or time varying. It can be

said that a time-invariant filter performs the same operation at all times. For example, if the input

signal to a time-invariant system is delayed by a specified number of samples, then the resulting

output signal will also be delayed by the same number of samples and will be otherwise

unchanged. The output waveform from a time-invariant filter shifts in time as the input waveform

is likewise shifted in time. The difference equation for a general digital filter-type in the time

domain illustrates this:

y(n) = x(n) + x(n – 1)

From the above equation, x(n) is defined as the current input to the filter and x(n - 1) is the

previous input value to the filter. Therefore, the above equation represents an output sample

Page 7: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

7

comprised of the current input sample as well as the previous input sample. In real-time

processing, x(n) is constantly changing as new input samples are fed into the filter. What this

amounts to is a current input sample with at least one additional superimposed image of a

previous input sample added to it. In order to change this equation into a filter, we must consider

adding a convolution with a desired impulse response.

In contrast, an example of a linear time-varying filter where the coefficient, cos(2πn/10), which

represents an impulse response and is multiplied by the previous input sample, x(n – 1), changes

over time and can be illustrated as follows:

y(n) = x(n) + cos(2πn/10) * x(n - 1)

A filter is considered to be linear if the amplitude of the filter output is proportional to the

amplitude of the filter input (this is known as the scaling property) and if the filter output is

equivalent to the summation (adding together) of each signal that comprises the filter equation

after being applied to the filter separately (this is known as the superposition property).

In contrast, it is again useful to view an example of a nonlinear digital filter. The following filter

subtracts the square of the previous output sample y2 (n – 1), from the current input sample x(n),

to calculate the current output signal:

y(n) = x(n) - y2(n - 1)

Almost all filters in digital audio applications can be classified as linear time-invariant (LTI)

discrete filters because they uniquely preserve frequencies in a signal. A few important reasons

for this are as follows: if the input signal is periodic, harmonic distortion (where new frequencies

are added to the signal passing through an audio device) will occur. Furthermore, when two or

more in-harmonically related tones are present, intermodulation distortion (which creates the sum

and difference of two or more input frequencies) can also be present.7 In contrast, a truly linear

filter will not introduce any spectral components.

Time-varying filters can also generate audible sideband images of pre-existing frequencies in an

input signal. When considering the importance of linearity and time-invariance in digital

filtering, we can expand our definition of a digital filter to include any linear, time-invariant

system that operates on discrete-time signals.

Page 8: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

8

Digital Filters

A digital filter can be generally defined as a computational algorithm that operates on a discrete

set of sample values (expressed as a sequence of numbers representing an input signal), and

converts each sample into a new set of values (representing an output signal) so that the character

of the signal’s frequency domain spectrum is altered in some prescribed manner.8 It should be

reinforced that, while an analog filter operates on a continuous signal, a digital filter operates on

discrete samples values. Most often, digital filters are designed to obtain an alteration that is

characterized in terms of the signal’s steady-state amplitude response. In digital filtering for audio

applications, the current output sample value y(n), is calculated on every sample as a combination

of the current input sample value x(n), with previous filter input and output sample values. It can

be observed that a digital filter in this regard can be further defined as a type of causal system

since it does not consider future sample values. A causal filter computes the current output using

only present and/or past input and output samples, for example, x(n), x(n – 1), x(n – 2), y(n – 1),

y(n – 2) and so on.

Digital filters can be classified into two principal types. The first filter type is defined by a linear

combination of a finite number of input samples and can be referred to as non-recursive filter.

Because, a non-recursive filter uses only the current input signal value and past input signal

values to be convolved in the time domain with filter coefficients values (which represent the

impulse response of the system) followed by zeros, it is called a finite impulse response (FIR)

filter. The FIR filter takes the general form:

y(n) = (a0 * x(n)) + (a1 * x(n-1)) + (a2 * x(n-2)) …. + (aN * x(n-N))

where y(n) is the current output to the filter, x(n) is equal to the current input to the filter and x(n

- N) is the previous input value of the filter where N is the maximum delay used and is therefore

equivalent to the order of the filter. Finally, aN is the coefficient value, representing the desired

impulse response of the filter. The following filter algorithm creates a low-pass filter since the

filter completely attenuates components at the Nyquist frequency:

y(n) = 1/2 x(n) + 1/2 x(n - 1)

Page 9: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

9

For the second type of filter, the current output signal is calculated on every sample as a

combination of the current (as well as sometimes past) input values and past output values. It

admits only recursive realizations and can therefore be referred to as a recursive filter. The

impulse response of this filter type is infinitely long and is therefore prone to instability. This

filter type is called as a infinite impulse response (IIR) filter. The IIR filter takes the general

form:

y(n) = (a0 * x(n)) – (b1 * y(n-1)) – (b2 * y(n-2)) …. – (bN * y(n-N))

where bk represents the coefficient values determined from the characteristics of the desired filter,

ak is the coefficient used to scale the amplitude response of the filter, and the number of delays, N,

is the order of the filter. For example, the below algorithm creates a one-pole low-pass filter:

y(n) = 1/2 y(n-1) + 1/2 x(n)

Both FIR and IIR filter types will be further discussed following the introduction of important

concepts necessary to further define these filter types.

Filter Coefficients

“Digital filter algorithms work by multiplying signals and delayed images of signals by numbers

called coefficients. Specifying a set of coefficients to a filter algorithm uniquely determines the

characteristics of the digital filter.”9 Coefficients are important for realizing a desired frequency

response. For example, when designing a FIR filter, filter coefficients can be calculated by

performing an Inverse Discrete Fourier Transform (in the form of a Fast Fourier Transform) on

the desired frequency response of the filter. For FIR filters, the impulse response is equivalent to

the filter coefficients.

Once a filter’s coefficients have been calculated, they can be convolved with the filter’s input

samples to determine the output samples of the filter. Convolution is a process that involves the

summation of a series of products where each filter input sample is multiplied by a corresponding

filter coefficient (where the coefficients are flipped in reverse order), followed by the results of

these multiplications being added together to get a final output sequence. While convolution can

take place in either the time domain or the frequency domain (as long as both input sequences are

in the same domain), it is useful to know for design purposes that convolution in the time domain

Page 10: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

10

is equivalent to multiplication in the frequency domain. Furthermore, the reverse is also true

where multiplication in the time domain is equivalent to convolution in the frequency domain.

They are therefore said to be Fourier pairs.10 This concept is very important when designing a

digital filter due to the necessary calculations that are required in domains other than the time

domain to compute the filter output. It is furthermore desirable to calculate a filter’s output

(during design analysis) in the frequency domain since multiplication requires a significantly less

number of calculations than convolution in the time domain. Since IIR filter design requires

calculations and analysis in the z-domain (which will be discussed below), it can also be said that

“convolution in the time domain is equivalent to multiplication in the z-domain.” 11

In order to closely approximate a filters’ impulse response, a large number of coefficients are

often needed. This is especially true in FIR filter design, since they require many more

coefficients than a similar IIR filter to get a comparable impulse response. However, using a high

number of coefficients requires significant memory resources due to the real-time calculations

that must take place during a filtering process. Additionally, calculating coefficients during real-

time synthesis can also take up additional CPU resources.

If it is known in advance that the frequency response is not going to change during synthesis, it is

possible to conserve resources by calculating coefficients only once, prior to the beginning of

synthesis. Additionally, programs such as Csound effectively determine coefficients of an

adjustable filter by calculating new coefficients “on every 40th sample” (must be at least “200

times per second).”12 Interpolation between coefficients can also be used.

Transfer Functions

A linear time-invariant (LTI) system can be characterized by a frequency domain description

known as a transfer function. The transfer function provides an algebraic representation of a

linear, time-invariant filter in the frequency domain. Note that only LTI filters can be subjected to

frequency domain analysis.

In our discussion of filter coefficients, it was stated for designing an FIR digital filter that

coefficients can be calculated by performing an Inverse Discrete Fourier Transform on the desired

frequency response. It was further said that the impulse response is equivalent to the filter

coefficients. In contrast, for designing an IIR filter, which derives the current output sample using

Page 11: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

11

previous output samples (therefore requiring feedback and stability design consideration), it is not

possible to compute the filter coefficients from the impulse response.

To successfully design an IIR filter, a transfer function can be used to determine many of the

characteristics of the filter including its frequency response and stability. The H(z) transfer

function, or z-domain transfer function, of a digital filter is obtained from the symmetrical form

of the filter expression, and allows us to describe a filter by means of a convenient, compact

expression. The transfer function of a linear time-invariant discrete filter is defined as the z-

transform of the impulse response h(n) and can be written as:

Y(z)

H(z) = -----

X(z)

where Y(z) is the z-transform of the filter output signal y(n), and X(z) is the z-transform of the

filter input signal x(n). Furthermore, the H(z) transfer function, is a fixed function that is

determined by the filter. In the z-domain, given an impulse input, the transfer function will equal

the output.

The unit delay operator, denoted by the symbol z-1, gives the previous value when applied to a

sequence of digital values. The unit delay operator therefore introduces a delay of one sampling

interval. Applying the operator z-1 to an input value x(n) gives the previous input x(n-1):

z-1 * x(n) = x(n - 1)

“In an IIR filter implementation routine, the z-1 operator indicates consecutive memory locations

where input and output sequences for the filter are stored.”13 The unit delay operator allows for an

IIR filter’s output to be expressed in the z-domain in the same way that it would be expressed

using a standard difference equation in the time domain (where current and past input values are

summed). As an example, we can calculate the transfer function of the difference equation below

that represents a three-term average filter:

y(n) = 1/3 * (x(n) + x(n - 1) + x(n - 2))

Page 12: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

12

In the following step, we can rewrite the above equation using the z-1 operator notation as:

y(n) = 1/3 * (x(n) + z-1 * x(n) + z-2 * x(n))

= 1/3 (1 + (z-1) + (z-2)) * x(n)

The transfer function for the three-term average filter is therefore:

y(n) / x(n ) = 1/3 (1 + (z-1) + (z-2))

Z-Transform and the Unit Circle

A transform is a mathematical tool that is used to shift between the time and frequency domains

(as well as other domains). Digital signal processing (as well as analog signal processing) can

exist in either of two domains as follows: for analog signals, processing can exist in either the

time domain or the frequency domain. For digitally sampled signals, however, processing can

exist in the discrete time domain and the discrete frequency domain.

Continuous transforms are used on signals that are continuous in time and frequency. In general,

“series transforms are applied to continuous time, discrete frequency signals and discrete

transforms are applied to discrete time and frequency signals.”14

For computing a filters output, convolution is not easily achieved due to the large number of

calculations required (translating to heavy CPU resource usage). It is easier and therefore

preferable to use multiplication and as discussed earlier, while convolution is required when

calculating a filter equation in one-domain, multiplication is required for filter calculation in the

other domain. For this reason, transforms can be a useful tool in digital filtering. Therefore,

during filter design analysis, transforming into the domain where multiplication can take place

and then transforming back is generally a preferred alternative for calculating a digital filter’s

output in the domain where convolution occurs.

The Laplace transform is a method for solving linear (not discrete) differential equations and is

used to yield a desired time domain output function’s equation. For example, if a filter’s transfer

function is known, it is possible to take the Laplace transform of the input of the filter (which is a

function of time) to determine that input value in the frequency domain. It is then possible to

Page 13: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

13

multiply by the frequency response to get the filter’s output in the frequency domain. Finally,

performing the inverse Laplace transform yields the time domain expression for the output.

“The Laplace transform demonstrates that it is possible to express a transfer function

mathematically so that a system can be analyzed to get the frequency response and to graph the

function for analysis of stability (by evaluating the transfer function at points on the imaginary

axis of the s-plane).”15 It is important to understand the Laplace transform because, while the

Laplace transform operates on continuous differential equations, the z-transform works in the

same way but operates on discrete difference equations. Therefore, analyzing an IIR filter

requires the use of the z-transform (rather than the Laplace transform) for evaluation of frequency

response, stability, and calculation of the current output sequence.

The equation for a digital filter's frequency response (in the frequency domain) can be simplified

by using the variable z, which is a complex number and is expressed as:

z = exp(2πj(fΔ))

The z-transform can be defined as a summation where the input signal sample values x(n) of the

filter are multiplied by powers of z:

X(n) = Σx(n) * (1/z)n

Since the z-transform of x(n – 1) is merely the z-transform of x(n) multiplied by (1/z), we can

generate an earlier signal value based on the present one:

X(n – 1) = 1/z Σ(n) * (1/z)n = (1/z) X(n)

Therefore, by multiplying the z-transform of the current value by (1/z), we can compute the z-

transform of the last signal value.16

The figure below illustrates an Argand diagram of the point z, where the dashed circle, known

as the unit circle, represents the complex modulus (of a complex number) |z| of z and the angle θ

represents its complex argument. The x-axis is called the real axis and y-axis is referred to as the

Page 14: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

14

imaginary axis. When super-imposed on the Argand diagram, z has can only have a magnitude

(radius) of 1. z, which can be used to compute the frequency response in an IIR filter, traces a

circle of radius 1 on the Argand diagram. This forms the unit circle (where z = x + jy). Note that

x and y are real numbers and j is the imaginary unit equal to the square root of -1. Engineers often

substitute between j and i (although they both have the same meaning). The complex modulus |z|

is defined by: |x + jy| and is equal to the square root of x2 + y2:

17

T�h�e� unit circle is the smallest region in� �t�h�e� �z�-�p�l�an�e� �t�h�a �t� falls within the region o�f� �c �o�n�v�e�r�g�e�n�c�e� �f �o�r�

all finite �s �t�a�b�l�e� �s �e�q�u�e�n�c�e�s �.� “T�h�e� Fourier � �t�r�a �n�s �f�o�r �m� �o�f � �a� �discrete �signal corresponds � �t�o� �t�h�e� �z �-

�t�r �a�n�s �f�o�r �m� �o�n� �t�h�e� �unit circle in� �t�h�e� �z�-�plane�.”18 Therefore, by representing the Fourier transform as

the z-transform on the unit circle, the periodicity of Fourier transform can be easily observed,

ultimately allowing us to yield the freq�u�e�n�c �y� �r�e�s �p�o�n�s �e from the transfer function.19 (In this regard,

a discrete sample, when represented in the frequency domain can be viewed as periodic after

being subjected to a Fourier transform.)

“The region of convergence defines the region where the z-transform exists and can be defined as

the range of z (in� �t�h�e� �c�o�m�p�l�e�x� �plane) for which the z-transform converges.”20 T�h�e� �s �e�t� �o�f� �z� can

either lie inside� �t�h�e region� �o�f � �c�o�n�v�e�r�g�e�n�c�e or outside �t�h�e� region� �o�f � �c�o�n�v�e�r �g�e�n�c�e. However, there

cannot be any poles within the region of convergence. Therefore, for a single pole, the region of

Page 15: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

15

convergence will lie to the right of that pole when the signal is causal. A set of z can only lie �in�

�t�h�e region� �o�f� �c�o�n�v�e�r �g�e�n�c�e if � �t�h�e� �magnitude� �o�f � X( �z) �is finite�. Otherwise, it will� �diverge �a�n�d� is said

to be outside �t�h�e� region� �o�f � �c�o�n�v�e�r�g�e�n�c�e�.� “�T�h�e� �function� ���X( �z) is �defined� �o�v�e�r� �t�h�e� entire� �z�- �p�l�a�n�e� �b�u�t�

�is only valid in� �t�h�e� �region �o�f� �c�o�n�v�e�r�g�e�n�c�e�.”� 21 For any pole at a specific location within the unit

circle, the region of convergence will include all points with a radius greater than the location of

that pole. “For the frequency spectrum to exist, the region of convergence must include the unit

circle and the pole must be inside the unit circle.”22

��B�e�c�a�u�s �e� �t�h�e�r�e� �is a finite �n�u�m�b�e�r� �o�f� �s �a�m�p�l�e�s that can be calculated in a filter’s difference equation�,�

�a usable digital filter� �m�u�s �t� �b�e� �designed� �within the region o�f � �c�o�n�v�e�r �g�e�n�c�e�.� �The position of z, inside

or outside the unit circle, determines the stability of transient terms: for example, if z is inside the

unit circle, the transient terms will die away. However, if z lies directly on the unit circle,

oscillations will be in a steady state. Finally, if z is outside the unit circle, the transient terms will

increase. This forms the basis for the criteria that all p�o�l�e�s � �m�u�s �t� �b�e� �p�l�a�c�e �d� �inside the unit circle� �o�n�

�t�h�e� �z�-�p�l�a�n�e� �to ensure that a filter will be �s �t�a�b�le�.� As will be discussed, only IIR filters exhibit poles

and must therefore be designed so that their poles are properly placed.

Poles and Zeros

From an engineering perspective, filters can be described in terms of poles and zeros.

Every digital filter can be specified by its poles and zeros (with the addition of a gain factor).

Poles and zeros allow useful insights into a filter's response and can be used as the basis for

digital filter design. By performing a mathematical analysis of the response of a filter, we can see

that a pole creates a peak in the amplitude response of the filter and a zero places a valley in

amplitude response. It is important to note that, while a zero may cause the filter to exhibit a

minimum amplitude response, it will not necessarily represent an actual “0”. The bandwidth of

the filter determines the depth of the poles and zeros. Specifically, a narrower bandwidth will

result in a higher peak or a deeper valley. In a digital filter, individual poles and zeros can exist at

0 Hz and Nyquist, but at frequencies in between, they must come in pairs.

Evaluation of poles and zeros in the z-plane on the unit circle allow for digital filters to be

properly designed �for stability�.� The notation used when plotting poles is a cross, and for zeros it is

a circle. This allows for a graphical method to exist for viewing poles and zeros in a filter. By

Page 16: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

16

placing poles and zeros on the z-plane, filters can be designed to achieve a required frequency

response while ensuring stability.

To look at poles and zeros from a different perspective, it is again useful to view the equation for

calculating the z-domain transfer function for a general IIR LTI filter type:

a0 * (1/z)k

H(z) = -------------------------------- 1 - a1 * (1/z)j

If the numerator in the above becomes zero, the H(z) transfer function will also become zero.

This is called the zero of the function. However, if the denominator becomes zero, we have a

division by zero and the function can become infinitely large. This is called a pole of the function.

A filter is said to be stable if its impulse response h(n) decays to zero as x(n) (the input sample)

goes to infinity. Unstable filters are generally not considered to be useful since their output grows

exponentially, eventually overflowing the computer word. We can therefore say that there is an

exponentially increasing component in the impulse response of that filter.

In terms of stability, an IIR filter (the only filter type that exhibits poles) is considered to be stable

if and only if all the poles lie inside the unit circle in the z-plane. During IIR filter design, the

ability to view a filter’s poles in terms of the unit circle therefore will assist in ensuring the

relative stability of the filter.

Finite Impulse Response Filters

As discussed earlier, digital filters can be classified into two principal types: “those whose

transfer function doesn't have a denominator (referred to as an all-zero filter), and those whose

transfer function has a denominator”23 (referred to as an all-pole filter). Because the output of the

first type is a linear combination of a finite number of input samples, it can be referred to as non-recursive filter. For this type of filter, the impulse response is defined by a finite sequence of

filter coefficient values followed by zeros and is called a finite impulse response (FIR) filter.

Because an FIR filter can realize only zeros, it is always considered to be stable. Another

advantage to the FIR filter type is that it exhibits linear phase response, and it is relatively easy to

design. Disadvantages of the FIR filter type are that it requires large amounts of memory and

Page 17: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

17

processing power due to the large numbers (and required calculations) of coefficients needed for

sharp cutoffs.

For FIR filter design, the desired frequency response is of foremost interest. Based on this, filter

coefficients can be calculated that will give us the impulse response. As previously discussed,

convolution in the time domain is equivalent to multiplication in the frequency domain and vice

versa. Therefore, by applying a Discrete Fourier Transform (DFT) on the convolution of a filter’s

time domain sequences (impulse response and an input sample sequence), we are doing the same

as multiplying the spectrum of the input sequence with the DFT of the impulse response. For

example, in the commonly utilized window method (also called the Fourier series method) for

designing a digital FIR filter, a desired frequency response is chosen and must be represented

discretely. As previously noted, discrete frequency domain response representations are always

periodic (where the period is equivalent to the sample rate). Determining time domain filter

coefficients can be done in one of two ways. Both of these methods include the use of the inverse

DFT on either an algebraic expression for the discrete frequency response (where the expression

is evaluated as a function of time after going through the inverse DFT) or on a periodic sequence

of frequency domain samples.

Infinite Impulse Response Filters

For the second type of filter, the output signal is computed using previous samples of itself. It

admits only recursive realizations and can therefore be called a recursive filter. The impulse

response of this filter type is infinitely long and admits only poles. It is therefore known as an

infinite impulse response (IIR) filter (or all-pole filter).

As compared to the first-order FIR filter, the one-pole filter gives a steeper magnitude response

curve. Advantages of the IIR filter type are that it “can achieve a given filtering characteristic

using less memory and calculations than a similar FIR filter. Disadvantages of the IIR filter are

that it is susceptible to problems of finite-length arithmetic, such as noise generated by

calculations, and limit cycles.”24 This is a direct consequence of feedback. Furthermore, when the

output isn't computed perfectly and is fed back, these imperfections can be compounded. Finally,

IIR filters cannot have a perfectly linear phase.

Since the IIR filter uses a "recursive algorithm" that employs feedback of the output samples to

Page 18: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

18

give the filter its infinite impulse response signature, and because feedback is inherent in an IIR

filter, it must be specifically designed to be stable. As we have seen, IIR filter design requires use

of the z-domain transfer function and the z-transform. The z-transforms’ pole and zero locations

on the unit circle in the z-plane are used to determine the stability of the filter. Additionally, as

previously stated, “by further evaluating an IIR filter’s H(z) transfer function, it is also possible to

determine the frequency response of the filter.”25

As expected, for perfect stopband behavior in an IIR filter, the filter’s impulse response would

need to exhibit an infinite duration (with an infinite number of delays and coefficients). However,

this is not possible considering available CPU resources, and truncation of the number of filter

coefficients used is necessary as a compromise between the accuracy of the approximation and

the amount of CPU used. Although this causes inaccuracies in the frequency response of the

filter where there can be noticeable lower-than-expected attenuation in the stopband in the

amplitude response, a window function (such as a Hamming window) can be applied to the

remaining set of coefficients. The purpose of the window function is to modify the impulse

response so it will cause the filter's frequency response to have a steeper roll-off and to reduce

imperfections (although this can cause passband ripple). The filter can then be tested via reverse

design to see how closely it resembles the desired frequency response. This final process can be

repeated until the error between the required frequency response and that generated by the newly

designed filter is acceptable. In this sense, “the Infinite Impulse Response refers to the ability of

the filter to have an infinite impulse response and does not imply that it necessarily will have one;

it serves as a warning that this type of filter is prone to feedback and instability.”26

As a practical application, the two-pole IIR filter can be a useful component in a sound-

processing environment. Since it is capable of selecting the frequency components in a narrow

range, this IIR filter variation can be used an elementary resonator. However, “IIR filters are very

sensitive to quantization errors. The higher the order of the filter, the more it suffers from

quantization effects as errors accumulate”27 due to added complexity.

Page 19: Subtractive Synthesis AND Digital Filters · cutoff frequency and signals are attenuated in the stopband, below the cutoff frequency. low-pass filter response diagram A band-pass

19

References:

1. Robin, Dr.Iain A., Digital Signal Processinghttp://www.dsptutor.freeuk.com/index.htm

2. Wagner, Brian and Michael Barr, Introduction to Digital Filters, Embedded SystemsProgramming, December 2002, pp. 47-48.http://www.netrino.com/Publications/Glossary/Filters.html

3, 4, 5, 6, 9, 12. Dodge, Charles and Jerse, Thomas, Computer Music: Synthesis, Composition andPerformance, Schirmer (1997)

7. Smith III, Julius O., Introduction to Digital Filters, Center for Computer Research in Musicand Acoustics (CCRMA) (2003)http://ccrma-www.stanford.edu/~jos/filters/

8, 10, 13, 25. Lyons, Richard, Understanding Digital Signal Processing, Prentice Hall PTR(2001)

11, 15,18. Pohlmann, Ken C., Principles of Digital Audio, McGraw-Hill (2000)

14, 21. Townsend, A.A.R, Introduction to Digital Filters, (2003)http://www.comappls.com/tonyt/Applets/DigitalFilter/FIR.html

16, 26, 27. Bores Signal Processing, Introduction to DSPhttp://www.bores.com/courses/intro/iir/index.htm

17. Weisstein, Eric Eric Weistein’s World of Mathematics, Wolframhttp://mathworld.wolfram.com/

19, 20. Fite, Benjamin, The Connexions Projecthttp://cnx.rice.edu/content/m10549/latest/

22. Nyack, Cuthbert A., Z-Transform and Convergencehttp://dspcan.homestead.com/files/Ztran/zconce1.htm

23. Rocchesso, Davide, Introduction to Sound Processing, Free Software Foundation (2003)http://www.faqs.org/docs/sp/sp-27.html

24. dspGuru, Infinite Impulse Response Filter FAQ, Iowegian International Corporation (1999)http://www.dspguru.com/info/faqs/iirfaq2.htm

Meldrum, Jason, The Z-Transform, University of Strathclyde http://www.spd.eee.strath.ac.uk/~interact/ztransform/