Está en la página 1de 29

MUS424:

Signal Processing Techniques for Digital Audio Effects Handout #22


Jonathan Abel, David Berners May 18, 2004

Lecture Notes 12
Lecture #14: May 18, 2004

Peaking and Shelving Filter Properties

Shelf Filter Specification


A shelf filter h() takes on a gain of `0 at DC, a gain
1
of ` at high frequencies, and a gain of (`0 ` ) 2 at
a transition frequency .
A low shelf filter has the high-frequency gain ` fixed
at one, with `0 free to vary.
In a high shelf filter, the high-frequency gain ` is
varied with the DC gain `0 fixed at one.
2 MUS424: Handout #22

First-Order Shelf Filter Analog Prototype


Consider the following first-order analog prototype
filter,
` s/ + `0
h(s) = .
s/ + 1
Note that the analog prototype filter takes on the
desired DC and high-frequency gains,
h( = 0) = `0 , h( ) = ` ,
with the factor controlling the transition frequency.
The analog prototype filter is designed to have a
transition frequency of one. Setting |h(j 1)|2 =
`0 ` , the factor may be specified.
2 2 2
` / + `
|h(j 1)|2 = `0 ` = 2 0
,
1/ + 1
which implies
12
`
= .
`0
Substituting into the expression for h(s), we have
1
1 s + (`0/` ) 2
h(s) = (`0 ` )
2
1 .
(`0/` ) s + 1
2
MUS424: Handout #22 3

First-Order Shelf Filter Analog Prototype Properties

The analog prototype shelf filter has transfer function


1
1 s + (`0/` ) 2
h(s) = (`0 ` ) 2
1 .
(`0/` ) s + 12

It has a real pole and real zero at reciprical frequen-


cies about the transition frequency s = j 1,
1 1
sp = (` /`0) 2 , sz = (`0/` ) 2 .
Note that on a dB scale the normalized analog shelf
filter is antisymmetric in log s about the transition
frequency,
1
1/s + (`0/` ) 2
h(1/s) 1
(`0/` ) 2 /s + 1
1
1 + (`0 /` ) 2 s
= 1 1/h(s).
(`0/` ) 2 + s
4 MUS424: Handout #22

First-Order Digital Shelf Filter via Bilinear Transform


The digital shelf filter is formed via bilinear transform
on the analog prototype,
2 1 z 1
h(z) = h(s(z)), s= .
T 1 + z 1
We have
1 s + 1/ 1
h(s) = (`0` ) 2 , = (` /`0) 2 ,
s/ + 1
and,
1(1 z 1 ) + T2 (1 + z 1)
h(z) = (`0` ) 2
1 T 1
,
(1 z ) + 2 (1 + z )
1 ( T2 + ) + ( T2 )z 1
= (`0` ) 2 T T 1
,
( 2 + 1) + ( 2 1)z
" #
1T /2 1
1 + 2 T 1 1+T /2
z
= (`0` ) 2 T
.
1 + 2 1 1T /2
z 1
1+T /2

Note that the pole at and zero at 1/ have


been transformed according to the bilinear transform.
MUS424: Handout #22 5

Selecting T
The sampling period T is chosen to put the tran-
sition frequency of the analog prototype, = 1, at
the desired frequency .
Evaluating the bilinear transform on the unit circle,
z 1 = ej ,
2 1 z 1 2 1 ej
s = = ,
T 1 + z 1 T 1 + ej
2 ej/2 ej/2 2 j sin(/2)
= j/2 = ,
T e + ej/2 T cos(/2)

we see that the frequency on the unit circle corre-


