Content uploaded by Stefan Bilbao

Author content

All content in this area was uploaded by Stefan Bilbao on Feb 17, 2015

Content may be subject to copyright.

JOURNAL OF L

A

T

E

X CLASS FILES, VOL. 1, NO. 11, NOVEMBER 2002 1

Time-varying Generalizations of Allpass Filters

Stefan Bilbao

∗

Sonic Arts Research Centre, Queen’s University Belfast

United Kingdom, BT7 1NN

Tel: +44(0)2890974465, Fax: +44(0)2890274828, Email: s.bilbao@qub.ac.uk

Abstract— In many audio applications, digital allpass ﬁl-

ters are of central importance; a key property of such ﬁl-

ters is energy (l

2

norm) preservation. In audio eﬀect and

sound synthesis algorithms, it is desirable to have ﬁlters

which behave as allpasses with time-varying characteristics,

but direct generalizations of time-invariant designs can lose

the important norm-preserving property; for fast parame-

ter variation, large gain increases are possible. We here

call attention to some simple time-varying ﬁlter structures,

based on wave digital ﬁlter designs, which do preserve signal

energy, and which reduce to simple ﬁrst- and second-order

allpass ﬁlters in the time-invariant case.

Keywords— allpass ﬁlters, time-varying ﬁlters, wave digital

ﬁlters, musical sound synthesis, digital audio eﬀects

EDICS Category: 2-AUEA

I. Introduction

A

LLPASS digital ﬁlter designs [1] play a fundamental

role in almost all areas of audio signal processing.

The deﬁning property of such a design is that it possesses

unity gain, at all frequencies. A corollary is that in the

time domain, the squared norm of a sequence is preserved

through the ﬁltering operation; in other words, such a ﬁlter

is energy-preserving.

In several important applications, it is necessary to ex-

tend the deﬁnition of the allpass ﬁlter to the time-varying

coeﬃcient case. Certain audio eﬀects [2] rely on this, as

do many physics-based musical sound synthesis algorithms

(such as digital waveguides as applied to nonlinear strings

[3], [4], [5], and scattering representations of woodwind

toneholes [6], [7]). If the time variation of the ﬁlter co-

eﬃcients is slow, then generally it is safe to treat such

a ﬁlter as a quasi-static system, though strictly speaking,

frequency domain analysis (and the use of terms such as

“unity gain,” etc.) is not generally meaningful. For faster

time variation (as may be the case for the physical models

mentioned above), such analysis can be misleading; large

gain variations are a possibility.

Scattering-type ﬁlter designs, such as digital waveguides

[8], [9] and, in particular, wave digital ﬁlters [10], [11] oﬀer

a useful set of design tools for time-varying ﬁlters; though

it of course remains impossible to perform any meaningful

frequency-domain analysis, energy-based stability guaran-

tees are still within reach. They have appeared, in partic-

ular, in vocal tract modelling in the wave digital ﬁltering

S. Bilbao is with the Sonic Arts Research Centre, Queen’s

University Belfast, Northern Ireland, United Kingdom, BT7

1NN. Tel: +44(0)2890974465, Fax: +44(0)28 90274828, Email:

s.bilbao@qub.ac.uk.

context [12], [13], and, earlier as lattice ﬁlter designs [14].

In this short paper, we point out a simple generalization

of the ﬁrst- and second-order allpass ﬁlters to the time-

varying coeﬃcient case, suitable for audio applications, us-

ing wave digital ﬁlters as a starting point. It is worth not-

ing that these algorithms are quite diﬀerent in character

from algorithms developed by Mourjopolis [15], Zetterberg

and Zhang [16] and V¨alim¨aki et al. [17] for time-varying

ﬁlters, for which the emphasis is on transient suppression

and minimizing distortion.

II. First-order Allpass Filters

For a given real input sequence x

n

, indexed by integer n,

a general ﬁrst-order allpass ﬁlter is deﬁned by the recursion

y

n+1

= β (ax

n+1

+ x

n

) −ay

n

(1)

where y

n

is the output sequence, again indexed by integer

n. Here, a is a real ﬁlter coeﬃcient, assumed constant, and

constrained to be of magnitude less than unity for stability.

β is a parameter taking on the value 1 or -1.

The familiar transfer function for this ﬁlter, obtained by

taking z-transforms, is

H(z

−1

) =

