Sunteți pe pagina 1din 47

PLParEQ Technical Reference

Refined Audiometrics Laboratory, LLC

February 2006

Contents
1 Introduction 2

2 Upsampled Filtering 3

3 The Importance of Dithering 5

4 The Denormal Problem 6

5 Much ado about Phase 7


5.1 What is Minimum Phase filtering? And how is it different from Phase Linear
filtering? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

6 Eight-fold Temporal Overlap Processing 8

7 Why Use Data Windowing? 9

8 What are the “Seams” between Filtered Blocks? 11

9 How is Filtering Actually Performed? 12


9.1 Frequency Warping of the Bilinear Transform . . . . . . . . . . . . . . . . . 14
9.2 2-Pole Low-Pass Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
9.3 2-Pole High-Pass Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
9.4 2-Pole Band-Pass Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
9.5 2-Pole Band-Reject Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
9.6 2-Pole All-Pass Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
9.7 2-Pole Peaking/Dipping Filters . . . . . . . . . . . . . . . . . . . . . . . . . 23
9.8 2-Pole Low-Shelf Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.9 2-Pole High-Shelf Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
9.10 1-Pole Low-Pass Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

1
9.11 1-Pole High-Pass Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
9.12 4-Pole Resonant Butterworth Low-Pass Filters . . . . . . . . . . . . . . . . 32
9.13 4-Pole Resonant Butterworth High-Pass Filters . . . . . . . . . . . . . . . . 34
9.14 6-Pole Notch Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
9.15 A-Weighting Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
9.16 B-Weighting Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
9.17 C-Weighting Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
9.18 1/F Pinking Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9.19 Tunable 1/F Low-Pass Filter . . . . . . . . . . . . . . . . . . . . . . . . . . 47
9.20 Tunable F High-Pass Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

1 Introduction

PLParEQ is the result of years of scientific research and understanding regarding the
proper treatment of sound. The goal of PLParEQ was to be the very finest possible digital
equalizer in terms of purity, precision, and accuracy. It’s uniqueness stems from a number
of carefully considered and crafted program elements:
• All computations are performed using double-precision 64-bit floating point math.
This keeps rounding and truncation errors to levels far below audible. Extreme care
has been exercised to perform order sensitive operations in the most robust manner.
High-performance scientific grade programming techniques are used throughout.
• Low sample-rate data are upsampled to higher sample-rates ahead of processing. This
preserves the shape of classic filters in the audible region of the spectrum. sample-
rates are considered low if they fall below 80 kHz.
• Upsampling of low-rate data is done with careful Sinc interpolation. This preserves
the sonic character of the sound during upsampling.
• Samples are grouped into blocks of fixed length and data windowing is applied both
on entry to, and exit from, the internal processing. The Quality Level setting directly
determines the size of these blocks. Dual windowing diminishes the artifacts intro-
duced by block edge effects - the so-called “Temporal Aliasing”. Temporal Aliasing
is not the same as spectral aliasing with which you may already be familiar. We’ll
have more to say about this later on.
• Each block is processed and then overlapped with previous blocks using a stride of
1/8th of a block size. This helps to smooth out the block edge effects even further,
driving our intermodulation distortion products (IMD) to well below audible levels.

2
• After processing the conversion back to 32-bit floating-point data format, and down-
sampling, is performed with the aid of 2-bit TPDF white-noise dither. This is prov-
ably the best approach when additional processing may occur on the output signal.
• Adding to these careful mathematical treatments of your sound, PLParEQ also allows
you to route the filtering in many useful ways. For example, some filters can be
applied equally or separately to Left and Right channels, while others can be applied
to Middle, or Side, or combinations of these. Monitoring options, except for normal
stereo mode, offer the same selection to both ears as a mono signal to avoid head
jarring effects while tuning the filters.
• Equalization can operate at any sample-rate, whose upper limit is determined solely
by the ability of your computer to process in real time, as well as other considerations
regarding narrowband filtering accuracy. We will have more to say about accuracy
in a little while.
• Each filter can be individually selected to perform either traditional, phase-warping1 ,
processing, or else phase-linear filtering. Phase-warping filtering is what analog equal-
izers, as well as most other digital equalizers, provide.
Phase-linear filtering is provided by running your signal through these same phase-warping
filters in both the forward-time direction and again in time-reversed order. Doing this
unwinds the phase warp produced by the forward-time processing alone. Phase is linearized,
and the amplitude envelope is applied twice. Care is taken during phase linear processing
to have the double application of filters provide nearly the same filter width as a single
pass through them. This is achieved by modifying the requested filter Q in phase-linear
mode.

2 Upsampled Filtering

For low sample-rate data (i.e., for sample-rates below 80 kHz) PLParEQ resamples the
data to twice its sample-rate before performing filtering. Why do this? What are its
effects?
In Figure 1 and Figure 2 we show graphs of low-pass filters tuned to 10 kHz. The filters are
supposed to be identical in the two graphs. They are expected to exhibit a high-frequency
roll-off of -12 dB/octave. Figure 1 shows the effects of computing the filtering with a
sample-rate of 48 kHz. Figure 2 shows the case for sample-rate 96 kHz.
1
Some people use the terminology as marketing hype, calling these phase-warping filters “Minimum
Phase” filters. But unless you take explicit measures to provide otherwise, all filters are naturally minimum
phase filters. So this is just empty jargon being bandied about to try to impress you.

3
Figure 1: Low-pass filtering at a sample rate of 48 kHz.

Figure 2: Low-pass filtering at a sample rate of 96 kHz.