sponds to the frequency
2
= tan(/2)
T
on the s-plane imaginary axis. (Note that for small
frequencies || 1, tan(/2) /2, and T1 .
To map the analog prototype filter transition fre-
quency of 1 to the desired transition frequency ,
we set
T
= tan(/2).
2
6 MUS424: Handout #22

Example Shelf Filters


second-order shelf filter transfer function magnitudes, ft = 125 * 2.^[0:6]
20

15

10

0
10 -1 10 0 10 1
frequency - kHz

second-order shelf filter transfer function magnitudes, gain = [2:2:20]


20

15

10

0
10 -1 10 0 10 1
frequency - kHz
MUS424: Handout #22 7

Peak Filter Specification


A peak (or notch) filter p() takes on a gain of 1 at
DC and high frequencies, and achieves a maximum
(or minimum) gain of ` at some point betweenthe
transition frequencies , at which the gain is `.
The frequency of the magnitude extremum is called
the center frequency, c.
8 MUS424: Handout #22

Digital Peak Filter


The second-order digital filter
b0 + b1 z 1 + b2 z 2
p(z) =
1 + a1 z 1 + a2 z 2
with coefficients given by
2Q sin c
a2 = ,
2Q + sin c
a1 = b1 = (1 + a2) cos c ,
1 1
b0 = (1 + a2 ) + (1 a2 )`,
2 2
1 1
b2 = (1 + a2 ) (1 a2 )`,
2 2
implements a peak (or notch) filter with maximum (or minimum) gain ` at a
center frequency c between the
specified transition frequencies , at which
the filter takes on magnitude `. The center frequency c and the inverse
bandwidth Q may be written in terms of the transition frequencies and
dB peak gain ,
n 2 12 o
c = acos sign{} 1 ,
1 + cos cos +
=
cos + cos +
1
1 ` sin2 c (cos + cos + ) 2
Q = .
2 2 cos c cos cos +
In the case that + + = , we have

c = /2,

` 1
Q = | cot |, = ( + ).
2 2
MUS424: Handout #22 9

Example Peak Filters


peak filter transfer function magnitudes, ft = 125 * 2.^[0:6]
20

15

10

0
10 -1 10 0 10 1
frequency - kHz

peak filter transfer function magnitudes, gain = [2:2:20]


20

15

10

0
10 -1 10 0 10 1
frequency - kHz
10 MUS424: Handout #22

Graphic Equalizer

graphic equalizer shelf and peak filters


6

0
10 -1 10 0 10 1
frequency - kHz

A graphic equalizer is implemented as a cascade of


peak and shelf filters having a prioi specified band-
widths and user-controlled gains.
MUS424: Handout #22 11

Graphic Equalizer Behavior


traditional graphic equalizer with controls set to [0 0 0 5 5 0 0 0] dB
10

0
10 -1 10 0 10 1
frequency - kHz

By adjusting the gains of the peak and shelf filters


in the cascade, a wide variety of transfer function
magnitudes may be produced.
Although the idea is that the transfer function magni-
tude should smoothly interpolate the specified gains,
it doesnt always work out that way.
12 MUS424: Handout #22

Graphic Equalizer Behavior


traditional graphic equalizer with controls set to 5*ones(1,8) dB
10

0
10 -1 10 0 10 1
frequency - kHz

Contributions from adjacent bands cause the filter to


overshoot the desired gains.
MUS424: Handout #22 13

Graphic Equalizer Behavior


traditional graphic equalizer with narrow-band peak filters
10

0
10 -1 10 0 10 1
frequency - kHz

Traditional graphic equalizers dont smoothly inter-


polate the given gains.
Small filter bandwidths lead to rippled transfer
functions.
Large filter bandwidths overshoot desired gains.
14 MUS424: Handout #22

Alternative Gain Computation


novel graphic equalizer
10

0
10 -1 10 0 10 1
frequency - kHz

The idea is to find a set of peak and shelf filter gains


which account for the overlap between bands, so that
the resulting peak and shelf filter cascade interpo-
lates the specified band gains.
MUS424: Handout #22 15

Peak Filter Self Similarity


peak filter transfer function magnitudes, gain = [2:2:20]
20

15

10

0
10 -1 10 0 10 1
frequency - kHz

normalized peak filter transfer function magnitudes, gain = [2:2:20]


1

0.8

0.6

0.4

0.2

0
10 -1 10 0 10 1
frequency - kHz

Peaking filters parameterized by a maximum dB gain


, achieved somewhere between transition frequen-
cies and +, at which the dB gain is /2, are
approximately self similar on a log magnitude scale.
log |p(; , )| log |p(; , )|.
16 MUS424: Handout #22

Shelf Filter Self Similarity


second-order shelf filter transfer function magnitudes, gain = [2:2:20]
20

15

10

0
10 -1 10 0 10 1
frequency - kHz

normalized shelf filter transfer function magnitudes, gain = [2:2:20]


1

0.8

0.6

0.4

0.2

0
10 -1 10 0 10 1
frequency - kHz

Low shelf filters specified by a low-frequency dB gain


, a dB gain /2 at a transition frequency , and
a high-frequency gain of one are also approximately
self similar on a log magnitude scale.
log |h(; , )| log |h(; , )|.
MUS424: Handout #22 17

Filter Design Approach


Consider a cascade g(; ) of K peak and shelf fil-
ters having gains and k , k = 1, . . . , K and transi-
tion frequencies k , k = 1, . . . , K 1 stacked in the
column ,
g(; ) = h(; 1, 1 ) h(; K , K1)
K1
Y
p(; k , k1, k ).
k=2

Because of the self similarity property, the dB mag-


nitude of the cascade, denoted by (; ),
def
(; ) = 20 log 10{g(; )},
= (; 1, 1) + (; K , K1) +
K1
X
(; k , k1, k ),
k=2

is approximately linear in the filter gains,


(; ) 1 (; 1.0, 1 ) + K (; 1.0, K1) +
K1
X
k (; 1.0, k1 , k ).
k=2
18 MUS424: Handout #22

Filter Design Approach


At a particular frequency i, we have

(i; ) 1(i ) 2(i ) K1(i) K (i) ,
where is the stack of dB band gains,
>
= 1 K ,
and where k (i ) and (i ) are the transfer function
dB magnitudes of shelf and peak filters with speci-
fied transition frequencies and 1.0 dB nominal gains,
evaluated at i ,
k (i) = 20 log 10{h(i; 1.0dB, k )}
and
(i) = 20 log 10{p(i; 1.0dB, k1, k )}.
Stacking instances of (; ) evaluated at a set of
frequencies i to form the column , we have
B,

B = 1 2 K1 K ,
where k and k are columns of dB magnitudes
evaluated at i of shelf and peak filters having gains
of 1.0 dB and specified transition frequencies.
MUS424: Handout #22 19

Graphic Equalizer Design


The self similarity of second-order peaking and shelv-
ing filters leads to an approximate linear relationship
between the dB filter gains and the dB gain of the
cascade,
B,
Therefore, given a set of shelf and peak filters having
specified transition frequencies, and positive definite
weighting matrix W , the gains
= (B >W B)1B >W

will approximately minimize the weighted square dif-
ference between a desired dB magnitude response
and the shelf and peak filter cascade dB magnitude
at frequencies i, .
For a graphic equalizer with K 1 fixed band edges,
the frequencies i can be chosen as the K band
centers, and the gains simply computed as the
control gains scaled by the basis inverse,
= B 1.

20 MUS424: Handout #22

Graphic Equalizer Design Example


traditional and novel graphic equalizers

15

10

-5

-10

-15

10 -1 10 0 10 1
frequency - kHz

For a graphic equalizer with K 1 fixed band edges,


the frequencies i can be chosen as the K band
centers, and the gains simply computed as the
control gains scaled by the basis inverse,
= B 1.

Note that for a grphic equalizer with fixed band
edges, B 1 may be computed a priori.
To account for discrepancies in the self similarity
may be computed iteratively, forming
property,
B using the gains from the previous solution.
MUS424: Handout #22 21

Iterated Solution
graphic equalizer with iterated band gains

15

10

-5

-10

-15

10 -1 10 0 10 1
frequency - kHz

Iterative solution of the equation for the corrected


band gains can correct for discrepancies in filter self
similarity,
n+1 = B(n)1.
It seems likely that the iteration converges since the
sensitivity of the basis to changes in the gain are
small, and changes in the basis B are monotonic
with changes in the gains .
22 MUS424: Handout #22

Transfer Function Modeling


measured transfer function magnitude, selected extrema
0

-5

-10

-15

-20
10 -1 10 0 10 1
frequency - kHz

A cascade of peak and shelf filters can be fit to an


arbitrary transfer function by selecting a set of tran-
sition frequencies, and fitting the gains.
Transition frequency selection method.
Tabulate extrema or inflection point frequencies.
Pick transition frequencies as geometric means
of significant extrema or at significant inflection
points.
MUS424: Handout #22 23

Transfer Function Modeling


measured (solid) and modeled (dashed) transfer function magnitudes
0

-5

-10

-15

-20
10 -1 10 0 10 1
frequency - kHz

Band gain selection method.


Pick a dense sampling of frequencies i, say Bark
or ERB spaced.
Form basis, and compute gains,
= (B >W B)1B >W .

The resulting transfer function will not interpolate


the specified gains , but rather approximate the
desired magnitude, minimizing the weighted mean
square dB difference.
24 MUS424: Handout #22

Critical Bandwidth and Critical Band Smoothing


original and critical-band smoothed power spectra
10

-5

-10

-15

-20

-25
10 -1 10 0 10 1
frequency - kHz

When applied to broad band signals, details of a filter


smaller than a critical bandwidth are irrelevantonly
the total power matters.
MUS424: Handout #22 25

Critical Bandwidth

The Bark frequency scale divides the human hearing


range into about 25 ciritcal bands.
Frequency f in kHz and critical-band rate b in Bark
are related via the following expressions,
2 2
1
b = 10.3 log(1 + f ) ,
2
12
f = exp (b/10.3) 1 .
26 MUS424: Handout #22

Critical Bandwidth

Critical bandwidth as a function of frequency is ap-


proximately
3
w = 0.094 + 0.071f 2 .
MUS424: Handout #22 27

Critical Band Smoothing


original and smoothed power spectra
30

20

10

-10

-20
10 -1 10 0 10 1
frequency - kHz

By smoothing the filter power over bandwidths pro-


portional to critical bandwidth, filter complexity is
reduced while retaining psychoacoustically relevant
cues.
Critical-band smoothing may be done via a running
mean over frequency, or via windowing of a frequency-
warped impulse response.
28 MUS424: Handout #22

Critical Band Smoothing


original and smoothed impulse responses
7

-1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time - milliseconds

As expected, impulse responses are shortened by critical-


band smoothing.
MUS424: Handout #22 29

Filter Phase
raw, minimum phase and linear phase impulse responses
3

2.5

1.5

0.5

-0.5
0 2 4 6 8 10 12
time - milliseconds

Humans are relatively insensitive to filter phase.


A linear phase filter delays all frequency components
the same amount ,
H() = ej |H()|.
A minimum phase filter delays input energy the least
of all filters having the same magnitude response,
Xm Xm
h2min(n) h2(n), m.
n=0 n=0

También podría gustarte