Y (z

−1

)

X(z

−1

)

= β

a + z

−1

1 + az

−1

(2)

which possesses the well-known property

|H(z

−1

)| = 1 −→ |Y (z

−1

)| = |X(z

−1

)| (3)

on the unit circle (i.e., for z = e

jω

). Furthermore, through

Parseval’s relation, we then have that

ky

.

k = kx

.

k (4)

where

kf

.

k =

∞

X

n=−∞

f

2

n

!

1/2

(5)

deﬁnes the l

2

norm for square-summable sequences f

n

(the .

refers to summation variable n). In other words, the allpass

ﬁlter is norm-preserving. (It is of course also possible to

derive (4) directly from (1) without using frequency domain

concepts.)

A. Time-varying Parameters

The most straightforward approach to extending the all-

pass to the time-varying case is to simply make the coeﬃ-

cients a variable, as per, e.g., [15]. One way of doing this

is to use the recursion

y

n+1

= β (a

n+1

x

n+1

+ x

n

) − a

n+1

y

n

(6)

JOURNAL OF L

A

T

E

X CLASS FILES, VOL. 1, NO. 11, NOVEMBER 2002 2

A full analysis of this ﬁlter is, of course, diﬃcult, but it is

easy enough to show that a simple condition such as

|a

n+1

| ≤ < 1 (7)

is not suﬃcient to ensure energy preservation. Consider

the case where x

n

is simply an impulse, i.e., x

0

= 1 and

takes on the value zero otherwise. Then, we have

y

0

= βa

0

y

1

= β(1 − a

0

a

1

)

.

.

.

y

n

= β(1 − a

0

a

1

)

n

Y

j=2

(−a

j

)

in which case

ky

.

k

2

= (a

0

)

2

+ (1 − a

0

a

1

)

2

1 +

∞

X

n=2

n

Y

j=2

a

2

j

Then, from (7), we have that

ky

.

k

2

≤

2

+ (1 +

2

)

2

∞

X

n=0

2n

=

1 + 3

2

1 −

2

This bound is tight, and can be met with equality for ﬁlter

coeﬃcients a

n

= (−1)

n

. For this choice of coeﬃcients,

the output energy is greater than the input energy for any

choice of < 1, and becomes unbounded as approaches

1.

Other obvious attempts to generalize the allpass also fail;

for instance, instead of (6), we could use

y

n+1

= β (a

n+1

x

n+1

+ x

n

) − a

n

y

n

Such a choice can lead to similar energy growth, under

condition (7). (Considering, for example, a unit impulse

input, and ﬁlter coeﬃcients a

0

= 0, a

n

= (−1)

n

, for n ≥ 1,

we again get unbounded growth of ky

.

k in the limit as

approaches 1.)

B. A Wave Digital One-Port

A full introduction to wave digital ﬁltering principles is

beyond the scope of this paper—we refer the reader to [11]

for an overview and introduction.

Consider the wave digital one-port shown in Figure 1,

which consists of a single two-port adaptor (either series

or parallel) terminated on a delay, with or without sign

inversion (β takes on the value 1 or -1), corresponding to

a wave digital capacitor or inductor, respectively. At the

free port, the input is a sequence x

n

, and the output is

the sequence y

n

. At the terminated port, the input to the

adaptor is the sequence w

n

, and the output is v

n

.

The adaptor, in either the series or parallel case, is de-

ﬁned by values at its two ports, M at the free port, and M

n

at the port connected to the delay element. We assume M

to be a constant, and M

n

to be a time-varying sequence.

y

n

x

n

w

n

v

n

β

M M

n

T

Parallel

Series

or

Fig. 1. Wave digital one-port, corresponding to a generalization of

a ﬁrst-order allpass section.

Both M and M

n

are constrained to be strictly positive. We

note that we have used the neutral letter M in this case,

to indicate that these port values may be taken as port

resistances (in the case of a series adaptor) or as conduc-

tances (in the case of a parallel adaptor). Instantaneous

scattering at the adaptor can be described by the following

matrix equation:

y

n

v

n

= α

γ

n

−

p

1 − γ

2

n

−

p

1 − γ

2

n

−γ

n

x

n

w

n

(8)

where γ

n

, the time-varying reﬂection coeﬃcient, is deﬁned

by

γ

n

=

M

n

− M

M

n

+ M

(9)