4
With the lower sample rate our 10 kHz is getting relatively close to the Nyquist frequency
at half the sample-rate, or 24 kHz. What happens in that case is that digital filtering tries
to squeeze the entire behavior of the filter, all the way to infinite frequencies, into that
range from 0 Hz to the Nyquist frequency. And this is starting to get crowded at 10 kHz.
It gets even worse as you tune higher in frequency.
When using the higher sample rate, the roll-off is more gentle because we have more room
from 10 kHz up to its Nyquist frequency of 48 kHz. So the shape of filtering is better
preserved by processing data at higher sample-rates.

3 The Importance of Dithering

Audio processing damages sound. Bob Katz does a wonderful job of explaining this in his
book, “Mastering Audio”. Whenever one alters the data format, taking it to less precise
representations, it is very important to consider how to deal with the information being
chopped off and thrown away.
There are two methods commonly practiced in computing, i.e., truncation and rounding.
Both of these do horrible things to the results. A better way has been recognized for quite
some time now, and that is dithering. Dithering is the practice of adding some amount
of random data, just below the threshold of rounding or truncation, so that by a process
known as stochastic resonance, one can actually preserve some of the detail hidden below
the threshold.
Nearly every high-end digital processor provides dithering when changing data formats.
And the kind of dither used depends heavily on how imprecise the target format is. For
example, when chopping back to 16-bit audio, the noise floor in that data format is high
enough that one must take care to use spectrally shaped dither. This pushes most of the
randomness into spectral regions where our hearing is insensitive. Higher precision target
formats, such as 24-bit audio, have less need of spectrally shaped dither noise.
Another aspect of dithering has to do with the probability density function of the random
noise used for dithering. This is independent of spectral shaping, and deals instead with
how often higher range random values are added, as compared to smaller values. The best
additive dither that provides a minimum noise level, independent of the input signal, is a
2-bit Triangular PDF (TPDF).
PLParEQ utilizes a 2-bit TPDF white dither, meaning that it is spectrally unshaped. This
is the best approach when further processing may be performed on the result.
Note that the dither used in PLParEQ has nothing to do with the traditional dither applied
ahead of 16-bit CD recording. Our dither is utilized internally to convert from high-

5
precision 52-bit mantissas back down to 24-bit mantissas, unless PLParEQ is operating
entirely in 64-bit mode. Some DAW programs, such as Sonar, permit the processing to be
performed entirely in 64-bit mode, in which case no dithering is performed.

4 The Denormal Problem

Today’s high-end computer chips, the Pentiums, Athlons, Opterons, and PowerPC, all
suffer from something called the Denormal Problem. In an effort to satisfy numerical
analysts the chip manufacturers try very hard to preserve information and abide by the
IEEE-754 Floating Point Specification. Doing so makes it possible to directly compare the
results of computations performed on different computers. But in order to abide by this
standard the cost can become very high in runtime performance.
In signal processing we are most concerned about speed of computation, with the realization
that for a sufficiently large word size, our errors will be inconsequential. It would be nice
if we could throw a switch and disable the exactness of compliance with IEEE-754 but we
cannot2 .
As numbers grow ever smaller, they reach a point where they cannot be represented as
normalized floating point numbers in the floating point registers. When this happens
they are known as denormal numbers. Not yet quite zero, but smaller than the smallest
normalized number. At this point the speed of arithmetic slows enormously and you see
the CPU meter rise through the roof.
We avoid this problem by using another TPDF dither on the way in. Just ahead of
conversion from VST standard 24-bit format to our double-precision 52-bit format, we add
a 2-bit TPDF dither with amplitude -208 dBFS. This is very small and imperceptible,
but large enough to avoid the production of denormal numbers in our internal calculations
during filtering.
Some VST hosts also provide denormal dither on the samples so that plug-ins that have not
exercised caution against the production of denormal numbers will continue to run quickly.
PLParEQ takes the defensive stance of always providing its own denormal dithering so
that it runs as quickly as possible, regardless of VST host capabilities.
Our DSP computing technology uses every trick in the book to boost speed. PLParEQ
is very demanding of runtime performance. The dithering of input and output data takes
2
The most recent versions of the Intel Pentium 4 do permit throwing switches for SSE based computations
whereby denormal operands will be seen as zero (DAZ), and denormal results will be flushed to zero (FTZ).
But older legacy computers cannot do this, and even on the most recent Pentium 4 computers these switches
do not affect FPU based computing.

6
very little time, and for Pentium processors, adding denormal dither keeps its runtime
performance very high.

5 Much ado about Phase

So much is made of phase effects from filtering. Why? What does it really mean to you?
And what about Minimum Phase versus Linear Phase?
Conventional analog filters achieve their filtering effects precisely because they modify the
phase relationships among the various frequency components of your audio. Without phase
warping there could be no such thing as filtering. Digital signal processing can mimic this
behavior, but it also offers some processing techniques that cannot be accomplished in the
analog domain.
The effect of phase warping is to disperse the frequency components to some extent. The
more rapidly the phase changes with frequency, i.e., the more strongly phase is warped at
some frequencies compared to others, the more dispersion you get. Dispersion is a selective
smearing in time among the frequency components of your sound. Sharp percussive attacks
can be smeared out and might even turn into thuds.
Quite often, the dispersion produced by phase warping is so mild that you don’t even notice
it. But it will affect the sparkle and sharpness of sound if the phase warping becomes too
extreme near some frequencies. In general, the more narrowband your filtering becomes,
the more extreme the phase warping in the vicinity of the filtered frequencies, and the
more severe the temporal dispersion of adjacent frequency components.
Phase linear filtering is a technique offered only in the digital domain to apply frequency
amplitude modifications without any phase warping or time dispersion of frequency com-
ponents. The only way to accomplish this is to violate causality – i.e., grab some sound
samples, and analyze them in retrospect. It is impossible to do real-time causal processing
that is also phase linear.
PLParEQ does this acausal processing by grouping the input sound samples into processing
blocks and analyzing the contents of each block looking both in the forward time direction
and in the time reversed direction. It reassembles those groups after processing and tries
very hard to stitch together different blocks so that you can’t detect any seams. In that
way it all sounds like real-time phase linear processing. But in order to accomplish this, the
computer is working up a real sweat and there is a finite throughput delay introduced.

