digital filters for music synthesis · several digital iir filters based on analog prototype...

25
Digital Filters For Music Synthesis Kasper Nielsen [email protected] KarmaFX, January 2000 * ABSTRACT The goal of this paper is to explore the use of digital filters for music synthesis, in particular subtractive synthesis. An introduction to filters and their use in synthesizers is presented. The related signal processing theory for low order digital IIR filters is described, and simple filters are designed directly in the digital domain. A set of guidelines related to the control and implementation of a filter is discussed, and possible design method for extending and transforming filters are explored. Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The covered analog filters are the Sallen & Key filter, the Butterworth filter and the State Variable Filter. Issues related to the implementation of digital filtering is described, and the filters’ behavior when implemented, is tested and compared. The State Variable Filter is found to have properties, with regard to both functionality and speed, that in relation to computer music synthesis makes this filter very advantageous. 1. INTRODUCTION In the last 30 years it has become widespread to use electronic-instruments or so called synthesizers to make music. Some of the first synthesizers were built using components from analog electronics, but today the majority of synthesizers use digital components. However most of the original design ideas used in the early synthesizers are still used today. A synthesizer is internally built up of components, each performing different tasks related to the creation and shaping of sounds. At least this is the case for subtractive synthesis which we will concentrate on in this paper. A simple subtractive synthesizer can roughly be said to be built up of three components: An oscillator, a filter and an amplifier [2]. The oscillators job is to create a signal, for instance a square wave, at a specified frequency. This is sent into the filter which removes or subtracts (hence the name: subtractive synthesis) certain frequency components from the signal. This signal is then sent into the amplifier which scales the signal according to a specified amplification factor. See Figure 1. Oscillator Filter Amplifier Figure 1 Furthermore the parameters for the different components can be independently changed or modulated by other components. For instance, if the used filter is a lowpass filter, the cutoff frequency can be swept from one frequency to another during a certain time-span. This type of filter is called a Voltage Controlled Filter (VCF), since it can be controlled and modulated by a voltage in an analog system. Similarly the amplifiers amplification factor can be changed over time to shape the volume of the resulting sound. The resulting signal can finally be sent to a hooked up sound system. Although this scheme is a simplified version of the actual setup in a modern synthesizer, it can be used to create a wide variety of lifelike sounds as well as unnatural sound effects. 2. OVERVIEW Today standard desktop computers have become so fast that it is possible to simulate most of the work a synthesizer does. As computers become more powerful in the future it will be advantageous to be able to implement synthesizer components in software for simulating a synthesizers behavior and thus use the computer to create sounds in real-time. To do this we need to implement each of the described synthesizer components in software. Fortunately most of these components can be easily implemented in software. The oscillator is a simple KarmaFX Digital Filters For Music Synthesis 1 * Written at Department of Digital Signal Processing, IMM, Technical University of Denmark, January 2000.

Upload: others

Post on 12-Nov-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

Digital Filters For Music Synthesis

Kasper [email protected]

KarmaFX, January 2000*

ABSTRACT

The goal of this paper is to explore the use of digitalfilters for music synthesis, in particular subtractivesynthesis. An introduction to filters and their use insynthesizers is presented. The related signalprocessing theory for low order digital IIR filters isdescribed, and simple filters are designed directly inthe digital domain. A set of guidelines related to thecontrol and implementation of a filter is discussed,and possible design method for extending andtransforming filters are explored. Several digital IIRfilters based on analog prototype filters areexplained, and the filters advantages anddisadvantages are discussed. The covered analogfilters are the Sallen & Key filter, the Butterworthfilter and the State Variable Filter. Issues related tothe implementation of digital filtering is described,and the filters’ behavior when implemented, is testedand compared. The State Variable Filter is found tohave properties, with regard to both functionality andspeed, that in relation to computer music synthesismakes this filter very advantageous.

1. INTRODUCTION

In the last 30 years it has become widespread to useelectronic-instruments or so called synthesizers tomake music. Some of the first synthesizers werebuilt using components from analog electronics, buttoday the majority of synthesizers use digitalcomponents. However most of the original designideas used in the early synthesizers are still usedtoday.A synthesizer is internally built up of components,each performing different tasks related to thecreation and shaping of sounds. At least this is thecase for subtractive synthesis which we willconcentrate on in this paper.A simple subtractive synthesizer can roughly be saidto be built up of three components: An oscillator, afilter and an amplifier [2]. The oscillators job is to

create a signal, for instance a square wave, at aspecified frequency. This is sent into the filter whichremoves or subtracts (hence the name: subtractivesynthesis) certain frequency components from thesignal. This signal is then sent into the amplifierwhich scales the signal according to a specifiedamplification factor. See Figure 1.

Oscillator Filter Amplifier

Figure 1

Furthermore the parameters for the differentcomponents can be independently changed ormodulated by other components. For instance, if theused filter is a lowpass filter, the cutoff frequencycan be swept from one frequency to another during acertain time-span. This type of filter is called aVoltage Controlled Filter (VCF), since it can becontrolled and modulated by a voltage in an analogsystem. Similarly the amplifiers amplification factorcan be changed over time to shape the volume of theresulting sound. The resulting signal can finally besent to a hooked up sound system. Although this scheme is a simplified version of theactual setup in a modern synthesizer, it can be usedto create a wide variety of lifelike sounds as well asunnatural sound effects.

2. OVERVIEW

Today standard desktop computers have become sofast that it is possible to simulate most of the work asynthesizer does. As computers become morepowerful in the future it will be advantageous to beable to implement synthesizer components insoftware for simulating a synthesizers behavior andthus use the computer to create sounds in real-time.To do this we need to implement each of thedescribed synthesizer components in software.Fortunately most of these components can be easilyimplemented in software. The oscillator is a simple

KarmaFX Digital Filters For Music Synthesis 1

* Written at Department of Digital Signal Processing, IMM, Technical University of Denmark, January 2000.

Page 2: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

wave generator, preferably band limited. Theamplifier is a matter of multiplying the signal by ascale-factor. The most complicated component is thefilter. Filter analysis and construction is a well studied areain digital signal processing. Thus we are interested inusing the filter knowledge from digital signalprocessing to construct digital filters that have thesame properties as filters in standard synthesizers.In this paper we will examine different methods forconstructing and implementing such filters. To get abetter idea of what filters must be able to do, we cantake a look at the specifications for some of the mostcommon filters used in well-known synthesizers.The filters used are standard lowpass and highpassfilters and sometimes also bandpass and notch filters[2].The filters are usually specified to be 2 og 4 polefilters, that is, they have a 12dB/24dB rolloff peroctave respectively [3,10]. The most common filterparameters is cutoff(freq), resonance(reso),modulation (mod) and keyboard tracking/follow(kybd). The Cutoff parameter is used to set thecutoff frequency of the specific filter (usually at-3dB attenuation). For a lowpass filter the resultingfrequency response can be shown graphically asshown in Figure 2. Figures like this are usuallyshown in synthesizer manuals [10].

Figure 2

The resonance parameter or quality factor (Q-factor)is used to enhance certain frequency components, i.e.introduce resonance much like a digital resonator atthe cutoff frequency. Changing the resonanceparameter affects the frequency response as shown inFigure 3. A high resonance setting introduces afrequency peak at the cutoff point.

Figure 3

The Modulation parameter is used to control theamount of modulation performed on the cutoffparameter, that is, scale the amount of the cutofffilter- sweep. The sweeping of the filter is usuallycontrolled by an envelope or low frequencyoscillator [8,2]. This effect is shown in Figure 4.When the modulation parameter is set to zero nomodulation is performed.

Figure 4

The Kybd parameter is used to set the amount ofkeyboard tracking, which is a simple adjustment ofthe cutoff frequency to make it scale according to thefrequency of the oscillator [2,10]. Thus the filterscutoff frequency can be controlled by the pitch of akey played on the synthesizer. This is showngraphically in Figure 5.

KarmaFX Digital Filters For Music Synthesis 2

Amplitude

Frequency

Resonance

Filter Frequency

Amplitude

Frequency

Cutoff Frequency

Amplitude

Frequency

Filter Envelope Amount Setting

Filter FrequencySetting

Page 3: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

Figure 5

As we can see the mod and kybd parameters aresimply used to adjust the cutoff parameter andtherefore not related to the implementation of theactual filter. Thus the filter needs to have twoparameters: Cutoff and Resonance. And we willinitially limit our filter designs to lowpass filters,since highpass, bandpass and notch filters can bederived from this.

To specify exactly what a designed filter should beable to do, we will try to list a series of designspecifications.