which, due to the positivity condition on M and M

n

, must

satisfy

|γ

n

| < 1 (10)

for all n. The parameter α is set to 1 for a series junction

or -1 for a parallel junction. Note that we have assumed

power-normalized scattering here [11]. The reactive one-

port is deﬁned simply by

w

n+1

= βv

n

(11)

The scattering operation, when viewed as a matrix trans-

formation, is easily shown to be orthogonal at each time

step n, and thus we must have

y

2

n

+ v

2

n

= x

2

n

+ w

2

n

(12)

It then follows immediately, summing over n, that

ky

.

k

2

+ kv

.

k

2

= kx

.

k

2

+ kw

.

k

2

(13)

From the deﬁnition (11) of the reactive one-port, we also

have that

kv

.

k

2

= kw

.

k

2

(14)

from which it then follows that

ky

.

k

2

= kx

.

k

2

(15)

Thus, this wave digital one-port has the same norm-

preserving property as the allpass ﬁlter, but now in the

time-varying case. It is important to note that power-

normalization is crucial here, in that otherwise (using, say,

the more standard voltage wave scattering), the scattering

matrix is not orthogonal. The distinction is identical to

that between normalized and non-normalized lattice digi-

tal ﬁlter sections [14].

JOURNAL OF L

A

T

E

X CLASS FILES, VOL. 1, NO. 11, NOVEMBER 2002 3

It is simple enough to arrive at a recursion corresponding

to this one-port which relates y

n

to x

n

directly:

y

n+1

= αγ

n+1

x

n+1

− β

s

1 − γ

2

n+1

1 − γ

2

n

(αγ

n

y

n

− x

n

) (16)

Setting a

n

= βαγ

n

gives, ﬁnally,

y

n+1

= β (a

n+1

x

n+1

+ φ

n

x

n

) − φ

n

a

n

y

n

(17)

where

φ

n

=

s

1 − a

2

n+1

1 − a

2

n

(18)

and reduces to (1) when a

n

= a, a constant.

C. A Numerical Example

It is useful to make a comparison of the behavior of the

two designs (6) and (17). Consider a simple time-variation

of the parameter a

n

, which takes on the constant value

0.999 for n ≤540, and which decreases progressively to a

value of −0.999 at n = 597; it remains at −0.999 thereafter

(see Figure 2, at top). The input is a sinusoid at 1000 Hz,

of amplitude 1; the sample rate is taken to be 44 100 Hz.

The output of the ﬁlters deﬁned by (6) and (17) are plot-

ted in the middle and bottom panels, respectively, of Figure

2. Notice that in the case of the time-invariant design, a

large transient oﬀset results; it occurs even though the pa-

rameter undergoes a gradual transition over a number of

samples. It is important to add that for ﬁlter coeﬃcients

a

n

varying near 1 or -1, the factor φ

n

used in the wave dig-

ital design (17) can also exhibit strong variation, leading,

in this case, to the ”kink” observed in the output at bot-

tom in Figure 2. Further examination of the eﬀect of the

smoothness of the coeﬃcient transition on output smooth-

ness is necessary, but cannot be discussed in detail in this

short article; neither is there space to discuss the diﬀerence

in terms of audibility between the two responses, but we

do reiterate that stability is the goal here, not necessarily

transient suppression.

III. Second-order Allpass Filters

A second-order allpass ﬁlter is deﬁned by

y

n+1

+ ay

n

+ by

n−1

= α (bx

n+1

+ ax

n

+ x

n−1

) (19)

If the coeﬃcients a and b satisfy

|a| − 1 < b < 1 (20)

then the ﬁlter is stable.

Keeping in mind the discussion in the previous section,

it should be clear that an appropriate generalized structure

for the second-order allpass will have the form of a wave

digital one-port, as shown in Figure 3. Here, we again read

the input and output sequences x

n

and y

n

from the free

port of a three-port adaptor (again, either series or par-

allel). The other two ports of the adaptor are terminated

on a wave digital inductor, and a wave digital capacitor.

100 200 300 400 500 600 700 800 900 1000

−2

0

2

100 200 300 400 500 600 700 800 900 1000

−2

0

2

100 200 300 400 500 600 700 800 900 1000

−2

0

2

n

n

n

y

n

y

n

a

n

Fig. 2. Top, parameter a

n

, in a ﬁrst-order design, plotted against