7
5.1 What is Minimum Phase filtering? And how is it different from Phase
Linear filtering?

Minimum phase filtering is a term of mathematics that has unfortunately found its way
into marketing hype. Minimum phase filtering means that all the poles and zeros of the
digital filter reside within the unit circle of the Z-domain.
All poles must already reside within that unit circle or else you will have an oscillator on
your hands. Zeros may or may not reside within the unit circle. If they do, then you have
a minimum phase filter. If they do not, then what you have is a minimum phase filter
cascaded with an all-pass filter. The extra all-pass filter does nothing more than add more
phase warp to the results and has no effect on the amplitudes of the various frequency
components.
But unless you are perverse or incompetent, all mathematically simplified digital filters
are also naturally minimum phase filters. You have to go out of your way to produce a
non-minimum-phase filter. So by saying your filters are minimum phase filters, you really
haven’t said anything of importance, except to declare that you are at least semi-competent
in filter design.
But saying that you have minimum phase filters is not the same thing as saying you have
phase-linear filters. Phase linear filters are special in that they have no poles within the
unit circle nor anywhere else, in the Z-domain. Phase linearity imparts a constant time
delay to all component frequencies in your sound. The delay is non-zero to be sure, but all
of the frequency components are delayed together and hence are not dispersed.
Most phase linear filters are also minimum phase filters. But so what? The converse is not
necessarily true, and normally is not. Minimum phase also means that the group delay
through the filter is as short as possible.
So whenever you hear someone saying that they have minimum phase filters you should
hear for yourself that they have phase warping and dispersive filters. If they had true
linear-phase filtering then they would be sure to brag about that aspect.
PLParEQ allows you to operate every one of its filters independently as either traditional
minimum-phase phase-warping filters, or as phase-linear filters.

6 Eight-fold Temporal Overlap Processing

Temporal overlap processing is the technique used to stitch together each block of filtered
data with all the previous blocks, in such a way as to minimize the “seam” that might
appear between blocks.

8
This is a standard technique in digital signal processing. Most often the degree of overlap
is only 50% meaning that each block overlaps by half with the previous block. That is the
minimum acceptable overlap. But to drive down the sonic artifacts of inter-block seams
we use 8-fold overlap, or 87.5% overlap.
Each incoming data block, whose size is directly specified by your chosen Quality Level, is
windowed. This is another common practice in digital signal processing. We use a special
window, shown in Figure 4, that has the property that if applied twice in succession,
with no other modifications to the data inside the windowed data block, then overlap-add
processing produces a perfect reconstruction of the original data, regardless of windowed
block overlap factor – as long as you have at least 50% overlap.
Figure 3 illustrates the use of 8-fold temporal overlap processing, with the current input
block highlighted in red. The windows shown in that figure are the simpler Hann window
which does perfect reconstruction if applied only once.

Figure 3: Successive Hann windows of data with 8-fold temporal overlap.

7 Why Use Data Windowing?

If all you were going to do is conventional phase-warped filtering, there would be no need of
data windowing, nor of temporal overlap processing. But performing phase-linear filtering
imparts edge effects to each block because we are reversing time only for the rather short

9
duration of each block and not over the long term. Processing the sound in short blocks
makes it possible to perform time-reversed processing in “real-time”, but only approxi-
mately.
Using a data window ameliorates these edge effects to some degree, as the data at the edges
are weighted toward zero amplitude as seen in Figure 4. Overlap-add processing further
smears out these edge effects, driving them downward to imperceptible levels.

π
Figure 4: Data Window: W (x, N ) = sin( π2 sin2 (πx + 2N )). This window shape is more
complex than the Hann windows shown in Figure 3. A double application of this window
shape provides perfect reconstruction during overlap processing. That is not true for the
simpler Hann window.

But data windowing also produces the side effect of smearing the power in adjacent fre-
quency bins, making your filters somewhat less precise. We do this anyway because with
discrete time processing perfect filtering is possible only at those frequencies that are exact
multiples of the sample-rate divided by the number of samples per block, Fk = kFs /N .
All other frequencies produce “filter-leakage” effects which are far worse than any power
smearing due to data windowing.
For example, at 96 kHz sample-rate with a block size of 512 samples (QL = 1), you can only
achieve perfect filtering at frequencies of 1 ∗ 96/512 kHz, 2 ∗ 96/512 kHz, 3 ∗ 96/512 kHz, . . . ,
and so on. For all other frequencies between these exact frequencies, you get considerably
worse filtering performance unless you take care to use data windowing.
The trade-off here is one of slightly less than perfect filtering in return for more accurate fil-

10
ter performance at off-frequencies. You can always improve the overall accuracy of filtering
by increasing your block size, or Quality Level.

8 What are the “Seams” between Filtered Blocks?

Seams exist between filtered data blocks whenever you use phase-linear processing. Tra-
ditional phase-warped filtering does not produce any seams and so the 8-fold overlap-add
processing with windowing is redundant - except in the case where low sample-rate data
are upsampled before filtering. That upsampling also introduces seams between successive
blocks.
Upsampling audio means that we have to invent samples that go between actual incoming
audio samples. There are many ways to invent these additional samples. But one would
like to invent them in such a way as to not disrupt the existing spectrum of sound. There
is only one way to do this in theory, and all other approaches fail in this regard. That one
way is known as Sinc interpolation.


X sin(π(tFs − n))
y(t) = yn
n =−∞
π(tFs − n)

sin(πx)
Its name comes from the definition of the Sinc function: sinc(x) = πx .