Design specifications:

1. The filter must be lowpass filter. For simplicitywe will start by concentrating on discussingconstruction of a lowpass filter. Later on weshould be able to convert our design to a highpassfilter.

2. The filter must behave and sound much like asynthesizer filter. This is actually an importantpoint, since our goal is to simulate a synthesizerfilters look and feel in sound. We should notehowever that filters are implemented verydifferently on different synthesizers. It is commonthat two apparently similar filters do not soundthe same on different synthesizers.

3. The filter must have a cutoff parameter. Therange of the cutoff frequency is usually betweenthe lowest and the highest allowed frequency. Ifwe are using a samplerate of say 44.100 kHz, thena sensible maximum for the cutoff frequency isaround 22.050 kHz (Nyquist). Thus when thecutoff is at it highest for a lowpass filter the filter

should have basically no effect on the signal, i.e.no frequencies are cut off. Furthermore it shouldbe possible to sweep the cutoff frequency.

4. The filter must have a resonance parameter. Therange of the resonance parameter differs fromsynthesizer to synthesizer. Some synthesizers letthe resonance be tweaked so high that the filterintroduces self-oscillation, and can at this stateactually be used as a sinewave generator. Whenresonance is set to zero, no resonance is appliedto the signal. The change of cutoff or resonancein a filter is generally known as tuning the filter.

5. The filter’s roll-off should either be 12dB or24dB or something in between. This is not astrict design criteria though, since this mightunnecessarily limit our filter design. It would bean advantage if the filter could be designed so iteasily scales to different roll-offs, for instance bycascading two, three or four similar filters. Thiswould also make it possible to connect similarfilters in both parallel and series, which would bean advantage when creating actual filter-banks.

6. The filter must be fast to apply to a signal. Thisis a very relative design specification, butbasically this tells us that we should try to limitthe amount of CPU processing used whenapplying the filter, i.e., limit the amount ofmultiplications/additions. Furthermore since thefilter is sweepable, some internal calculations ofthe filter-coefficients may be necessary , which ina worst-case scenario will need to be evaluatedfor each sample. These calculations should alsobe fast. The goal is be able to comfortably applyone or more filters in real-time on a standardPentium PC while other sound processing tasksrun concurrently.

7. The implemented filter should avoid quantizationeffects to minimize quantization noise andquantization of filter coefficients, i.e. have a highdynamic range for amplitude for improved SNR.This is however a design criteria for theimplementation of the filter which may vary, andwill be discussed further in the implementationsection. In this paper we will assume an overallhigh dynamic range.

KarmaFX Digital Filters For Music Synthesis 3

Amplitude

Frequency

Page 4: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

8. The filter will have some kind of phase response.We will not limit our design to a specific phaseresponse here. Since we are not aware of thephase response in real synthesizer filters, we willdiscuss phase related issues later on.

9. The filter should have some kind of automaticgain control that will ensure that the filteredsound will sound just as loud as the unfilteredsound. This is directly related to normalization ofthe frequency response.

3. DESIGN

In Digital Signal Processing there exists manydifferent methods for filtering a signal. We areinterested in exploring methods for designing filtersto obtain a desired frequency response. In general we want to design a system that convolvesa time-domain input signal x(n) with an impulseresponse h(n) that describes the filter, to obtain atime-domain output signal y(n). See Figure 6.

h(n) x(n) y(n)

Figure 6

Mathematically we write this as

k