n, the time index. Middle, output y

n

of ﬁlter deﬁned by (6), and

bottom, of ﬁlter deﬁned by (17).

y

n

x

n

w

2,n

v

2,n

w

1,n

v

1,n

−1

M

M

1,n

M

2,n

T

T

Parallel

Series

or

Fig. 3. Wave digital one-port, corresponding to a generalization of

a second-order allpass section.

Again, the sequences M

1,n

and M

2,n

, always strictly posi-

tive, are to be interpreted as port resistances (for a series

adaptor) and as port conductances (for a parallel adaptor).

The input and output waves at the two ports are as indi-

cated in the ﬁgure. In this case, the scattering equations

can be written as

y

n

v

1,n

v

2,n

= α

I − q

n

q

T

n

x

n

w

1,n

w

2,n

(21)

where α = 1 for a series connection, and α = −1 for a

parallel connection, and where the vector q

n

is deﬁned by

q

n

= [

√

2M,

p

2M

1,n

,

p

2M

2,n

]

T

/

p

M + M

1,n

+ M

2,n

In addition, we have

w

1,n

= v

1,n−1

w

2,n

= −v

2,n−1

(22)

From orthogonality of the scattering operation (21), and

using (22), it is again possible to show that the one-port is

norm-preserving, i.e.,

ky

.

k = kx

.

k

JOURNAL OF L

A

T

E

X CLASS FILES, VOL. 1, NO. 11, NOVEMBER 2002 4

It is also possible, through tedious algebraic manipulation,

to derive a two-step recursion involving only x

n

and y

n

;

this form is rather complex. In terms of the scattering

parameters

γ

1,n

=

r

M

1,n

M

γ

2,n

=

r

M

2,n

M

(23)

and deﬁning the auxiliary parameters

d

1,n

=

(1 + γ

2

1,n

+ γ

2

2,n

)γ

1,n−1

2α(γ

2,n

γ

1,n−1

+ γ

2,n−1

γ

1,n

)

d

2,n

=

(−1 + γ

2

1,n−1

+ γ

2

2,n−1

)γ

1,n

2(γ

2,n

γ

1,n−1

+ γ

2,n−1

γ

1,n

)

c

1,n

=

(1 − γ

2

1,n

− γ

2

2,n

)γ

1,n−1

2(γ

2,n

γ

1,n−1

+ γ

2,n−1

γ

1,n

)

c

2,n

=

(−1 − γ

2

1,n−1

− γ

2

2,n−1

)γ

1,n

2α(γ

2,n

γ

1,n−1

+ γ

2,n−1

γ

1,n

)

the recursion may be written as

y

n+1

+

d

2,n+1

+ αd

1,n

− γ

2,n

d

1,n+1

y

n

+ α

d

2,n

d

1,n+1

y

n−1

=

−

c

1,n+1

d

1,n+1

x

n+1

−

c

2,n+1

+ αc

1,n

+ αγ

2,n

d

1,n+1

x

n

−α

c

2,n

d

1,n+1

x

n−1

If M

1,n

and M

2,n

are constant, it reduces to the form

(19), with

a = 2α

M

1

− M

2

M + M

1

+ M

2

b =

−M + M

1

+ M

2

M + M

1

+ M

2

a and b, deﬁned as above in terms of the positive quantities

M, M

1

and M

2

automatically satisfy (20), as expected.

IV. Conclusions

We have discussed here some simple generalizations of

digital allpass ﬁlters to the time-varying case, in particular

ﬁrst- and second-order sections. While in many situations

(i.e., when time-variation of parameters is slow), simple de-

signs such as (6) and (19) may be used directly, we have

shown here a means of extending these designs such that

the important energy-preserving property is retained. (We

make no claims, however, about the eﬀects on the output in

terms of transients and other audible distortion.) Though

these designs are wave digital in origin, they may be imple-

mented as recursions just as standard ﬁlters are, though,

for simplicity, a wave digital realization may be desirable,

and does not lead to a signiﬁcant increase in memory or

computational requirements. These designs would appear

to be of general applicability throughout all areas of audio

signal processing.

Acknowledgment

The author would like to thank Jyri Pakarinen, Matti

Karjalainen, Cumhur Erkut and Vesa V¨alim¨aki of the

Acoustics Laboratory at the Helsinki University of Tech-

nology for many useful discussions on this topic.