Sinc interpolation has a spectrally neutral effect on your sound. Linear, quadratic, Her-
mite, and all other interpolation techniques, produce some degree of erosion in the higher
frequencies. Sinc interpolation does not.
But Sinc interpolation is a very expensive operation in digital signal processing. Perfect
Sinc interpolation is impossible to perform in practice since it extends over all samples in
time. We get as close as we can to perfect Sinc interpolation, but even the slight remaining
discrepancies produce sonic seams between adjacent blocks.
Time reversed processing with each block, optionally coupled with imperfect upsampling,
produces artifacts known as temporal aliasing – which simply means that information from
the leading edge of a block gets mixed, in time, with information in the trailing edge, and
vice versa. This tends to smear out the sound over the duration of one block.
High-grade overlap-add processing of properly windowed data can reduce these artifacts
but they are still present. At Quality Level 5 and higher we have measured these IMD
products as lower than 150 dB below peak signal levels. For all practical purposes, then,
they are invisible.

11
9 How is Filtering Actually Performed?

There are several ways to perform phase linear filtering. One can use FFT analysis which
is the most common method among others offering phase linear filtering. You could use
FIR filtering, which is very expensive in terms of computing performance. You could use
convolutional filtering, which is similar to the X-Technology offered by our PLParEQX
series.
But the way we do it in PLParEQ, which seems to give the highest possible quality of
sound, is to use IIR filters in the time forward direction, then again in the time reversed
direction. Doing this unwinds the phase warping imparted by IIR filters used in only one
direction. But it also imparts the amplitude characteristics twice. So where an IIR filter in
one direction would give a 3 dB cut in amplitude, using it twice produces a 6 dB cut.
These IIR filters are the same ones used by all the classic digital EQ’s and those claiming
minimum-phase filtering. The filters were derived from their analog counterparts by means
of a bilinear transform, s → k z−1
z+1 , with the adjustable constant, k, chosen so that the
performance at the cutoff frequency of each filter is identical to that of the analog filter at
that same frequency. In general, k = 1/ tan(ωc /2) [c.f., Table 1 below]. There are many
other methods for deriving digital IIR filters from analog implementations, but this is the
most common method.
Each pass through the filters is an IIR operation, meaning that the filters really do have
poles and zeros in the Z-domain. But the net effect of a forward and reverse pass through
them is such as to remove the evidence of any poles in the Z-domain, leaving only zeros
located in the unit circle.
Alternatively, you could view the effects as computing a high-degree polynomial in the
complex variable z, equivalent to using an auto-regressive technique with both poles and
zeros. Where filters have high Q, the poles are located very close to the unit circle in
the Z-domain, and using poles to compute the effects is more economical than using a
high-degree all-zero polynomial, for similar filtering precision. The equivalent polynomial
would be densely sampled with zeros in the vicinity of these poles.
In the following sections, we show you exactly what these filters look like in the Z-domain.
The equations will refer to the quantities listed in Table 1.
In the digital domain, all filters are composed of biquadratic terms and factors, where each
biquad has the form:

b0 + b1 z −1 + b2 z −2
H(z) =
a0 + a1 z −1 + a2 z −2

12
Fs sampling frequency
Fc -3 dB corner frequency (0 < Fc < Fs /2)
GdB dB gain, used only for peaking and shelving filters
Q filter Q-factor
ωc normalized radian corner frequency = 2πFFs ,
c
(0 < ωc < π)

A= 10GdB /20 used for peaking and shelving filters
α = sin2Qωc

Table 1: Quantities referred to in the filter equations.

The roots of the numerator polynomial become the zeros of the filter transfer function,
while the roots of the denominator become its poles.
Filter results are computed as the direct form recursion of this transfer function:

yn = (b0 xn + b1 xn−1 + b2 xn−2 − a1 yn−1 − a2 yn−2 )/a0

In what follows we also show the equivalent analog domain filter, expressed in terms of
normalized complex radian frequency s = iF/Fc .
For the case of phase-linear filtering using blocked IIR data processing, one can show that
filters computed by the time-forward, followed by time-reversed, application of these IIR
filters are equivalent to filters computed by means of symmetric FIR filtering of length
equal to the data blocking size. But by using two passes of IIR filtering we achieve a
massive economization of this process.
Each IIR biquad requires 5 multiply and 4 addition operations. Applied twice, this rep-
resents 18 arithmetic operations per resultant data point. Data windowing requires two
more multiplies per resultant data point, for a total count of 20 operations.
An FIR filtering would require N multiply and (N − 1) additions for block size N . At
Quality level 5, where the block size is 8192 data points, such an FIR filter would require
more than 16,000 arithmetic operations for equivalent results. Hence the resulting speedup
is around 800 to 1.
Similarly, the arithmetic errors introduced by rounding intermediate results would be ex-
pected to grow roughly as the square-root of the number of arithmetic operations, making
our double-pass IIR method capable of approximately 28 times smaller accumulated round-
ing errors, or about 5 bits of precision improvement.
You can see from this argument why it would be both impractical and horribly imprecise

13
to use FIR filtering to achieve these same results. Upsampling low sample-rate audio prior
to processing would more than double the number of required arithmetic operations3 , and
erode the precision by another bit through accumulated roundoff errors.
The use of FFT algorithms to produce filtering by way of fast convolution is another
possibility, but in order to achieve results free of temporal aliasing one would need to use
an FFT block size at least twice the size of the data block size.
Each filtering operation would require one forward-FFT, for O(2N log(2N )) operations,
followed by 4N multiplies (2N of real × real + real × imaginary), followed by an inverse-
FFT for another O(2N log(2N )) operations. Data windowing adds another 2N operations.
The total of all of these operations produces N output samples. The net cost per output
sample is therefore 10 + 4 log2 N instruction cycles.
For a block size 8192 samples this implies an operation count of about 62 operations per
output data sample. This is much lower than direct FIR filtering, but still greater than
our economical IIR approach.
On computers offering high-performance SSE2 instruction set extensions it is possible to
perform simultaneous IIR filtering on two independent data channels, making the effective
cost per sample half of our estimated 20 instruction cycles.