knhkxnhnxny )()()()()(

In the digital z-domain we can write this equation as

)(

)()()()()(

zX

zYzHzHzXzY

where H(z) is the filters system function.

At first we will look at a filter as if all coefficientsare constant, that is, the filters response isn’tchanged over time. This simplifies things, since wecan view the filter as time invariant and focus ourdiscussion on causal linear-time-invariant (LTI)systems.

Various methods exist for achieving this type offiltering in practice: by designing FIR and IIR filtersdirectly in the digital domain; by working in the

frequency domain using FFT and different methodsfor handling overlaps or by using well-known analogprototype filters: Butterworth, Chebychev, etc.

3.1 DIRECT DIGITAL DESIGN

To begin with we will concentrate on using a simpletechnique for designing a filter directly in the digitaldomain in an ad-hoc manner. The goal is to quicklyand easily design a simple working filter that meetsour design specifications. This will also work as afoundation for understanding any further filterdesigns.

We would like to directly implement a 2 pole or 4pole filter in the digital domain. Due to the presenceof poles, a corresponding pole-zero system is an IIRsystem [1].The runtime of IIR filters is in general superior toFIR (all zero filter), since IIR has a substantial loweramount of coefficients and thus lower runtime than aFIR filter equivalent for obtaining the samefrequency response [12]. We will start by stating some of the basic propertiesof IIR filters, and design some simple, but usefulfilters.

A LTI system described by a constant coefficientdifference equation has a rational system function:

N

kk

M

kk

N

k

kk

M

k

kk

zp

zzb

za

zbzH

1

1

1

1

0

1

0

)1(

)1(

1)(

where ak and bk are the filter coefficients, and pk andzk are the complex pole and zero coefficientsrespectively. b0 is the overall gain constant whichcan be selected to normalize the frequency responseat a specific frequency. As shown, the poles andzeros are the roots of the filter coefficientspolynomial expressions [1].

For a first order system this equation becomes

11

11

011

110

1 1

1

1)(

zp

zzb

za

zbbzH

KarmaFX Digital Filters For Music Synthesis 4

Page 5: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

For a second order system (M=N=2) this transferfunction becomes

)1)(1(

)1)(1(

1)(

12

11

12

11

022

11

22

110

2

zpzp

zzzzb

zaza

zbzbbzH

This function can be implemented as:

)2()1()2()1()()( 21210 nyanyanxbnxbnxbny

which in general is known as the canonical secondorder structure or biquad [5]. These second orderstructures (2 pole, 2 zero) can be used as buildingblocks for realizing higher order systems [1]. Thedirect form II structure for this system is shown inFigure 7.

+ +

z-1

z-1

+ + -a1

-a2

b1

b2

x(n) y(n) b0

Figure 7

3.1.1. One Pole Filter

We will start by creating a simple one-poleadjustable lowpass filter. This type of filter can berealized by sweeping a pole from the center of theunit circle in the z-plane and along the x-axis to theunit circles peripheral. Since the pole is real we canrepresent it by the scalar a. Furthermore we selectb0=1-a so the filter has unity gain at DC. Thesystem function becomes [1]:

11 1

1)(

az

azH

The filter frequency and phase response, along withthe corresponding z-plane diagram for differentvalues of a is shown in appendix A. We see that we,by adjusting the poles position, have trivial controlof the filters cutoff frequency. The frequencyresponse is shown as both magnitude response in alinear frequency scale and as a gain response in a logscale. We see that the filter has a roll-off of6dB/octave.The system is realized by the difference equation:

)1()()1()( naynxany

Note that when a=0, the filter has no effect.Thus the systems first order coefficients are b0 = 1-a,b1=0 and a1=a.There is a fixed relationship between a and the -3dBcutoff frequency fc of the filter [13]:

sc Ffea /2

where Fs is the sample rate.The structure of the filter can be sketched as shownin Figure 8.

+

z-1 a

x(n) y(n) 1-a

Figure 8

Usually this filter is used as

))1()(()1()1()1()()( nynxcnynycncxny

where c = 1-a, so that c=1 corresponds to f=Fs/2 andc=0 to f=0.

In this design we only use one pole for changing thefrequency response. What we are actually doing isusing the pole to enhance low frequencies (at =0)as a approaches 1. However, the normalization atDC turns this into a variable attenuation at higherfrequencies. It is not possible to enhance frequenciesat other positions than DC or Nyquist using only onepole [12]. To do this we will need to place a polethat does not lie on the x-axis, but since we want thefilter to produce real output and not complex output,we need to place a conjugate pole at thecorresponding negative frequency. Thus we have atwo pole system.

3.1.2. Digital Resonator

We will now look at how we can design a two polefilter which introduces resonance at a specificfrequency: a digital resonator. A resonator can beconstructed using a pair of complex conjugate polesplaced near the unit circle. The angular position 0

of the poles determine the resonant frequency [1],

KarmaFX Digital Filters For Music Synthesis 5

Page 6: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

and the radius r determines the amount of resonance.As the poles get closer to the unit circle the filter willstart to oscillate. As the poles move towards thecenter of the unit circle the resonance dies away. Ifthe poles are moved outside the unit circle the filterwill become unstable [1,12].

A resonator has a good resemblance to a bandpassfilter, where r controls the bandwidth and 0 controlsthe center frequency of the filter. The bandwidth isdefined as the width of the magnitude response curveat the points where the curve has decreased to halfthe power it has as its peak. Since power isproportional to the square of the amplitude, the half-power points correspond to amplitude(=1) values of

707.02/1 , which again correspond to the pointsat –3 dB attenuation. So r determines the bandwidthof the resonance. It can be shown that

2/1 br

where r is the pole radius, and b is the bandwidthmeasured in radians [1,12].

We should also be aware that the angular position ofthe poles 0 is not equal to the position of the peakof the magnitude response r. The followingrelationship exists [1]:

0

2

cos2

1cos

r

rr

This relationship is shown graphically in appendixB. We see that for high resonance settings (when r isclose to 1) r is close to 0.

We now know how we can design a filter whichintroduces resonance at a specific frequency r byusing a two pole system:

)1)(1()( 11

02 00

zrezre

bzH jj

where r is the resonance radius, 0 is the angle ofthe poles and b0 is the gain factor.

Expanding the denominator and using Euler’sformula yields:

2210cos21 zrzr

So we have 01 cos2 ra and 22 ra .

The only thing left is to normalize the gain at the resonance frequency to 1.

We do this, setting 1)()(|)(| 1222 zHzHzH .

When normalized to 1 at 0 , b0 becomes [1]:

02

0 2cos21)1( rrrb

Using the derived coefficients and the 0, r

relationship we can construct a two pole filter thatresonates at a specific frequency. The frequency andphase response for the filter for different values of r,at half the Nyquist frequency is shown in appendixB.

One can wonder why resonance is important formusic synthesis. The reason is that most acousticinstruments exhibit formants in their spectra.Formants are constant spectral peaks in absolutefrequency regions [6]. This characteristic appears ininstruments that consist of excitation sources orresonating systems, which most acoustic instrumentssuch as reeds, tubes or strings consist of. This tonalquality or timbre gives the instrument a characteristicsound, that is independent of the instrument’sfundamental frequency and can be used to give theinstrument a distinct spectral appearance.The digital resonator can be used to place formantsat selected frequencies in an instrument’s spectrum.

3.1.3. Two Pole Resonant Lowpass Filter

It is possible to modify a two pole digital resonatorinto a filter that also attenuates frequencycomponents, and in this way create a resonantlowpass filter.We observe, that using a digital resonator at a lowfrequency gives a frequency response that has somelowpass filter similarities (see appendix B, plate 4).We can improve this characteristic by furtherattenuating high frequency components. In practicewe do this by placing zeros in the z-plane at theNyquist frequency ( ). Placing zeros changes the numerator of the systemfunction, but since the zero positions are constantand real, the coefficients are constant and simple tocalculate. Placing a zero at yields thecoefficients b1=1, b2=0 and two zeros at the samelocation yields b1=2, b2=1.

KarmaFX Digital Filters For Music Synthesis 6

Page 7: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

We will try to design the filter directly by placingpoles and zeros in the complex z-plane.To illustrate the simplicity of the mathematicaltheory we will list all the necessary calculations.

The system is shown in Figure 9. We place two zerosat and sweep two conjugate poles inside theunit circle, at radius r.

0

Figure 9

We start by inserting two real zeros o1 and o2 in the numerator of the second order transfer function:

212211

221

121

221

12

11

12

11

,

)(1

1

)1)(1(

ooboob

zoozoo

zoozozo

zozo

So we see, that two zeros at –1 gives the alreadyshown coefficients: b1=2, b2=1.

Next we insert the complex poles into thedenominator of the second order transfer function.For simplicity we denote the complex conjugate

poles ),(sincos scjrrrep j .

222221

2221

211

11

)sin(cos ,cos2

)()2(1

),)(,(),(s)(c,-1

)),(1)(),(1(

rrara

zsczc

zscsczscz

zsczsc

So we again have 01 cos2 ra and 22 ra , as

with the digital resonator.In general we can obtain the coefficients of thesecond order transfer function, consisting of twoconjugate poles and zeros by:

221

2210

a ),cos(2a

b ),cos(2b 1,b

ppp

zzz

rr

rr

where rz, z and rp, p gives the position of the zerosand poles respectively [13].

At this point we need to normalize the gain. Wechoose to normalize at 0 (DC).

4

1

11

2)0(

1

12)(

210

21

000

221

2000

000

00

aab

aa

bbbH

eaea

ebebbH

jj

jj

The plot of this filter is shown for a sweeping cutofffrequency and sweeping radius in Appendix C, plate1 and 2. We see that the filter has some of the wantedcharacteristics. It has a 12 dB roll-off per octave, butit does not behave exactly as expected. The amount of resonance in the output signal isscaled as a function of frequency. Furthermore wesee that it is necessary for the radius to be close tothe unit circle (slight resonance), if we want thefrequency response to behave properly. This is seenclearly in the resonance sweep, where we observethat only the zeros affect the frequency response fora low pole radius (low resonance). We can compensate for this by downscaling theradius for higher frequencies. In Appendix C, plate3, we see a better result. Here the radius equals r =1-f, were f is normalized frequency, f=1 equalsNyquist. This solution is however far from perfect,since the relationship isn’t linear, and since thiscompletely eliminates resonance at high frequencies.Since resonance is less sensitive at low frequencies,and more sensitive at high frequencies, we caninstead replace the radius with the non linearrelationship )sin(1 fqr , where q adjustsresonance. The frequency response of the filter usingthis relationship, for different cutoff frequencies andfor both low and high resonance is shown inAppendix C, plate 4 and 5. The corresponding z-plane configurations are also plotted. We see theeffect of readjusting the radius as a function offrequency clearly in the z-plane. Please note, that thefrequency is swept exponentially in the frequency

KarmaFX Digital Filters For Music Synthesis 7

Page 8: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

response figures, while it is swept linearly in the z-plane plots. The resulting frequency responses areexactly what we wanted.This design method is very straightforward andintuitive, since we work directly in the digitaldomain. The design is however not very exact oraccurate. We will later design more accurate filters.

3.2. DESIGN CONSIDERATIONS

3.2.1. IIR versus FIR filters

Up until now, we have only discussed the design ofInfinite Impulse Response (IIR) filters, that is, filterswith feedback. There exists other filters withoutfeedback, Finite Impulse Response (FIR), thatcorresponds to an IIR all-zero filter. The filters arevery popular in DSP since they are easy to controland can be used to design high order filters, withstrong attenuation of unwanted frequencycomponents [5]. However these filters often requiremore computation time than equivalent IIR filters,simply because they use more coefficients [12]. FIRfiltering can be made almost as fast as IIR, by fastconvolution using the FFT, but tuning these filtersinteractively is not practical [5].Thus for music synthesis, the IIR filter is superior toFIR, because of its lower runtime and easy tuningrelationships.

3.2.2. Filter Tuning,Cutoff and Resonance Control

We have seen filters with cutoff and/or resonancecontrol. We will try to lay out guidelines forimplementing these controls. In general we wouldlike the cutoff control to be “linear” in relation to theway humans perceive frequency. Usually we look ata frequency spectrum in a log scale, since this is theway the human mind understands frequency. We canconvince ourselves of this, by playing the piano.Here the frequency doubles for each octave on thepiano. Thus, since we would like the cutoff controlto appear linear, we must make it exponential. Inthis way the control will move slowly in the lowfrequency area and faster in the high frequency area.The range of human hearing is generally between20Hz to 20kHz [13].

Furthermore the roll-off of a filters attenuationshould in general be gentle (6 to 24dB per octave)when used for music synthesis. That is, have a widetransition band. This is simply to give the bestpossible control of the harmonic content of thesignal. We should be aware that the filters, when used, arenot real LTI systems, since we can change cutoff andresonance and thereby change the systemcoefficients over time. Since we use the LTI model,this can lead to instabilities for fast changes in thecutoff frequency [5], and result in sample glitchesand clicks [6]. It may be necessary to interpolate thetuning parameters to force smooth transitions.

In principle the same control of the cutoff applies forthe resonance control. The resonance control is anamplification and is therefore related to loudnessinstead of frequency. The perception of loudnessrelates roughly to the sound power to an exponent of1/3. This means that a perceived loudness increaseby a factor of 2 corresponds to a increase in thesound power by a factor of 10 [13].Furthermore the resonance brings up an importantquestion: In which way should we normalize thefrequency response of the filter ? The lowpass filteronly attenuates frequencies, but the resonance canamplify a frequency range beyond a gain of 0dB .Should this be allowed or should we normalize to thecutoff frequency, and thus force the frequency peakto 0dB ? One could think that the latter would be thebest solution, but this is not the case. In general wewill be working with signals containing afundamental frequency plus harmonics related to aninstruments timbre. Applying a filter with resonanceat a higher frequency than the fundamental, willamplify parts of the harmonic content, but theamplitude of these harmonics will seldom be largerthan the amplitude of the fundamental. If wenormalize to 0dB at the cutoff point, we will insteadattenuate the fundamental, which is not desired. Soin general a filter should be normalized to 0dB, butthe resonance should be allowed to go beyond thispoint.

3.2.3. The Importance of Phase

We have seen frequency and phase response plots forsome different filters. How should we interpret theseresponses in relation to the musical context in which

KarmaFX Digital Filters For Music Synthesis 8

Page 9: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

they will be used ? In music, a general rule of thumbis, that our primary interest is obtaining a specificfrequency response, and that a resulting (non-linear)phase response is accepted [7]. The human ear is very insensitive to phase [13]. Ithas been shown that the frequency response is muchmore important than the phase response in relation toan instrument’s timbre, and that a change in phasehas a minimal effect on the perceived quality of thesound, even though the resulting waveform appearsradically different [6]. That is why all filters in thispaper are designed in relation to the frequencyresponse. We must remember that the phase response is inreality a time-delay, and that the human ear willhardly be able to distinguish a small time-delay. Ingeneral we will therefore not worry about a filtersparticular phase response. It is not possible toachieve a linear phase response with IIR filters, onlywith more expensive FIR filters [1].Note however that a particular phase response can beused to create effects related to music synthesis. Avarying filter, which only has phase response (an all-pass filter), can for example be used to create achorus-like effect [7].

3.2.4. Transforming into other Filter types

Until now we have only considered lowpass filterdesign. The discussed design methods are howevergeneral enough to be used for designing other filters,like highpass or bandpass filters. It is also possibleto transform a well designed lowpass filter into anequivalent highpass filter for instance. This is useful,since we can concentrate on developing a singlefilter-type and convert this to other filter-types whenthe design is finished.We will look at the highpass filter. Spectral inversioncan be used for transforming a FIR lowpass filterinto an equivalent highpass filter. This method doeshowever not always yield correct results when usedwith IIR filters [13], but other methods exists.The highpass has great resemblance to the lowpassfilter. Instead of attenuating the high frequencies thefilter should attenuate the low frequencies. So thehighpass filter is a flipped lowpass filter

)()( lh HH , and we can flip the lowpassfilter by substituting z with -z in the transfer function[12]. This yields a transfer function like the lowpass,but where the sign of the odd-numbered samples are

flipped [1]. For the canonical second order structurethis corresponds to changing the sign of the b1 and a1

coefficients. We will later on use this to transform alowpass filter into a highpass filter. It is also possibleto transform a designed lowpass filter into forexample bandpass and notch filters. Thesetransforms are more complicated than the highpasstransformation, and will not be covered in this paper.

3.2.5. Cascade and Parallel Filter Stages

It is possible to connect filters in cascade or parallelstages, and in this way create more complex filters.See Figure 10. This is used for designing digitalButterworth filters as we shall see later on, but themethod can in general be used to create new higherorder filters based on existing filter designs. Filters are cascaded by multiplying their transferfunctions, and put in parallel by adding their transferfunctions [13]. Knowing this, it is for examplepossible to create a bandpass filter by cascading alowpass and highpass filter. If the filters are twopole, the resulting system will be a four pole filter.The system can be combined into a single filter, butit is usually advantageous to keep the filter stagesseparate, and if possible use the canonical secondorder structure for each stage, since poles and zerosappear in conjugate pairs.

+

y(n) Filter 1 x(n) Filter 2

Cascade

y(n)

Filter 1

x(n)

Filter 2

Parallel

Figure 10

For cascading two second order sections into onecombined fourth order section, we can derive thegeneral equation for the transfer function by:

422

31221

2021120

1100100

422

31221

2021120

1100100

22

110

22

110

22

110

22

110

)()()(

)()()(

))((

))((

zcazcacazcacacazcacaca

zdbzdbdbzdbdbdbzdbdbdb

zczcczbzaa

zdzddzbzbb

We retrieve the fourth order coefficients directly. Wecan later use this for designing fourth orderButterworth Filters.

KarmaFX Digital Filters For Music Synthesis 9

Page 10: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

3.2.6. Digital Design versus Analog Design

All though we have seen that it is possible to designdigital filters directly in the z-domain, it is in generalnot the preferred method for designing digital filters[6]. The response of especially IIR filters are bothhard to predict and control in the digital domain. Inthe analog domain this is different. Analog filterdesign has a long history and is a well developedfield [1,6], and it is therefore advantageous to designfilters in the analog domain and transform these intothe digital domain.

One way to do this is using the Bilinear Transformwhich relates the s-domain to the z-domain.Analog filter design is done in the s-domain, whichhas infinite frequency. The Bilinear Transform mapsthe s-plane into the z-plane using the relation:

1

1

1

12

z

z

Ts

where T is the sampling interval. One of the strongpoints of this transform, is that it avoids aliasing offrequency components, while frequency warping theentire s-plane [1]. We note that the point smaps into 1z .The frequency relationship between the two domainsis

2arctan2

T

We should be aware that the Bilinear Transform onlygives an approximation of the analog filter. Thefrequency response characteristics of the analogfilter and the corresponding digital filter will differslightly [6].

In the next chapter, we will use the BilinearTransform, to design digital filters based on analogprototype filters.

3.3. ANALOG BASED FILTER DESIGN

3.3.1. A Simple Second Order Analog Filter

Filtering is a well established field in the world ofanalog electronics. We will start by looking at thesimplest possible second order lowpass filter: TheSallen & Key Filter [5, 9, 14]. See Appendix D, plate1. The frequency response is given by:

12

1)(

22

sssH

, cf

2

1

where fc is the cutoff frequency and is the so calleddamping factor. In the analog world, is used tospecify the damping factor, or resonance. The lowerthe damping factor, the higher the resonance [5].Simple relations exist for determining the value ofthe resistors/capacitors from the tuning coefficientsfc and , but these relations are coupled, so it isdifficult to vary one coefficient while the other isconstant [5,9]. This structure is therefore not verypopular for use in synthesizers [9].

By transforming this second order (2 pole) analogfilter into the digital domain using the BilinearTransform, the resulting system function is thecanonical second order transfer function (2 pole, 2zero).Substituting with T=1/Fs and reordering, it can beshown that [9]:

)21(),1(2

,2),21/(1

)/tan(/1

202

201

02012

0

CCbaCba

bbbbCCb

FfC sc

We immediately see, that this structure hasresemblance to the previously designed digital filter,where we place two zeros at Nyquist and sweep twoconjugate poles in the z-plane. The frequencyresponse of this filter along with the correspondingz-plane plots are shown in Appendix D. Note that thefrequency is swept exponentially in the frequencyresponse figures, while it is swept linearly in the z-plane plots. We observe that the filter has a 12 dBroll-off per octave, and that it is normalized to 0dB atDC.

We will now try to convert this transformed filterinto an equivalent highpass filter, by using the

KarmaFX Digital Filters For Music Synthesis 10

Page 11: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

method discussed earlier. By simply changing thesign of b1 and a1 we obtain the highpass frequencyresponse shown in Appendix D.

This analog filter has some nice characteristics and isvery fast to apply to a signal, since it can beimplemented using the canonical second orderdifference equation. Unfortunately the tuningrelationships are coupled and the calculations forfinding the filter-coefficients are rather complex.This can make the filter computational expensivewhen modifying the tuning of the filter, especially ifthis is done at a high rate [5].

3.3.2. The Butterworth Filter

Probably the best known and most commonly usedmethod for designing IIR digital filters is thetransformation of the classical analog filters:Butterworth, Chebyshev and Elliptic filters.We will look at the Butterworth filter, since it has amaximally flat frequency response in the passband ,and thus is suitable for filtering in music synthesis.The Butterworth filter of order 2n can be designedby cascading n second order sections, tuned to thesame cutoff frequency, but with different dampingfactors [5]. Using analog hardware, such filters cantherefore be realized by cascading n Sallen & KeyFilters [7].

In the analog domain the Butterworth transferfunction is:

n

k

nkjes

ksH

1

2/)12(2/1

0)(

where n is the filter order and k0 is a normalizingconstant.The Butterworth design can be transformed into thedigital domain by means of the Bilinear Transform.The resulting system function has the form [12]:

1-0,1....,2nifor ,24

12

2

,)2/tan(1

)2/tan(1

)()(

)1()(

i

10

n

i

e

ez

zzzz

zAzH

cj

cj

i

n

n

i

i

However these formulas are rarely used for filtering.Instead a look-up table of different damping- or Q-factors for each biquad section is browsed, forfinding the factors related to the selected filter order.

We will try to design a Butterworth filter of fourthorder (4-pole), by simply cascading two second ordersections based on the Sallen & Key structure.Damping factors for Butterworth filters of differentorders is shown in Appendix E, plate 1 [5]. Thesefactors approximate a flat passband response, byletting the resulting peak fill the rounded area belowthe cutoff point of the previous section [7]. It is thusa matter of simply scaling the damping factors toachieve more resonance in the filter. This scaling can be applied to the first second ordersection, for a peaking resonance, or to all sections,for large bandwidth resonance. The frequency response and matching z-plane plotsof the 4-pole filter is shown in Appendix E, bothwith and without resonance. The resonance isachieved by scaling the first second order sectionsdamping factor. We see that the roll-off is theexpected 24dB per octave, and that the resonancesetting functions as desired.

Using this filter and higher order Butterworth filters,it is possible to achieve steep roll-off’s, and thussmall transition bands, that can be advantageous forsegregating narrow spectral components in complexsounds.

3.3.3. The State Variable Filter

A very popular type of filter for synthesizers, is theAnalog State Variable Filter (SVF). This filter hassupposedly been used in synthesizers from Oberheimas well as synthesizers from other manufactures. Thesecond order SVF has gained popularity, because itis a multimode filter that has both lowpass, bandpassand highpass output at the same time. Furthermorethe filter is very easy to tune with regards to cutoffand resonance, since these variables can be changedindependently by simply varying different resistorsin the analog network [7]. An analog second orderstate variable filter is shown in Appendix F, plate 1.

The analog SVF can be simulated in the digitaldomain by modeling each analogue component byone corresponding digital operator. The resultingdigital structure is shown in Figure 11 [9].

KarmaFX Digital Filters For Music Synthesis 11

Page 12: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

+ +

z-1

z-1 -Q1

-1

yl (n)

F1 + +

z-1

yb (n) yh (n)

z-1

F1

F1 x(n)

Figure 11

The values Q1 and F1 are related to the cutoff frequency fc and damping factor as:

2Q sin2 11

s

c

F

fF

where Fs is the sampling rate.The difference equations are derived from the structure [5]:

)1()()(

)1()()(

)1()1()()(

1

1

1

nynyFny

nynyFny

nyQnynxny

lbl

bhb

blh

By z-transforming the difference equations andsubstituting with r = F1 and q = 1-F1Q1 , we acquirethe resulting system functions [9] :

)(1

)(

)(1

)(

)1(1)(

21

1

212

2

zHr

zzH

zHr

zzH

qzzqr

rzH

lh

lb

l

We note that the result is a two pole system. The frequency response of the lowpass SVF isshown in Appendix F, for high (=0.8) and low(=0.1) damping factors. We observe that the filterhas the familiar 12 dB per octave roll-off and thatthe filter is normalized at DC. Furthermore weobserve that for low resonance (high damping) thefrequency peaks at the Nyquist frequency. For evenhigher damping factors the filter becomes unstable athigh frequencies, since the resulting poles are placed

close to the unit circle [9]. The problem exist forboth lowpass, bandpass and highpass.

By finding the roots of the denominator, we see howthe poles are placed in the z-plane for the cutoffsweeps at both high and low damping factors. Seeappendix F.The lowpass, bandpass and highpass frequencycharacteristic for this filter is shown in appendix Gfor a fixed low frequency at different resonancesettings. We note that the bandpass filter has theexpected roll-off of 6 dB per octave.

The problem with the SVF at high damping and highfrequencies, can be corrected by adding a zero atFs/2, and thus attenuating frequencies at the Nyquistfrequency. This alters the frequency response at highfrequencies, but can be advantageous if highdamping at high frequencies is desired [9]. Inpractice we do this by multiplying the numerator by(1+z-1). This removes the frequency peaks at Fs/2 inall the filter-types and produces frequency responsesthat looks very promising. Since this modificationalso results in an additional factor 2 amplification,we renormalize by 0.5.

The frequency response for lowpass, bandpass andhighpass SVF, before and after adding the zero, isshown in Appendix H. We see that the high peak hasbeen removed and replaced by a faster roll-off in thehigh frequency range. The modification destroys thehighpass filter somewhat, since the zero attenuatesthe high frequency components.The implementation of this change in the structure ofthe SVF is not difficult. Before giving the input tothe filter we just need to apply the +z-1 [9]. This isshown in Figure 12. In the difference equation this isimplemented by adding a + x(n-1) to the equationcontaining x(n), and multiplying both by 0.5 to adjustthe gain.

z-1

+ x(n) SVF 0.5

0.5

Figure 12

Another implementation of the SVF is presented in[7]. Here an extra z-1 delay is present in the loopbefore the lowpass structure. Otherwise the structureis very similar to the previously discussed. See

KarmaFX Digital Filters For Music Synthesis 12

Page 13: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

Figure 13. This structure also produces notch filteroutput.

+ + z-1

-Q1

-1

yl (n)

F1 + +

z-1

yb (n) yh (n)

F1

F1 x(n)

+ yn (n)

Figure 13

The difference equations are:

)()()(

)1()()(

)1()()()(

)1()1()(

1

1

1

nynyny

nynyFny

nyQnynxny

nynyFny

lhn

bhb

blh

lbl

Besides the order of which the filters are calculated,we note the presence of the extra delay in thelowpass equation. The frequency response of thisfilter is equivalent to the already discussed [9].

The SVF allows the resonance to be tweaked sohigh, that the filter will start to oscillate at the cutofffrequency. By setting Q1=0 the SVF can actuallyfunction as a fast sine-wave generator [7].

The State Variable Filter has some very desirableproperties. It is a second order filter withindependent and fast control of center frequency andresonance, and can simultaneously provide lowpass,bandpass, highpass and even notch outputs.

4. FILTER IMPLEMENTATION

We have seen how we can design digital filters withdifferent characteristics. We will now see how toimplement these filters in a digital system like thecomputer. Given a systems difference equation theimplementation follows directly. The x(n) is thecurrent input sample, and x(n-1), x(n-2),…,x(n-M) isthe past M input samples, which could be stored inan array and updated for each iteration. Similarly they(n-1), y(n-2),…,y(n-N) is the past N output samples,and y(n) is the resulting filtered sample for thecurrent iteration. The gives a total of M+N memory

cells for storing past input and output samples, and atotal of M+N+1 multiplication's, when using aDirect Form I implementation:

N

k

M

kkk knxbknyany

1 0

)()()(

Using a Direct Form II implementation:

N

k

M

kkk knwbnynxknwanw

1 0

)()(),()()(

we instead use max{M,N} memory cells, but stillM+N+1 multiplication's [1]. Since the filters discussed in this paper are verysmall IIR filters, there is no real gain in using DirectForm II instead of I, and we might as well use thesimpler Direct Form I implementation.

When implementing filters in a digital machine weoperate with numbers of finite-word-length. Thisleads to quantization errors in the signals, whichappear as noise in the resulting sound. The amountof noise which originates from quatization dependson the chosen number representation: i.e. integer,fixed-point, float etc., that is, the number of bits perword. IIR filters are extra sensitive to quantizationnoise because they are infinite, and therefore theerror accumulates over time. An in-depth discussionof quantization errors in relation to IIR filtering isbeyond the scope of this paper. but we will note thatspecial implementations exist for minimizing thiserror. One alternative implementation method is thecoupled-form state-space realization, which is basedon the canonical second order structure, but is lesssensitive to finite-word-length effects, and thereforesuitable as a building block in cascaded systems [1].Furthermore implementation of IIR filters can lead tooverflow and especially underflow errors, whichshould be handled in some way. For dedicated DSPchips this is usually not a real problem, but fordesktop computers this can introduce time-consuming floating-point denormals, that can lead tostrange periodic slow-down errors if the programmeris not aware of this. The smallest non-denormalsingle precision floating point number is1.175494350822288e-38f.

KarmaFX Digital Filters For Music Synthesis 13

Page 14: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

5. RESULTS

We have discussed several different approaches fordesigning digital filters. We will now discuss howthese filters behave when implemented in a digitalcomputer and if they meet our previously describeddesign specifications.

5.1. TEST SYSTEM AND TEST PROCEDURE

All the filters have been analyzed in MATLAB, forboth frequency response, phase response and z-planeconfiguration, for different tuning parameters. Oneof the developed MATLAB programs is shown inAppendix I. Furthermore the filters have beenimplemented on an Intel Pentium III system runningMicrosoft Windows, and applied to real-time band-limited signals, consisting of periodic sampled saw-,triangle- and square-waves. The systems sampleratewas set to 44.1kHz and the filtering was performedon blocks of 1024 samples. Fast sine-wavemodulation of cutoff at different setting forresonance was tested for some selected filters. Thetuning parameters were not interpolated in any way.The results were sent directly to the computerssound-card. The implementation was written in C++,using 32 bit floats for number representation,however for internal calculations the Pentiumoperates with 80 bit representations. For avoidingunderflow in feedback, floating-point denormalswere removed using this simple macro: #define DENORMALIZE(fv) (((( *(unsigned int*) &(fv))& 0x7FFFFFFF) < 0x0da24260 ) ? 0.0f : (fv) )It forces absolute floats below 1.e-30f to zero,without using any FPU instructions.

5.2. TEST SPECIFICATIONS

The tested filters are as follows:

1. 1-pole lowpass (direct digital design)2. 2-pole resonant lowpass (direct digital design).3. 2-pole lowpass and highpass based on the analog

Sallen & Key structure.4. 4-pole Butterworth lowpass filter (based on

analog design)5. 2 pole State Variable Filter (lowpass, highpass,

bandpass + implementation with notch )6. 2 pole State Variable Filter with added zero for

attenuation at nyquist.

Except for Filter #1, all these filters can be tuned bya cutoff and resonance parameter as described bydesign specification 3 and 4 (DS3,4). The filtershave a roll-off of 6dB (1 pole), 12dB (2 pole) and24dB (4 pole) to give a gentle attenuation and a longtransition band, and it is a simply a matter ofcascading more filter stages to achieve a faster roll-off (DS5). We have primarily tested the lowpassfilter, but highpass filters are very easilyimplemented as we have seen (DS1). All the filtersare normalized to a gain of 0dB at DC, andresonance has been allowed to go as high as +20dB(DS9). We note that all the filters have a non-linearphase response (DS8), but as discussed the phaseresponse is not our primary concern and is thereforeaccepted.

5.3. TEST RESULTS AND COMPARISON

The tested filters are generally easy to operate andfunction as expected. They behave and sound muchlike a “real” filter in a standard synthesizer (DS2),although some people might say that they lack someof the analog “warmth” that was characteristic inclassic analog synthesizers. This however can alsobe partly related to quality of the input samples,since the filter only shapes the frequencycomponents of incoming signal. Furthermore thefilters are generally very fast to apply to a signal(DS6), even at high sampling rates, and it is possibleto comfortably apply, say 20 two-pole filters (non-modulated) simultaneously and only use about 12%of the CPU on the test system.

The fastest and easiest implemented resonant filter is2 pole State Variable Filter (#5). The combinationof quick and independent calculation of tuningcoefficients and simultaneous lowpass, bandpass,highpass and even notch output makes this filterstand out. In its standard form, the filter is difficult totune at low resonance and high frequency settings,and it can be necessary to limit the resonance orcutoff interval considerably, giving less control ofthe timbre. However it is possible to compensate forthis by adding an extra zero in the structure, and thuseliminate this restriction (#6). This causes a smallattenuation in the highpass filter close to the Nyquistfrequency, but in general this is not heard sinceharmonics seldom reach this frequency. The

KarmaFX Digital Filters For Music Synthesis 14

Page 15: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

highpass might give different results when applied tohigh frequency instruments, like hihats, but this hasnot been tested. The change makes the lowpass filtervery stable across the entire frequency range at bothlow and high resonance settings, and thisconfiguration (#6) is therefore more advantageousthan the standard form (#5). The actual filteringinvolves 4 additions and 3 multiplication's. For theconfiguration with an extra zero this is instead 5additions and 4 multiplication's. For bothconfigurations, one extra addition is needed fornotch output. Note that by using one extramultiplication per output for scaling, this filter canalso function as a fast 3 band equalizer withadjustable center-frequency.

Filters based on the analog Sallen & Key structure(#3), are stable across the entire frequency range, atboth low and high frequencies without anymodifications. The sound characteristics of this filteris almost identical to the state variable configuration(#6), which is not surprising since they have analmost similar frequency response. The filter ismore difficult to tune, because of the calculationsinvolved and because is necessary to use look-uptables for calculating the coefficients for maximumefficiency. Once the filter coefficients have beencalculated the actual filtering process is almost asfast as the SVF, 5 multiplication's and 4 additions fora standard second order configuration. However onlyone filtered output signal is produced by this, i.e.,lowpass or highpass etc.A sine wave with variable frequency and amplitudewas used to modulate the cutoff frequency of filter#3,#5 and #6. The State Variable Filters (#5,#6)provided the best audiovisual results, and themodulation sounded correct. The Sallen & Key filtersuffered from distortion and hissing when the sinewave was set to a high frequency. However, thiscould be due to the lack of interpolation of thecutoff-parameter in the test system.The direct digital designed two pole filter (#2) hasalmost the same properties as the Sallen & Keystructure. The filter is a little simpler to tune,because of the approximated coefficientrelationships. However since the filter design is notcompletely accurate, it should not be used forcascading second order sections for example.

The Butterworth filter is very easy to design and use,when based on an existing second order structure,

like the Sallen & Key filter. It is a simple matter ofcascading the existing second order filter in n stages.The 4-pole Butterworth (#4), therefore has almostexactly the same properties as #3, only with a steeperroll-off. The effect of the steeper roll-off is easy tohear in the resulting sound, the attenuation is moreprofound, and the filter makes the instrument soundmore “hollow” when resonance is applied.

The one pole filter (#1) is generally not suitable foraudio filtering alone, but it can be cascaded with thedescribed two-pole filters for achieving a steeperroll-off, thereby creating a 3-pole filter for example(18 dB roll-off). Furthermore, since this filter is veryfast to apply to a signal, it can generally be used to avast variety of tasks related to the smoothing ofdigital signals that appear in programs related tomusic synthesis. This can for example be removal ofsample-glitches, smooth volume ramping and audiofiltering in feedback, needed for echo and reverbsimulations.

To summarize, two of the tested second order filtershave properties that are very desirable for use inmusic synthesis. The test shows, that the best all-round filter implementation is the State VariableFilter, with an extra added zero (#6). The filter isfaster, easier to tune, and has more possibilities thanany of the other tested filters. Filters based on theanalog Sallen & Key filter (#3), are not quite as fast,and not as easy to tune, but provide a slightly betterfrequency response than the SVF, which makes it thenext best implementation.. Finally, the Butterworthdesign (#4) can be considered a good extension tosecond order filters for achieving steeper roll-off’s.We have tested this using the Sallen & Keyimplementation, but it should also be possible toachieve a Butterworth response, by cascading secondorder SVF sections, although we have not tested this.

KarmaFX Digital Filters For Music Synthesis 15

Page 16: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

6. CONCLUSION

We have described theory for designing digital filtersfor music synthesis, directly in the digital domainand based on analog prototypes. We have seen, thatit is possible to design simple and useful filtersdirectly in the digital domain, but that it can be easierand more practical to design filters based on existinganalog filters. We have also seen, that it is possibleto improve the transformed analog filters directly inthe digital domain, thereby making the designedfilter more functional, as in the case of the StateVariable Filter. We have described methods for improving the filtersby using more filter stages, and transforming filtersinto different types. Furthermore we haveimplemented and tested the described filters on acomputer and used them for real-time filtering. We have seen that different filters have bothadvantages and disadvantages, and that a selection ofa particular filter therefore should depend on theapplication. However, a particular filter seems tostand out, with regards to both functionality andspeed, that in relation to music synthesis, makes thisfilter very desirable. This is the State Variable Filter.It is surprising that this filter is not described morethoroughly in the literature. Only one book [7] of theused references describes this filter, but does notcover the improved variation of this filter, that wehave seen in this paper. The SVF is instead coveredin technical articles [5,9]. Books related to musicsynthesis seems to focus mainly on the two poleButterworth design, which corresponds to thedescribed Sallen & Key filter.We have primarily covered the resonant lowpass,highpass, bandpass and notch filters, since these arewidely used filters in synthesizers. We should notehowever, that filtering for music synthesis is a largetopic, an many other different filtering operationscan be of interest. As computers get faster in thefuture, lots of different filtering operations related tomusic synthesis and audio-effects will inevitably beimplemented in computer software, and it will beinteresting to witness this musical evolution.

7. REFERENCES

[1] J.G.Proakis, D.G.Manolakis, “Digital Signal Processing, Principles, Algorithms, and Applications”, 3rd edition, 1996.

[2] Dean Friedman, “Synthesizer Basics”, 1986.

[3] David Crombie, “The New Complete Synthesizer, A Comprehensive Guide to the World of Electronic Music”, 1986.

[4] L.R.Rabiner, B.Gold, “Theory And Applications of Digital Signal Processing”,1975.

[5] P.Dutilleux, “Filters, Delays, Modulations and Demodulations A Tutorial”, 1998.

[6] Charles Dodge, Thomas A. Jerse, “Computer Music”, 1997.

[7] H.Chamberlin, “Musical Applications of Microprocessors”, 1980.

[8] Lane, Hoory, Martinez, and Wang, “Modeling Analog Synthesis with DSPs”, Computer Music Journal, 21:4, pp.23-41, 1997.

[9] P.Dutilleux, “Simple To Operate Digital Time Varying Filters”, Preprint 2757, 86th AES Convention, Hamburg, March, 1989.

[10] “Nord Lead, Virtual Analog, Owners Manual, Software Version 2.x English”, Clavia 1996

[11] John Lane and Garth Hillman, “Motorola's DSP56000/SPS/DSP56001, Implementing IIR/FIR Filters with Digital Signal Processors”, Motorola, 1993.

[12] Ken Steiglitz, “A Digital Signal ProcessingPrimer, with Applications to Digital Audio and Computer Music”, 1996

[13] Steven W.Smith, “The Scientist and Engineer’s Guide to Digital Signal Processing”, California Technical Publishing, 1997, (http://www.dspguide.com).

[14] Kerry Lacanette, “A Basic Introduction to Filters – Active, Passive and Switched-Capacitor”, AN-779, National Semiconductor Corporation, 1991.

[15] Curtis Roads et al., “The Computer Music Tutorial”, MIT Press, 1996.

KarmaFX Digital Filters For Music Synthesis 16

Page 17: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

APPENDIX A

0 0 . 1 0 . 2 0 . 3 0 . 4 0 . 5 0 . 6 0 . 7 0 . 8 0 . 9 10

0 . 1

0 . 2

0 . 3

0 . 4

0 . 5

0 . 6

0 . 7

0 . 8

0 . 9

1

N o r m a l i z e d F r e q u e n c y f

Mag

nitu

de

o n e p o l e l o w p a s s f i l t e r ( p . 3 3 3 ) c u t o f f s w e e p

1 0-2

1 0-1

1 00

- 8 0

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

o n e p o l e l o w p a s s f i l t e r w i t h c u t o f f s w e e p

0 0 . 1 0 . 2 0 . 3 0 . 4 0 . 5 0 . 6 0 . 7 0 . 8 0 . 9 1- 0 . 5

- 0 . 4 5

- 0 . 4

- 0 . 3 5

- 0 . 3

- 0 . 2 5

- 0 . 2

- 0 . 1 5

- 0 . 1

- 0 . 0 5

0

N o r m a l i z e d F r e q u e n c y f

Ang

le (

radi

ans)

o n e p o l e l o w p a s s f i l t e r w i t h c u t o f f s w e e p

- 1 . 5 - 1 - 0 . 5 0 0 . 5 1 1 . 5

- 1

- 0 . 8

- 0 . 6

- 0 . 4

- 0 . 2

0

0 . 2

0 . 4

0 . 6

0 . 8

1

R e a l P a r t

o n e p o l e l o w p a s s f i l t e r w i t h c u t o f f s w e e p

Imag

inar

y P

art

KarmaFX Digital Filters For Music Synthesis 17

Page 18: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

APPENDIX B

0 0 . 1 0 . 2 0 . 3 0 . 4 0 . 5 0 . 6 0 . 7 0 . 8 0 . 9 10

0 . 1

0 . 2

0 . 3

0 . 4

0 . 5

0 . 6

0 . 7

0 . 8

0 . 9

1

r

(1+

r2 )/2*

r

R e s o n a n c e f r e q u e n c y r e l a t i o n s h i p t o t h e a n g u l a r p o s i t i o n o f t h e p o l e

0 0 . 1 0 . 2 0 . 3 0 . 4 0 . 5 0 . 6 0 . 7 0 . 8 0 . 9 10

0 . 1

0 . 2

0 . 3

0 . 4

0 . 5

0 . 6

0 . 7

0 . 8

0 . 9

1

N o r m a l i z e d F r e q u e n c y f

Mag

nitu

de

r e s o n a t o r

0 0 . 1 0 . 2 0 . 3 0 . 4 0 . 5 0 . 6 0 . 7 0 . 8 0 . 9 1- 0 . 5

- 0 . 4

- 0 . 3

- 0 . 2

- 0 . 1

0

0 . 1

0 . 2

0 . 3

0 . 4

0 . 5

N o r m a l i z e d F r e q u e n c y f

Ang

le (

radi

ans)

r e s o n a t o r

1 0-2

1 0-1

0 . 2

0 . 4

0 . 6

0 . 8

1

1 . 2

N o r m a l i z e d F r e q u e n c y f

Mag

nitu

de

r e s o n a t o r

KarmaFX Digital Filters For Music Synthesis 18

Page 19: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

APPENDIX C

1 0- 3

1 0- 2

1 0- 1

1 00

- 8 0

- 6 0

- 4 0

- 2 0

0

2 0

4 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

t w o p o l e r e s o n a n t l o w p a s s f i l t e r ( k h n 3 ) c u t o f f s w e e p , n o r m a l i z e d a t H ( 0 ) = 1 , r = 0 . 5

1 0-3

1 0-2

1 0-1

- 8 0

- 6 0

- 4 0

- 2 0

0

2 0

4 0

N o r m a l i z e d F r e q u e n c y fG

ain

(dB

)

t w o p o l e r e s o n a n t l o w p a s s f i l t e r , r e s o n a n c e s w e e p ( r a d i u s ) , f = 0 . 0 1

1 0- 3

1 0- 2

1 0- 1

- 8 0

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

t w o p o l e r e s o n a n t l o w p a s s f i l t e r , c u t o f f s w e e p , r = 1 - f

1 0- 3

1 0- 2

1 0- 1

- 8 0

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

t w o p o l e r e s o n a n t l o w p a s s f i l t e r , c u t o f f s w e e p , r = 1 - s i n ( p i * f ) * q , q = 0 . 8

- 1 - 0 . 8 - 0 . 6 - 0 . 4 - 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1

- 1

- 0 . 8

- 0 . 6

- 0 . 4

- 0 . 2

0

0 . 2

0 . 4

0 . 6

0 . 8

1

t w o p o l e r e s o n a n t l o w p a s s f i l t e r , c u t o f f s w e e p , r = 1 - s i n ( p i * f ) * q , q = 0 . 8

R e a l P a r t

Imag

inar

y P

art

4 0 2

1 0- 3

1 0- 2

1 0- 1

- 8 0

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

t w o p o l e r e s o n a n t l o w p a s s f i l t e r , c u t o f f s w e e p , r = 1 - s i n ( p i * f ) * q , q = 0 . 1

- 1 - 0 . 8 - 0 . 6 - 0 . 4 - 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1

- 1

- 0 . 8

- 0 . 6

- 0 . 4

- 0 . 2

0

0 . 2

0 . 4

0 . 6

0 . 8

1

t w o p o l e r e s o n a n t l o w p a s s f i l t e r , c u t o f f s w e e p , r = 1 - s i n ( p i * f ) * q , q = 0 . 1

R e a l P a r t

Imag

inar

y P

art

3 8 2

KarmaFX Digital Filters For Music Synthesis 19

Page 20: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

APPENDIX D

Sallen-Key 2nd Order Active Lowpass filter Network

1 0- 4

1 0- 3

1 0- 2

1 0- 1

1 00

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

s e c o n d o r d e r l o w p a s s f i l t e r , c u t o f f s w e e p , d = 0 . 8

- 1 - 0 . 8 - 0 . 6 - 0 . 4 - 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1

- 1

- 0 . 8

- 0 . 6

- 0 . 4

- 0 . 2

0

0 . 2

0 . 4

0 . 6

0 . 8

1

R e a l P a r tIm

agin

ary

Par

t

s e c o n d o r d e r l o w p a s s f i l t e r , c u t o f f s w e e p , d = 0 . 8

4 0 2

1 0- 4

1 0- 3

1 0- 2

1 0- 1

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

s e c o n d o r d e r l o w p a s s f i l t e r , c u t o f f s w e e p , d = 0 . 1

- 1 - 0 . 8 - 0 . 6 - 0 . 4 - 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1

- 1

- 0 . 8

- 0 . 6

- 0 . 4

- 0 . 2

0

0 . 2

0 . 4

0 . 6

0 . 8

1

R e a l P a r t

Imag

inar

y P

art

s e c o n d o r d e r l o w p a s s f i l t e r , c u t o f f s w e e p , d = 0 . 1

4 0 2

1 0- 4

1 0- 3

1 0- 2

1 0- 1

1 00

- 9 0

- 8 0

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

s e c o n d o r d e r h i g h p a s s f i l t e r , c u t o f f s w e e p , d = 0 . 8

1 0- 4

1 0- 3

1 0- 2

1 0- 1

- 8 0

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

s e c o n d o r d e r h i g h p a s s f i l t e r , c u t o f f s w e e p , d = 0 . 1

KarmaFX Digital Filters For Music Synthesis 20

Page 21: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

APPENDIX E

N 2 0.7074 0.924 0.3836 0.966 0.707 0.2598 0.981 0.831 0.556 0.19510 0.988 0.891 0.707 0.454 0.156

Damping factors for second order sections in Butterworth filters

1 0-2

1 0-1

1 00

- 8 0

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

B u t t e r w o r t h f o u r p o l e r e s o n a n t l o w p a s s f i l t e r , c u t o f f s w e e p , n o r e s o n a n c e

- 1 - 0 . 8 - 0 . 6 - 0 . 4 - 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1

- 1

- 0 . 8

- 0 . 6

- 0 . 4

- 0 . 2

0

0 . 2

0 . 4

0 . 6

0 . 8

1

B u t t e r w o r t h f o u r p o l e r e s o n a n t l o w p a s s f i l t e r , c u t o f f s w e e p , n o r e s o n a n c e

R e a l P a r t

Imag

inar

y P

art

8 0 4

1 0- 3

1 0- 2

1 0- 1

- 8 0

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

B u t t e r w o r t h f o u r p o l e r e s o n a n t l o w p a s s f i l t e r , c u t o f f s w e e p , w i t h r e s o n a n c e ( s c a l i n g = 0 . 2 )

- 1 - 0 . 8 - 0 . 6 - 0 . 4 - 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1

- 1

- 0 . 8

- 0 . 6

- 0 . 4

- 0 . 2

0

0 . 2

0 . 4

0 . 6

0 . 8

1

B u t t e r w o r t h f o u r p o l e r e s o n a n t l o w p a s s f i l t e r , c u t o f f s w e e p , w i t h r e s o n a n c e ( s c a l i n g = 0 . 2 )

R e a l P a r t

Imag

inar

y P

art

8 0 4

KarmaFX Digital Filters For Music Synthesis 21

Page 22: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

APPENDIX F

Analog 2nd order State Variable Filter Network

1 0- 3

1 0- 2

1 0- 1

1 00

- 8 0

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r , c u t o f f s w e e p , d a m p i n g f a c t o r = 0 . 8 ( l o w p a s s )

- 1 - 0 . 5 0 0 . 5 1

- 1

- 0 . 5

0

0 . 5

1

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r , c u t o f f s w e e p , d a m p i n g f a c t o r = 0 . 8 ( l o w p a s s )

R e a l P a r t

Imag

inar

y P

art

2222

1 0- 4

1 0- 3

1 0- 2

1 0- 1

1 00

- 8 0

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Gai

n (d

B)

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r , c u t o f f s w e e p , d a m p i n g f a c t o r = 0 . 1 ( l o w p a s s )

- 1 - 0 . 5 0 0 . 5 1

- 1

- 0 . 5

0

0 . 5

1

R e a l P a r t

Imag

inar

y P

art

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r , c u t o f f s w e e p , d a m p i n g f a c t o r = 0 . 1 ( l o w p a s s )

2

KarmaFX Digital Filters For Music Synthesis 22

Page 23: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

APPENDIX G

1 0- 3

1 0- 2

1 0- 1

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

2 0

3 0

N o r m a l i z e d F r e q u e n c y f

Mag

nitu

de (

dB)

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r L P , B P , H P , d a m p i n g f a c t o r = 0 . 0 1

H P L P

B P

1 0- 3

1 0- 2

1 0- 1

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Mag

nitu

de (

dB)

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r L P , B P , H P , d a m p i n g f a c t o r = 0 . 2

H P L P

B P

1 0- 3

1 0- 2

1 0- 1

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Mag

nitu

de (

dB)

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r L P , B P , H P , d a m p i n g f a c t o r = 0 . 8

H P L P

B P

KarmaFX Digital Filters For Music Synthesis 23

Page 24: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

APPENDIX H

without extra zero with extra zero

1 0-3

1 0-2

1 0-1

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

2 0

N o r m a l i z e d F r e q u e n c y f

Mag

nitu

de (

dB)

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r , c u t o f f s w e e p , d a m p i n g f a c t o r = 0 . 8 ( l o w p a s s )

1 0-4

1 0-3

1 0-2

1 0-1

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y fM

agni

tude

(dB

)

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r , c u t o f f s w e e p , d a m p i n g f a c t o r = 0 . 8 ( l o w p a s s )

1 0-3

1 0-2

1 0-1

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Mag

nitu

de (

dB)

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r , c u t o f f s w e e p , d a m p i n g f a c t o r = 0 . 8 ( b a n d p a s s )

1 0-3

1 0-2

1 0-1

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Mag

nitu

de (

dB)

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r , c u t o f f s w e e p , d a m p i n g f a c t o r = 0 . 8 ( b a n d p a s s )

1 0-3

1 0-2

1 0-1

1 00

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Mag

nitu

de (

dB)

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r , c u t o f f s w e e p , d a m p i n g f a c t o r = 0 . 8 ( h i g h p a s s )

1 0-3

1 0-2

1 0-1

- 8 0

- 7 0

- 6 0

- 5 0

- 4 0

- 3 0

- 2 0

- 1 0

0

1 0

N o r m a l i z e d F r e q u e n c y f

Mag

nitu

de (

dB)

s e c o n d o r d e r s t a t e v a r i a b l e f i l t e r , c u t o f f s w e e p , d a m p i n g f a c t o r = 0 . 8 ( h i g h p a s s )

KarmaFX Digital Filters For Music Synthesis 24

Page 25: Digital Filters For Music Synthesis · Several digital IIR filters based on analog prototype filters are explained, and the filters advantages and disadvantages are discussed. The

APPENDIX I

%% Second order State Variable Filter%

comment= 'second order state variable filter, cutoff sweep, damping factor = 0.1 (lowpass)';

Q=0.1;

hold off;

kzr=[];kpr=[];

f=0.00001;

while f < 1

%f1 = sin(pi*0.5*f);f1 = f;

r=f1;q = 1-f1*2*Q;

f = f + 1*f; % obtains linear cutoff adjustment%f= f+0.02;

b0 = r*r;a1 = r*r-q-1;a2 = q;

% coefficients

% ======== lowpass SVFzc = [b0];%zc = [0.5*b0,+b0*0.5]; % added zeropc = [1,a1,a2];

% ======== highpass SVF%%%%%% (1-z)(1-z) = 1 + z*z -2z%%%%%% (1+z)(1+z*z -2z) = 1 + z*z -2z + z + z*z*z -2*z*z = 1 + -z*z -z + z*z*z%zc = [b0,-2*b0,b0];%zc = [0.5*b0,-b0*0.5,-b0*0.5,b0*0.5]; % added zero%pc = [r*r,r*r*a1,r*r*a2];

% ======== bandpass SVF%%%% (1-z)(1+z) = 1+z-z-z*z; %zc = [b0,-b0];%zc=[0.5*b0,0,-b0*0.5]; % added zero%pc = [r,r*a1,r*a2];

% poles & zeros (roots of the coefficients)

zr = roots(zc);pr = roots(pc);

kzr = [kzr;zr];kpr = [kpr;pr];

[XX,wx] = freqz(zc,pc,1024*10); %% high resolutiongrid on;semilogx(wx/pi,10*log(abs(XX))); xlabel('Normalized Frequency f');ylabel('Gain (dB)');

title(comment);hold on;

end

%zplane(kzr,kpr);title(comment);

KarmaFX Digital Filters For Music Synthesis 25