References

[1] P. Regalia, S. Mitra, and P. Vaidyanathan, “The digital all-pass

ﬁlter: A versatile signal-processing building block,” Proceedings

of the IEEE, vol. 76, no. 1, pp. 19–37, January 1988.

[2] J. Dattorro, “Eﬀect design part 2: Delay line modulation and

chorus,” Journal of the Audio Engineering Society, vol. 45,

no. 10, pp. 764–788, 1997.

[3] V. V¨alim¨aki, T. Tolonen, and M. Karjalainen, “Plucked-string

synthesis algorithms with tension modulation nonlinearity,” in

Proceedings of the IEEE International Conference on Acoustics,

Speech, and Signal Processing, vol. 2, Phoenix, Arizona, USA,

March 1999, pp. 977–980.

[4] C. Erkut, “Aspects in analysis and model-based sound synthesis

of plucked string instruments,” Ph.D. dissertation, Laboratory

of Acoustics and Audio Signal Processing, Helsinki University of

Technology, 2002.

[5] T. Tolonen, V. V¨alim¨aki, and M. Karjalainen, “Modelling of ten-

sion modulation nonlinearity in plucked strings,” IEEE Transac-

tions in Speech and Audio Processing, vol. 8, pp. 300–310, May

2000.

[6] G. P. Scavone, “An acoustic analysis of single-reed woodwind

instruments with an emphasis on design and performance issues

and digital waveguide techniques,” Ph.D. dissertation, Depart-

ment of Music, Stanford University, 1997.

[7] M. van Walstijn and G. Scavone, “The wave digital tonehole

model,” in Proceedings of the International Computer Music

Conference, Berlin, Germany, August 2000, pp. 465–468.

[8] J. O. Smith III, “Music applications of digital waveguides,” Cen-

ter for Computer Research in Music and Acoustics (CCRMA),

Department of Music, Stanford University, Tech. Rep. STAN-

M-39, 1987.

[9] ——, Physical Audio Signal Procesing. Stanford, CA: draft

version, 2004.

[10] A. Fettweis, “Digital ﬁlters related to classical structures,” AEU:

Archive f¨ur Elektronik und

¨

Ubertragungstechnik, vol. 25, pp. 79–

89, February 1971, (See also U.S. Patent 3,967,099, 1976, now

expired.).

[11] ——, “Wave digital ﬁlters: Theory and practice,” Proceedings

of the IEEE, vol. 74, no. 2, pp. 270–327, February 1986.

[12] H. Strube, “Time-varying wave digital ﬁlters for modelling ana-

log systems,” IEEE Transactions on Acoustics, Speech, and Sig-

nal Processing, vol. ASSP-30, no. 6, pp. 864–8, Dec. 1982.

[13] ——, “Time-varying wave digital ﬁlters and vocal-tract models,”

in Proceedings of the IEEE International Conference on Acous-

tics, Speech, and Signal Processing, vol. 2, Paris, France, 3–5

May 1982, pp. 923–6.

[14] A. H. Gray, Jr. and J. D. Markel, “A normalized digital ﬁlter

structure,” IEEE Transactions on Acoustics, Speech, and Signal

Processing, vol. ASSP-23, pp. 268–277, June 1975.

[15] J. Mourjopolis, E. Kyriakis-Bitzaros, and C. Goutis, “Theory

and real-time implementation of time-varying digital audio ﬁl-

ters,” Journal of the Audio Engineering Society, vol. 38, no. 7.

[16] L. Zetterberg and Q. Zhang, “Elimination of transients in adap-

tive ﬁlters with applications to speech coding,” Signal Process-

ing, vol. 15, no. 4, pp. 419–428, 1988.

[17] V. V¨alim¨aki, T. Tolonen, and T. Laakso, “Suppression of tran-

sients in time-varying recursive ﬁlters for audio signals,” in Pro-

ceedings of the IEEE International Conference on Acoustics,

Speech, and Signal Processing, vol. 6, Seattle, Washington, USA,

May 1998, pp. 3569–3572.

Author Information Stefan Bilbao (B.A.,

Harvard, 1992, MSc., Stanford, 1996, PhD.,

Stanford, 2001) was born in Montreal, Canada

in 1969. He is currently a lecturer at the Sonic

Arts Research Centre, and the Department of

Music, at the Queen’s University, Belfast.