9.1 Frequency Warping of the Bilinear Transform

Use of a bilinear transform to convert from the S-plane analog filter designs to the Z-
plane digital filter equivalents necessarily entails warping of the frequency axis. The entire
behavior of the S-plane filter from DC to infinite frequencies is mapped to a finite-length
curve in the Z-domain, being along the upper half of the unit circle.
It simply isn’t possible to faithfully reproduce analog filters in a digital domain, since
the digital domain has a restricted useable frequency range running only from DC to the
Nyquist frequency. Use of the bilinear transform compromises by warping the infinite
frequency axis of the analog domain to this restricted digital frequency domain. Other
techniques for matching the behavior of the analog filters will entail other kinds of com-
promises.
The bilinear transform
z−1
s→k
z+1
3
Because of the peculiiarities of VST, high sample-rate data should consider using a Quality level one
unit higher than you would use for low sample-rate data. E.g., filtering at QL 3 for low sample-rate data
is equivalent to using QL 4 when the incoming data have sample rates above 80 kHz.

14
has an adjustable constant, k, that can be used to make the Z-domain filter behave at
exactly one frequency as its analog counterpart in the S-domain. At all other frequencies
in the Z-domain, the behavior of the digital filter is like the S-domain filter at some other
frequency than at the Z-domain frequency.
Figure 5 shows how the Z-domain frequencies relate to the analog S-domain frequencies
for several choices of Fc , where the bilinear transform constant
1
k=
tan( πF
Fs )
c

Figure 5: Frequency warping of the Bilinear Transform for various values of Fc , with
Fs = 96 kHz.

Frequencies in the Z-domain map to frequencies in the S-domain as


Fc πF
F → F0 = πFc
tan( )
|{z} tan( Fs ) Fs
Z−domain | {z }
S−domain
Fs
where, (0 6 F, Fc 6 )
2

Clearly this is an identity only at F = Fc , and elsewhere it implies some departure from
identity.

15
At Z-domain frequencies below Fc the departure is to the low side, meaning that the
corresponding S-domain frequencies are actually below the Z-domain frequency. At Z-
domain frequencies above Fc , this departure goes the other way, with the corresponding
S-domain frequencies being higher than the Z-domain frequencies.
Most often we are concerned about matching the behavior of the filters in the two domains
in the vicinity of rapidly changing amplitude and/or phase. And that occurs typically
near the cutoff frequency, Fc . In the neighborhood of that frequency, the correspondence
between the two filters is close.
But for some filters, notably the A-, B-, and C-weighting filters, there is no particular
frequency that one could consider the equivalent of our Fc . For those filters, we make use
of the dialed Fc to indicate that frequency at which you would like the behavior of the
digital filter to match the corresponding S-domain analog filter.
Figure 5 shows that for most cases the low-side frequency errors are less than a few percent.
But on the high side of Fc you see that the error can be quite astonishingly high, reaching
as much as 50% at the edge of the audible range.
For example, when Fc = 1 kHz (the uppermost curve), the error in the S-domain frequency
corresponding to a Z-domain frequency of 16 kHz is as much as 12%. The behavior of the Z-
domain filter at that frequency actually corresponds to the way the S-domain filter behaves
at a frequency of around 18 kHz instead of at 16 kHz.
This is the reason that we seek to move the Nyquist frequency as far above our audio range
as we can, using upsampling when the incoming audio has sample rates below 80 kHz.
Figure 5 was based on an assumed sample rate of 96 kHz. Had we used a lower value for
Fs these warping curves would have been even more extreme.

16
9.2 2-Pole Low-Pass Filters

Analog Domain:
1
H(s) =
s2 + s/Q + 1

Digital Domain: one biquad


1 − cos ωc
b0 =
2
b1 = 1 − cos ωc
1 − cos ωc
b2 =
2
a0 = 1 + α
a1 = − 2 cos ωc
a2 = 1 − α

Phase Linear Operation: Q → Q

Figure 6: Low-pass filters.

There are many ways to view the operation of a filter. One of these is to ask what Q
corresponds to making the half-power point,
√ or -3 dB level, of the filter occur at the cutoff
frequency, Fc . That happens when Q = 1/ 2 = 0.707. This is also the highest possible Q
without any peaking in its frequency response.

17
Another question might concern the time-domain behavior, or impulse response. A crit-
ically damped filter has the fastest possible rise time with no overshoot in its impulse
response, and the shortest settling time. That occurs when Q = 1/2 = 0.5.
Higher Q values produce faster rise times, but also some amount of “ringing” in the impulse
response, and longer settling times, corresponding to under-damped behavior. Ringing is
an exponentially damped sinewave.
Lower values for Q produce no ringing, but also have slower rise times, and produce longer
settling times. Figure 7 illustrates these cases for Q = 0.707 (underdamped), Q = 0.5
(critically damped), and Q = 0.3 (overdamped).

Figure 7: Impulse Response of Low Pass filters

When performing filtering for audio purposes it is most often the case that one is more
concerned about frequency response than time-domain impulse response. But there are
creative situations that call for adjusting the amount of filter ringing. The filter Q in that
case is the parameter used to adjust the duration of the ringing response. The higher the
filter Q, the longer the duration of ringing.

18
9.3 2-Pole High-Pass Filters

Analog Domain:
s2
H(s) =
s2 + s/Q + 1

Digital Domain: one biquad


1 + cos ωc
b0 =
2
b1 = − (1 + cos ωc )
1 + cos ωc
b2 =
2
a0 = 1 + α
a1 = − 2 cos ωc
a2 = 1 − α


Phase Linear Operation: Q → Q

Figure 8: High-pass filters.

19
9.4 2-Pole Band-Pass Filters

Analog Domain:
s/Q
H(s) =
s2 + s/Q + 1

Digital Domain: one biquad

b0 = α
b1 = 0
b2 = − α
a0 = 1 + α
a1 = − 2 cos ωc
a2 = 1 − α

Phase Linear Operation: Q → Q/2

Figure 9: Band-pass filters.

20
9.5 2-Pole Band-Reject Filters

Analog Domain:
s2 + 1
H(s) =
s2 + s/Q + 1

Digital Domain: one biquad

b0 = 1
b1 = − 2 cos ωc
b2 = 1
a0 = 1 + α
a1 = − 2 cos ωc
a2 = 1 − α

Phase Linear Operation: Q → 2 Q

Figure 10: Band-reject filters.

21
9.6 2-Pole All-Pass Filters

Analog Domain:
s2 − s/Q + 1
H(s) =
s2 + s/Q + 1

Digital Domain: one biquad

b0 = 1 − α
b1 = − 2 cos ωc
b2 = 1 + α
a0 = 1 + α
a1 = − 2 cos ωc
a2 = 1 − α

The filter has unity gain at all frequencies, but the phase response is warped. Obviously,
such a filter has no meaning in phase-linear application.

Figure 11: All-Pass filters phase response.

22
9.7 2-Pole Peaking/Dipping Filters

Analog Domain:
s2 − sA/Q + 1
H(s) =
s2 + s/(AQ) + 1

Digital Domain: one biquad

b0 = 1 + αA
b1 = − 2 cos ωc
b2 = 1 − αA
a0 = 1 + α/A
a1 = − 2 cos ωc
a2 = 1 − α/A

Phase Linear Operation: Q → Q, GdB → GdB /2

Figure 12: Peaking/dipping filters variation with Q.

The Q is defined for these filters such that a boost of GdB cascaded with a cut of −GdB
produces no net gain. Three Oxford-style variations are available:
• Type 1 filters are distinguished by having the same Q, as specified by the filter
parameter, for both boosts and cuts.

23
• Type 2 filters use Q for boosts, and Q(1 + |GdB |/8) for cuts. As GdB departs below
zero for cutting, these filters become narrower.
• Type 3 filters use Q(1 + |GdB |/8) for boosts and cuts (i.e., effective-Q grows with
increasing |GdB | for both boosts and cuts).
The intent of these Q with gain variations is to more-or-less keep constant area under
the curve, which often sounds more natural than Type 1 curves which affect increasing
bandwidth with increasing gain. The affected bandwidth in Type 2 and Type 3 curves
remains approximately constant.

Figure 13: Type 1 Peaking/dipping filters variation with GdB .

24
Figure 14: Type 2 Peaking/dipping filters variation with GdB .

Figure 15: Type 3 Peaking/dipping filters variation with GdB .

25
9.8 2-Pole Low-Shelf Filters

Analog Domain: √
s2 − s A/Q + A
H(s) = A √
As2 + s A/Q + 1

Digital Domain: one biquad



b0 = A((A + 1) − (A − 1) cos ωc + 2 Aα)
b1 = 2A((A − 1) − (A + 1) cos ωc )

b2 = A((A + 1) − (A − 1) cos ωc − 2 Aα)

a0 = (A + 1) + (A − 1) cos ωc + 2 Aα
a1 = − 2((A − 1) + (A + 1) cos ωc )

a2 = (A + 1) + (A − 1) cos ωc − 2 Aα

Phase Linear Operation:


GdB
GdB →
2
λ = log10 Q
η = − 0.00938576 + 0.923977 λ − 0.16893 λ2
Q → 10η

26
Figure 16: Low-shelf filters.

Figure 17: Low-shelf filters vs GdB .

27
9.9 2-Pole High-Shelf Filters

Analog Domain: √
As2 + s A/Q + 1
H(s) = A √
s2 + s A/Q + A

Digital Domain: one biquad



b0 = A((A + 1) + (A − 1) cos ωc + 2 Aα)
b1 = − 2A((A − 1) + (A + 1) cos ωc )

b2 = A((A + 1) + (A − 1) cos ωc − 2 Aα)

a0 = (A + 1) − (A − 1) cos ωc + 2 Aα
a1 = 2((A − 1) − (A + 1) cos ωc )

a2 = (A + 1) − (A − 1) cos ωc − 2 Aα

Phase Linear Operation:


GdB
GdB →
2
λ = log10 Q
η = − 0.00938576 + 0.923977 λ − 0.16893 λ2
Q → 10η

28
Figure 18: High-shelf filters.

Figure 19: High-shelf filters vs GdB .

29
9.10 1-Pole Low-Pass Filters

Parameter Q is unused by these filters. It requires at least second-order response to exhibit


resonance phenomena.
Analog Domain:
1
H(s) =
s+1

Digital Domain: one biquad


ωc
b0 = sin
2
ωc
b1 = sin
2
b2 =0
ωc ωc
a0 = sin + cos
2 2
ωc ωc
a1 = sin − cos
2 2
a2 =0

Phase Linear Operation: no parameter changes.

Figure 20: 1-Pole Low-Pass Filter.

30
9.11 1-Pole High-Pass Filters

Parameter Q is unused by these filters. It requires at least second-order response to exhibit


resonance phenomena.
Analog Domain:
s
H(s) =
s+1

Digital Domain: one biquad


ωc
b0 = cos
2
ωc
b1 = − cos
2
b2 =0
ωc ωc
a0 = sin + cos
2 2
ωc ωc
a1 = sin − cos
2 2
a2 =0

Phase Linear Operation: no parameter changes.

Figure 21: 1-Pole High-Pass Filter.

31
9.12 4-Pole Resonant Butterworth Low-Pass Filters

Analog Domain:
1 1
H(s) = q √ q √
s2 + s 2Q2 cos π8 + 1 s2 + s 2Q2 cos 3π
8 +1

Figure 22: 4-Pole Resonant Butterworth Low-Pass Filters.

32
Digital Domain: two biquads
p ωc
g= Q sin2
2
b01 = g
b11 = 2 g
b21 = g
p π
a01 = Q + cos sin ωc
p 8
a11 = − 2 Q cos ωc
p π
a21 = Q − cos sin ωc
8

b02 = g
b12 = 2 g
b22 = g
p 3π
a02 = Q + cos sin ωc
p 8
a12 = − 2 Q cos ωc
p 3π
a22 = Q − cos sin ωc
8

Phase Linear Operation: Q → Q

33
9.13 4-Pole Resonant Butterworth High-Pass Filters

Analog Domain:

s2 s2
H(s) = q √ q √
s2 + s 2Q2 cos π8 + 1 s2 + s 2Q2 cos 3π
8 +1

Figure 23: 4-Pole Resonant Butterworth High-Pass Filters.

34
Digital Domain: two biquads
p ωc
g= Q cos2
2
b01 = g
b11 = − 2 g
b21 = g
p π
a01 = Q + cos sin ωc
p 8
a11 = − 2 Q cos ωc
p π
a21 = Q − cos sin ωc
8

b02 = g
b12 = − 2 g
b22 = g
p 3π
a02 = Q + cos sin ωc
p 8
a12 = − 2 Q cos ωc
p 3π
a22 = Q − cos sin ωc
8

Phase Linear Operation: Q → Q

35
9.14 6-Pole Notch Filters

The 6-pole notch filters are designed entirely in the digital domain using a pole-zero pair
notch filter design augmented with additional poles on either side of the notch pole to
sharpen the notch well and to return to unity gain over a narrower frequency range. Addi-
tional zeros on the unit circle are provided at the same position as the original notch zero
to compensate these additional poles.
The pole arrangement in the Z-domain is such that the poles clustered near the notch zeros
form an equilateral triangle. The nearness of this triangle to the unit circle and the spread
among the poles determines the sharpness of the filter.
The Q of these filters is frequency compensated to produce a nearly constant filter width,
in terms of fractional frequency range, with changing notch frequency. DC gain is also held
constant.
The depth of the notch is fixed by the zeros on the unit circle, and theoretically, has
infinite depth in dB. However, unless you take care to use the very highest Quality levels
in computing these filters, the very narrowest will become blurred across the notch and
exhibit finite depth.

Figure 24: 6-Pole Notch Filters. Note the narrowed frequency display range compared to
previous filter graphs.

36
Digital Domain: three biquads
First, define the location of the poles and zeros along the real Z-axis, and then
rotate these vectors by ωc to move them into proper positions for the filtering
frequency. For each resulting biquad, the normalization gain is computed as
(a0 + a1 + a2 )/(b0 + b1 + b2 ) so that the DC gain remains unity.

Fc
ρ=1−
2 · 105 Q
p √
3ρ2 − 4(1 − ρ2 ) − 3 ρ
lmax = √
2 2
zeros = 1 + i 0

3
pole1 = ρ − lmax + i 0
√2
3
pole2 = ρ + lmax + i lmax
√2
3
pole3 = ρ + lmax − i lmax
2

Phase Linear Operation: Q → 2 Q

37
9.15 A-Weighting Filter

The A-weighting filter is frequently used to approximate the Fletcher-Munson loudness


response of human hearing at the 40 dBSPL level.
Parameter Fc has been tuned by means of a least-squares fit, from DC to 10 kHz, of the
Z-domain filter against the S-domain amplitude response. This fitting procedure found
that using Fc = 980 Hz was optimal. Parameter Q is not used for this filter.
Analog Domain:

(2π12200)2 s4
H(s) =
(s + 2π20.6)2 (s + 2π12200)2 (s + 2π107.7)(s + 2π738)

Figure 25: A-Weighting Filter.

Phase Linear Operation: no parameter changes – but filter will not be A-weighting

38
Digital Domain: three biquads

tan( π980
Fs )
γ=
980
g = 3.721 · 1010 γ 2

b10 = g
b11 = 2 g
b12 = g
a10 = (738 γ + 1)(1077 γ + 10)
a11 = 2(738 · 1077 γ 2 − 10)
a12 = (738 γ − 1)(1077 γ − 10)

b20 = 1
b21 = − 2
b22 = 1
a20 = (103 γ + 5)2
a21 = 2(103 γ + 5)(103 γ − 5)
a22 = (103 γ − 5)2

b30 = 1
b31 = − 2
b32 = 1
a30 = (12200 γ + 1)2
a31 = 2(12200 γ + 1)(12200 γ − 1)
a32 = (12200 γ − 1)2

39
9.16 B-Weighting Filter

The B-weighting filter is frequently used to approximate the Fletcher-Munson loudness


response of human hearing at the 70 dBSPL level.
Parameter Fc has been tuned by means of a least-squares fit, from DC to 10 kHz, of the
Z-domain filter against the S-domain amplitude response. This fitting procedure found
that using Fc = 1560 Hz was optimal. Parameter Q is not used for this filter.
Analog Domain:

(2π12200)2 s3
H(s) =
(s + 2π20.6)2 (s + 2π12200)2 (s + 2π158.5)

Figure 26: B-Weighting Filter.

Phase Linear Operation: no parameter changes – but filter will not be B-weighting

40
Digital Domain: three biquads

tan( π1560
Fs )
γ=
1560
g = 7.442 · 109 γ 2

b10 = g
b11 = − g
b12 = 0
a10 = 317 γ + 2
a11 = 317 γ − 2
a12 = 0

b20 = 1
b21 = 2
b22 = 1
a20 = (103 γ + 5)2
a21 = 2(103 γ + 5)(103 γ − 5)
a22 = (103 γ − 5)2

b30 = 1
b31 = − 2
b32 = 1
a30 = (12200 γ + 1)2
a31 = 2(12200 γ + 1)(12200 γ − 1)
a32 = (12200 γ − 1)2

41
9.17 C-Weighting Filter

The C-weighting filter is frequently used to approximate the Fletcher-Munson loudness


response of human hearing at the 100 dBSPL level.
Parameter Fc has been tuned by means of a least-squares fit, from DC to 10 kHz, of the
Z-domain filter against the S-domain amplitude response. This fitting procedure found
that using Fc = 2980 Hz was optimal. Parameter Q is not used for this filter.
Analog Domain:
(2π12200)2 s2
H(s) =
(s + 2π20.6)2 (s + 2π12200)2

Figure 27: C-Weighting Filter.

Phase Linear Operation: no parameter changes – but filter will not be C-weighting

42
Digital Domain: two biquads

tan( π2980
Fs )
γ=
2980
g = 3.721 · 109 γ 2

b10 = g
b11 = 2 g
b12 = g
a10 = (103 γ + 5)2
a11 = 2(103 γ + 5)(103 γ − 5)
a12 = (103 γ − 5)2

b20 = 1
b21 = − 2
b22 = 1
a20 = (12200 γ + 1)2
a21 = 2(12200 γ + 1)(12200 γ − 1)
a22 = (12200 γ − 1)2

43
9.18 1/F Pinking Filter

The 1/F filter produces a roll-off of -3 dB/octave, beginning from 0 Hz. White noise fed
through this filter will take on the character of pink noise. This filter is not tunable and
Q has no effect.
No such filter can be produced as an IIR filter biquad, nor as an analog filter. Instead, use
is made of a combination of 6 conventional -6 dB/octave 1-pole low-pass filters, arranged
in such a manner that as the roll-off of each filter begins to steepen, another 1-pole filter
is introduced with its more gentle knee dominating the local frequency behavior.
These composite filters have an alternating collection of poles and zeros along the real
Z-axis. By careful positioning of these pole and zero locations we can achieve an overall
amplitude response that is very nearly -3 dB/octave. In the analog domain, the (un-
realizable) transfer function corresponds to the Heaviside fractional derivative of order
-1/2.
Analog Domain:
1
H(s) = √
s

1/F Filter

R A L
Copyright (c) 2006-2007 by Refined Audiometrics Laboratory, LLC
All rights reserved.
0.01 0.1 1 10
Frequency [kHz]

Figure 28: 1/F Filter.

Phase Linear Operation: no parameter changes – filter will approximate -6 dB/octave

44
Digital Domain: four biquads (Note: these coefficients are independent of sample rate.)

g = 0.0238 53450 98841 8942


b10 = g
b11 = − g 1.9825 37832 81620 07
b12 = g 0.9825 81081 09808 26
a10 = 1
a11 = − 1.9921 80000 01966 01
a12 = 0.9921 87615 22003 38

b20 = 1
b21 = − 1.6769 86219 65412 43
b22 = 0.6938 12638 08798 49
a20 = 1
a21 = − 1.8354 99999 98034 34
a22 = 0.8396 38499 98305 24

b30 = 1
b31 = − 0.1427 27757 76050 128
b32 = − 0.0464 78090 32246 8225
a30 = 1
a31 = 0.2116 00000 00000 39
a32 = − 0.4188 79999 99999 71

b40 = 1
b41 = 0.7750 95480 87364 88
b42 = 0
a40 = 1
a41 = 0
a42 = 0

45
The above four biquads express the equivalent cascade form for the parallel combination
of simple one-pole filters shown here:
0.00167876
H(z) = 0.0238535 + (1-zero low-pass filter)
z
0.000803057
+ (1-pole low-pass filter)
z − 0.99886
0.00107994
+ (1-pole low-pass filter)
z − 0.99332
0.00215892
+ (1-pole low-pass filter)
z − 0.969
0.003896
+ (1-pole low-pass filter)
z − 0.8665
0.00424482
+ (1-pole low-pass filter)
z − 0.55
0.000186368
+ (weak 1-pole high-pass filter)
z + 0.7616

1/F Composite Filters

R A L
Copyright (c) 2006-2007 by Refined Audiometrics Laboratory, LLC
All rights reserved.
0.01 0.1 1 10
Frequency [kHz]

Figure 29: 1/F Component Filters. Notice how the knees of successive filters dominate the
spectral regions as the earlier filters begin rolling off more steeply. The green downward-
sloping line shows the resulting composite filter.

46
9.19 Tunable 1/F Low-Pass Filter

This filter is based on the same analysis as used above for the 1/F Pinking Filter. As you
tune the cutoff frequency successive component filters are added or elided from the sum
and gain is readjusted to keep the DC gain at unity. Filter Q is not used in this filter.
Average roll-off is -3 dB/octave.
Phase Linear Operation: no parameter changes – filter will approximate -6 dB/octave

9.20 Tunable F High-Pass Filter

This filter is based on the same analysis as used above for the 1/F Pinking Filter, but
transformed to the high-pass case. As you tune the cutoff frequency successive component
filters are added or elided from the sum and gain is readjusted to keep the Nyquist gain at
unity. Filter Q is not used in this filter. Average roll-off is -3 dB/octave.
Phase Linear Operation: no parameter changes – filter will approximate -6 dB/octave

47