Beruflich Dokumente
Kultur Dokumente
Authors:
Supervisor:
Fabian Meier, CTO G–Innovation ”Geneva” GmbH
In our modern mechanized world, research on noise control has become an important
subject. Especially with airplanes, cars or other noisy machinery, the need to cancel
disturbing noise is not only a matter of human comfort, but will also reduce the stress
imposed by vibrations on mechanical structures.
The thesis starts by giving an overview over the principles of acoustics and sound prop-
agation as well as digital signal processing. Then, the fundamentals of passive and active
noise control are introduced and some practical applications of active noise control that
already exist are discussed. Next, several variations of the Least Mean Square (LMS)
algorithm for use in an active noise control solution are evaluated. Finally, a practical im-
plementation of an active noise control system realized in software is presented, measured
and rated.
i
Contents
1. Task definition 1
1.1. Problem definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2. Responsibility assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3. Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4. Timeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Sound theory 5
2.1. Acoustics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.1. Sound characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.2. Sound, tone, noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1.3. Sound terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2. Sound perception and measurement . . . . . . . . . . . . . . . . . . . . . . 8
2.3. Sound attenuation and sound damping . . . . . . . . . . . . . . . . . . . . . 11
2.3.1. Sound attenuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.2. Sound damping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4. ANC principles 21
4.1. Noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.2. Noise control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.2.1. Passive noise control . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.2.2. Active noise control . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.2.3. Basic ANC components . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.2.4. Different kinds of ANC . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2.5. Basic ANC approaches . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2.6. History of active noise control . . . . . . . . . . . . . . . . . . . . . . 24
4.3. Active noise control applications . . . . . . . . . . . . . . . . . . . . . . . . 25
4.3.1. Noise reduction in aircrafts . . . . . . . . . . . . . . . . . . . . . . . 25
4.3.2. Noise reduction in automobile industry . . . . . . . . . . . . . . . . 25
4.3.3. Active headphones . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.4. Practical experiment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.5. Benefits of active noise control . . . . . . . . . . . . . . . . . . . . . . . . . 26
iii
Contents
5. ANC algorithms 27
5.1. Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.1.1. LMS, NLMS algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.1.2. Filtered-x LMS algorithm . . . . . . . . . . . . . . . . . . . . . . . . 29
7. Programming framework 37
7.1. Sound card driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.2. ASIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.2.1. Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
7.2.2. Driver query by the host application . . . . . . . . . . . . . . . . . . 38
7.2.3. Host query by the driver . . . . . . . . . . . . . . . . . . . . . . . . . 39
7.2.4. Audio streaming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
7.2.5. Media synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . 40
7.2.6. Driver notifications to the host application . . . . . . . . . . . . . . 40
7.3. PortAudio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7.3.1. Writing a PortAudio application . . . . . . . . . . . . . . . . . . . . 41
7.3.2. Callback function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7.3.3. Lifecycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
7.3.4. Example PortAudio application . . . . . . . . . . . . . . . . . . . . . 42
7.4. Visual Studio .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
7.5. MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
7.5.1. MATLAB extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
7.5.2. PaWavPlay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
7.6. LaTex and TeXnicCenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
7.7. CVS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
7.8. Programming approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8. Application software 47
8.1. Driver and libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
8.2. Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
8.2.1. CWinApp class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
8.2.2. CDialog classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
8.2.3. ANCBuffer class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
8.2.4. ANCPrefs class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
8.2.5. ANCWorker class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
8.3. Graphical user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
iv
Contents
10.Conclusion 61
10.1. Technical conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
10.2. Possible improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
10.2.1. Active gain control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
10.2.2. Considering the field of application . . . . . . . . . . . . . . . . . . . 62
10.2.3. Additional bandpass filters . . . . . . . . . . . . . . . . . . . . . . . 62
10.2.4. Improved supervisor function . . . . . . . . . . . . . . . . . . . . . . 62
10.3. Cooperation during the project . . . . . . . . . . . . . . . . . . . . . . . . . 62
10.4. Project management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
10.5. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
A. Appendix 65
A.1. Pre-amplifier circuit diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 65
A.2. Application class diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
List of Abbreviations 67
List of Figures 69
List of Tables 71
Bibliography 73
v
1. Task definition
The following chapter describes the problem to be solved during the course of this diploma
thesis.
During the course of the project, one of the above solutions should be chosen and
implemented.
The final system should then be tested, measured and rated against already existing
(commercial) ANC solutions.
1
1. Task definition
Project management
Of course, task assignments will be handled flexibly, allowing for adjustments during
the course of the project if needed.
1.3. Documentation
At the end, a detailed report about the subject, steps involved to get to the final solution,
findings and measurements has to be compiled. The report should comply with the Uni-
versity of Applied Sciences Rapperswil Department of Electrical Engineering’s guidelines
regarding semester and diploma thesis documentation. All sources used to produce the
final report should be clearly referenced.
The report has to be delivered in duplicate form, one exemplar stays with the Digi-
tal Signal Processing Laboratory, the other one will be given back to the students after
correction.
1.4. Timeline
The project starts on October 24th, the duration is limited to eight weeks, the final report
has to be delivered by December 16th 2005.
In order to allow for enough time to compile the documentation, the last two weeks will
mainly be reserved for documentation tasks and preparation of the presentation.
The first two weeks are needed for preliminary studies, gathering the required develop-
ment hardware and tools, and getting familiar with the subject and necessary technologies.
This basically leaves four weeks (in the middle of the project) for problem analysis, design
and implementation of a functioning solution. Finally, some tests and measurements will
have to be performed. The project presentation will be prepared during the last week.
Figure 1.1 shows the preliminary project schedule, which will be refined as the project
moves along. This task definition has to be finalized by the end of the second week and
get approved by the project supervisor.
2
1.4. Timeline
3
2. Sound theory
The science which deals with sound is called acoustics [16]. Acoustics are a large section
which can be divided into several areas. Physical acoustics are a subsection of mechanics
and describe vibrations and waves hearable by the human ear. The following pages give
an overview of sound theory on the basis of [16].
2.1. Acoustics
To understand the behavior of vibration and waves some acoustics theory is needed. First
of all the question ”What is sound?” must be answered. Sound is a pressure wave traveling
through a medium, for example air. Sound is usually generated by the vibration of an
object, like speakers or human vocal cords. The vibrating object radiates pressure waves
into the adjoining medium.
Frequency
Wavelength
Amplitude
Propagation velocity
Frequency characterizes the tone or pitch of a sound, for example a bass cord sounds at
a lower frequency than a violin cord. The wavelength is directly related to frequency, f ∝ 1l .
Thus, higher frequencies have lower wavelengths. The amplitude is the maximum amount
of pressure at any point in the sonic wave. Finally, the sound-propagation velocity depends
on the type, temperature and pressure of the medium through which it propagates. The
propagation speed can be calculated by using equation 2.1, where u is the propagation
velocity, κ the adiabatic exponent, R the gas constant, T the absolute temperature and
M the molar mass:
r
κRT
u= (2.1)
M
As can be seen in table 2.1 the propagation velocity of sound waves in air is about 344
ms−1 at 20 , very slow comparing with electromagnetic waves in vacuum, traveling at
299’792’458 ms−1 .
(Note: The propagation depends also on the geometric form of the source. It must be
distinguished between the near and the far field. This will not be discussed here.)
5
2. Sound theory
Medium Speed
Hydrogen (20 ) 1300 ms−1
Air (20 ) 344 ms−1
Carbon Dioxide (20 ) 258 ms−1
Aluminum 5200 ms−1
Iron 5000 ms−1
Fir Wood 3320 ms−1
Concrete 3100 ms−1
Polystyrene 1800 ms−1
Cork 500 ms−1
To get some clarity of tone and sound, some fundamental things must be noted. The effect
respectively the impression of a harmonic sonic wave (a sinus tone with the frequency f0 )
specifies a tone. Therefore a (clean) tone is a single sinusoidal wave. Thus, the frequency
spectrum of a tone shows a discrete line at f0 Hz.
A periodic vibration or the overlap of harmonic waves, which frequencies are a integer-
multiple of the lowest one (the fundamental frequency), is called a clang or sound. Thus,
the frequency spectrum contains several discrete lines at:
The timbre (the color of sound) is given by the strength of a partial tone, the phasing
can not be noticed by the human hearing.
Noise has no more periodicity. It has frequencies spread over a continued span in the
frequency spectrum. The most common example is white noise, which has its energy
spread evenly across all frequency bands. An extreme example is a bang. It has a short
duration and reaches high frequencies.
6
2.1. Acoustics
∆p0
peff = √ (2.4)
2
(Note: Do not confuse the sound particle velocity with the wave propagation speed, both
are measured in ms−1 .)
Z = ρu (2.6)
The relation between sound pressure and the sound radiation impedance is shown in
equation 2.7
7
2. Sound theory
Source Power
Human Voice (Normal Speech) approx. 7 ·10−6 W
Human Voice (Maximum) approx. 2 ·10−3 W
Violin (Fortissimo) 10−3 W
Grand Piano (Fortissimo) approx. 0.2 W
Trumpet (Fortissimo) approx. 0.3 W
Organ up to 10 W
Loudspeaker up to 100 W
For an adequate speech comprehensibility frequencies from 300 to 3000 Hz are needed.
The human ear is strongly frequency dependent. Two tones with different frequencies and
the same SPL are perceived to have different loudness LS measured in phone1 . Above
200 Hz the ear’s sensitivity gets stronger and the perception of loudness is much higher.
To define the loudness, a listener alternately hears a sound (sonic) which must be rated
and a sinus tone of 1 kHz for evaluation. The sound level of the sinus tone is increased
until the hearer perceives the two signals to be equally loud. The sound level of the sinus
1
The Greek word ”phone” means sound, voice, tone, statement
8
2.2. Sound perception and measurement
tone in dB is then the loudness of the rated sound in phone (at 1kHz). An example: A
sound with a loudness of 60 phone is perceived to be as loud as a sinus tone with the
frequency of 1 kHz and a sound level of 60 dB.
The lowest perceivable sound level is called the hearing threshold level. Note: The
hearing threshold level is not at 0 phone as written in some textbooks. It is at 4 phone
by the reason that the reference sound pressure is the round value of 2 · 10−5 Pa, but the
threshold level at 1000Hz is beyond that sound pressure. Figure 2.2 shows curves of same
loudness. They refer to people between 18 and 25 years who hear normally and are valid
for sinus tones heard binaural. The SPL were measured in undisturbed sound field (field
permeated by sonic), i.e. in absence of the subject.
An example: The threshold of pain at 1000Hz is about 130 dB (130 phone). For 20Hz,
it sinks to 120dB (about 90 phone) and at 16kHz it is at about 120dB (approximately 110
phone). So, it can not be simply stated that the threshold of pain lies at 130 phone.
In practice, the phone scale is only used to recognize levels of equal loudness. A quan-
titative comparison of different loudness levels is not possible. If the SPL of the reference
sinus signal is doubled at 1000 Hz, it can not be concluded that the hearer perceives it
as twice as loud. Thus, a doubling of the phone value does not mean a doubling of the
9
2. Sound theory
10
2.3. Sound attenuation and sound damping
Sound Damping obstructs the propagation of the sound by using reflective hindrances.
Walls, doors and windows are typical examples. They cause sound damping for ”incoming”
sound.
In room and building acoustics, five different types of absorptions are differed.
1. Porous layer
If a sound wave impinges on a porous layer with open pores, the air particles are
put in vibration. The flow resistance in canals and the heat transmission cause a
significant attenuation.
For only a small part of the wave to be reflected, the sound radiation impedance of
the layer shall differ as little as possible from the air’s radiation impedance. Thus,
the flow resistance in the pores must be as small as possible, but if the resistance is
held low the absorption is not high enough, therefore a thicker layer is needed.
The absorption of porous layers grows with the rise of frequency. Therefore, a thicker
layer and lax fiber is needed for low frequencies.
A porous fiber layer has a soft lightly damageable surface which can only be cleaned
difficultly. Adding a coat of paint onto a porous surface is exceedingly difficult
and the absorption is going to get reduced. Thus, porous layers are protected by
11
2. Sound theory
perforated media. This media can be made of hard, solid disc. With this step,
the absorption is reduced for high frequencies (> 1000Hz), for lower frequencies the
absorption gets higher.
3. Acoustic disk
An acoustic disk is made of porous, solid material. It has a high flow resistance and
the surface is relaxed by many little slots. This method causes an attenuation. The
form of the slots is inessential, it can be borings or rills.
(Note: Disks made of made of porous fibers and low flow resistance are also called
acoustic disks.)
4. Disk Resonator
Disk absorbers primarily absorb low frequencies and are an ideal addendum to the
absorber with porous material. In concert halls, wainscot is used as disk resonator.
Without such a kind of absorber, the room sounds ”dull” in predominant absorption
caused by chairs, carpeting, audience and cushion in high frequency bands. With
the usage of wainscot the lower frequencies are also attenuated and the frequency
spectrum gets balanced. The room therefore sounds ”brighter”.
5. Helmholtz resonator
2
Z1 − Z2
R= (2.12)
Z1 + Z2
12
2.3. Sound attenuation and sound damping
According to the two different transmission ways, in sound damping it must also be dif-
fered between airborne sound damping and impact sound damping. The effective sound
damping depends on several influences and is hard to calculate precisely.
P1 is the power which radiates to the wall and P2 is the power which radiates away
on the other side of the wall. The sound insulation is heavily frequency dependent. For
components a single value is needed but a computation of a mean value is not applica-
tive because of the frequency selective human ear. Therefore, a measured curve R(f ) is
compared with a special algorithm with a normed curve and the sound insulation Rw is
assigned. This value corresponds approximately to the mean sound insulation value R̄.
For sound absorption, light, penetrable materials are used but for sound damping weak
and impermeable one.
13
3. Digital signal processing theory
Digital signal processing is a large section. The following pages describe the digital signal
processing theory used in this work. The next pages were written on the basis of [18].
ZT /2
1
Rss (τ ) = lim s(t)s(t + τ )dt (3.1)
T →∞ T
−T /2
According to the autocorrelation function which shows the inner binding of one signal,
the cross correlation function (CCF) shows the binding of two different signals. The
computation is similar to the one of the ACF:
ZT /2
1
Rsf (τ ) = lim s(t)f (t + τ )dt (3.2)
T →∞ T
−T /2
Both equations are shown for power signals (not time limited).
s(t) f(t)
H(ω)
Z∞
Rsf (τ ) c sΦ (ω) =
sf Rsf e−j ωτ d τ (3.3)
−∞
15
3. Digital signal processing theory
On the other hand, the power density of one signal (Φs (ω)) can be computed with
an equation similar to the cross power density spectrum 3.3. Having these two power
densities, the transfer function of the unknown system is:
Φsf (ω)
H(ω) = (3.4)
Φs (ω)
Auto- and cross-correlation functions are also an essential part of Mean Square Error
(MSE) algorithms which are introduced in section 3.2.
Also in cases where the environment is changing and a process should be hold on a
desired level, the usage of adaptive filters is needed. Most of the adaption techniques
based on MSE algorithms.
x(n)
H(z)
N
X
e(i) = r(i) − f (i) = r(i) − ck s(i − k) (3.6)
k=0
N
X
⇒ Q = e2 (i) = [r(i) − f (i)]2 = [r(i) − ck s(i − k)]2 (3.7)
k=0
16
3.3. MSE algorithms
c0 c1 cN cN
f(i)
+ -
r(i) s(i-n)
e(i) Algorithm
Defining c as the column vector of the filter coefficients c = [c0 , c1 , . . . , cN ]T and s(i) the
column input vector (with its back dated values) s = [s(i), s(i−1), . . . , s(i−N )]T . Forming
the average determination with the expected value E., the MSE can be also computed
(according to equation 3.7) with:
Q = E [r(i) − cT s(i)]2
(3.8)
It follows that Q(c0 , c1 , . . . , cN ) = Q(c) has a quadratic form (N+1-dimensional quadratic
”error area”). Thus, Q has one distinct minimum and is given by setting all partial deriva-
tion to zero:
∂Q
= 0, n ∈ N ∧ n = 0, 1, 2 . . . , N (3.9)
∂cn
∂Q ∂Q ∂Q ∂Q
gradQ = = ... =0 (3.10)
∂c ∂c0 ∂c1 ∂cN
Computing the partial derivations of equation 3.10 or 3.10 with 3.7 the system is de-
scribed with its existing signals:
N
∂Q ∂ X
= [r(i) − ck s(i − k)]2 (3.11)
∂cn ∂cn
k=0
N N
X ∂ X
= 2[r(i) − ck s(i − k)] [r(i) − ck s(i − k)]
∂cn
k=0 k=0
| {z }| {z }
e(i) −s(i−n)
= −2e(i)s(i − n) (3.12)
According to equation 3.12 and 3.10, the MSE is:
e(i)s(i − n) = 0, n ∈ N ∧ n = 0, 1, 2 . . . , N (3.13)
17
3. Digital signal processing theory
Interpreting equation 3.13, the minimum is reached and the coefficients perfectly adapted
when the input signal is uncorrelated to the error signal. The gradient1 can also be com-
puted with the following conditions from equation 3.16 and 3.10:
E{e(i)s(i)} = 0 (3.15)
N
X
[r(i) − ck s(i − k)]s(i − n) = 0, n ∈ N ∧ n = 0, 1, 2 . . . , N
k=0
N
X
⇒ ck s(i − n)s(i − k) = r(i)s(i − n) , n ∈ N ∧ n = 0, 1, 2 . . . , N (3.16)
| {z } | {z }
k=0
Rss (n−k) Rrs (−n)=Rsr (n)
N
X
ck Rss (n − k) = Rsr (n), n ∈ N ∧ n = 0, 1, 2 . . . , N (3.17)
k=0
As already mentioned in section 3.1, Rss is the auto correlation and Rsr the cross corre-
lation of two signals. In this special case, the autocorrelation is computed at the position
n-k. The equation system can also be written as a matrix, which illustrates the algorithm
in a simple way.
k=0 1 ... N
n=0 Rss (0) Rss (1) . . . Rss (N ) c0 Rsr (0)
1 Rss (1) Rss (0) . . . Rss (N − 1) c1 Rsr (1)
= (3.18)
.. .. .. ..
. . . .
N Rss (N ) Rss (N − 1) . . . Rss (0) cN Rsr (N )
The simplest way to compute the auto- and cross-correlation values is to work block
wise. For a block of M values (M values of signal s(i) and f (i) each) the equation must be
solved. The block can also be built with overlapping ”windows”. There are also methods
for griding value computation (continuous value renewal).
1
Gradient is the vector which points to the direction with the highest rise
18
3.3. MSE algorithms
The autocorrelation matrix and the cross correlation vector can be expressed as:
Rss = E s(i)s(i)T
(3.19)
Rsr = E {s(i)r(i)} (3.20)
With these two definitions, the equation system 3.18 can be written in a short way:
The computation of the optimal filter coefficient vector is shown in 3.22. The autocor-
relation matrix has a special form. First of all it is symmetric and has only N+1 different
values which positions result by scrolling (Toepliz-Matrix). For reason of the special form
of the matrix, fast algorithms can be developed.
The update of filter coefficients happens on the basis of the error area described in
section 3.3. The coefficient correction is proportional to the negative descent of the gra-
dient. Knowing the gradient in the current point, the coefficient correction ∆cn can be
determined. According to equation 3.12, the gradient can be computed. The correction
of the coefficients from one step m (time) to the other m+1 must be computed with the
following instruction:
α ∂Q
c(m+1)
n = c(m)
n + ∆cn
(m)
= c(m)
n − (3.23)
2 ∂cn
Considering again equation 3.12, the correction factor and the final filter computation
is given by:
α ∂Q αh i
∆c(m)
n = − =− −2e(i)s(i − n) = αe(i)s(i − n) (3.24)
2 ∂cn 2
⇒ cm+1
n
m
= cn + αe(i)s(i − n), n ∈ N ∧ n = 0, 1, 2 . . . , N (3.25)
The adaptive filter will change its coefficient so that the error is getting smaller (the
new filter coefficients are calculated in the opposite direction of the gradient).
The variable α (in many literatures also defined as µ) is the step size, which controls
how much the correction affects the old coefficient. After repeatedly adjusting each coef-
ficient in the direction of the negative gradient the filter should converge; the difference
between the transfer function of the unknown system and the one of the adaptive filter
gets smaller and smaller. If the step size is chosen small, the system will converge slowly,
but the minimum error is reached. Choosing a big step size, the system will converge
19
3. Digital signal processing theory
faster but the error is not at the minimum and will behave erratically. Making step sizes
too big will render the system unstable.
The simplest way to implement the LMS algorithm is to pass on computing the mean
value. This ”new” algorithm is known as the standard LMS.
More care than with building the mean value must be taken when configuring the step
size. In many cases, it is quite difficult to find a suitable constant step size α. The risk
of the system getting unstable for strong signal inputs is high. Using norming of the step
size, α is always computed as conversely to the momentary approximated signal power
σbs 2 :
α0
α(n) = (3.26)
δ + Lσbs 2 (i)
α0 is a constant, δ is a small factor preventing a division by zero and L is factor purpose-
ful set to 1 or to the length of the filter, L = N + 1. σbs 2 is a mean value of the incoming
signal square values s(i)2 . The length of building the ”mean” is set to the length of the
filter length (N+1) (but this depends on the form of the mean computation). This LMS
modification is known as the normalized LMS.
20
4. ANC principles
This chapter gives an introduction into the principles of active noise control and some
practical applications already implemented.
4.1. Noise
By the most general definition, noise is simply unwanted sound, so sound is not really
noise unless someone hears it and finds it disturbing. Noise is a public nuisance which
has adverse effects on living beings, such as concentration problems and faster exhaustion.
Sustained exposure to high levels of noise can even cause temporary or permanent loss of
hearing. For these reasons, legislators are starting to treat noise as a form of environmental
pollution, putting restrictions on how much noise a certain piece of machinery should emit
at most, or how much noise is endurable for human beings at their workplace or at home.
There are two different kinds of noise, broadband and narrowband. Broadband noise is
caused by turbulences and is totally random, which means the energy is distributed equally
across all frequency bands. Examples are the low-frequency sound of a jet plane or the
impulse noise of a gunshot. With narrowband noise, most energy is concentrated around
specific frequencies. This kind of noise is caused by rotating machinery and is therefore
periodic or nearly periodic. An example is the noise caused by a car’s combustion engine.
21
4. ANC principles
ence: When two waves with the same amplitude and frequency, but phase-reversed, travel
in the same direction, they will neutralize each other thanks to destructive interference.
The resulting sound is null, the sound energy is transformed into heat.
In the simplest form of ANC, a control system drives a speaker to produce a sound field
that is the exact mirror-image of the offending sound (the ”disturbance”). The speaker
thus cancels the disturbance by means of destructive interference, and the net result is no
sound at all:
Figure 4.1.: A signal gets erased by its ”anti-signal”. The result is zero.
22
4.2. Noise control
Global free space cancellation — The total annihilation of a sound field in three
dimensions. Requires the cancellation source to be placed within close proximity of the
acoustic disturbance, as a general guideline within 0.1 wavelengths of the disturbance
source in order to obtain 20 dB global reduction in sound intensity at any given frequency
[9].
Cavity and duct cancellation — Deals with noise cancellation in confined spaces,
such as a room or a ventilation duct. In a confined space, reflections from the walls create
modal responses, which are generally present whenever the wavelength of the acoustic
wave approaches or decreases below the dimensions of the cavity. The number of acoustic
modes grows rapidly with the increase of frequency of the sound wave. In fact, the number
of modes N below frequency f in a cavity of volume V is given by equation 4.1 where c
represents the speed of sound [9]
4πV 3
N∼
= f (4.1)
3c3
Zone-of-silence cancellation — Provides a localized cancellation of sound field in-
tensity in a very small region of the overall sound field. A typical cancellation zone will
only be about a tenth of a wavelength in diameter [9].
It should be noted that active noise canceling is best suited for low frequencies2 :
First of all, for higher frequencies, the spacing requirements for free space and zone-of-
silence techniques become prohibitive. Second, in acoustic cavity and duct based systems,
the number of modes grows rapidly with increasing frequency, which quickly makes active
noise control techniques unmanageable. Third, passive treatments become more effective
at higher frequencies and often provide an adequate solution without the need for active
control [5].
23
4. ANC principles
between the primary disturbance and the estimated value available to the control algo-
rithm.
The transfer function from the disturbance input to the system output for the feedfor-
ward cancellation algorithm is given in equation 4.2. If the compensator is designed so
that C(s) = −G−1 (s)P −1 (s), then the overall resulting transfer function equals zero.
Y (s)
H(s) = = 1 + G(s)C(s)P (s) (4.2)
D(s)
Feedback control — This approach is constantly monitoring the system’s output in
order to minimize the remaining error. The advantage is that it can compensate dynamic
variations in the plant transfer function due to aging, changes in temperature or humidity,
etc.
The block diagram of a linear feedback control can be seen in figure 4.4. This kind of
feedback loop is actually the most common approach to disturbance rejection, by designing
the compensator C(s) to minimize the impact of the disturbance D(s) on the closed-loop
system output Y(s).
For noise canceling purposes, let’s assume U (s) = 0 as the control signal. In this case,
the transfer function from the disturbance input to the closed loop system is given by
equation 4.3.
Y (s) 1
= (4.3)
D(s) 1 + C(s)P (s)
24
4.3. Practical experiment
and hundreds of research papers have been published on the subject. There are also dozens
of companies that specialize in commercial active noise control products.
The nice thing about this experiment is that the effects of destructive and constructive
interference can easily be demonstrated by changing the distance between the speakers.
With the speakers half a wavelength apart, constructive interference makes the signal to
appear much louder than from a single speaker source.
25
4. ANC principles
Another application are active mufflers for engine exhaust pipes, which have been in
use for a while on commercial compressors, generators, and such. With the price for ANC
solutions dropping, even automotive manufacturers are now considering active mufflers as
a replacement of the traditional baffled muffler for future production cars. The resultant
reduction in engine back pressure is expected to result in a five to six percent decrease in
fuel consumption for in-city driving [19].
26
5. ANC algorithms
The following pages describe common algorithms for ANC on the basis of a feedforward
system (see section 4.2.5). Feedforward is the common implementation for ANC systems.
5.1. Algorithms
According to the described principles in chapter 4 and the theory in chapter 3, adaptive
algorithms used in ANC systems bring some difficulties, one of them being the convergence
time. Figure 5.1 shows a simplified ANC system, where P(z) is the primary path over
which the sensor measuring the error is reached. Using an adaptive algorithm, H(z) must
be adapted as close as possible to P(z) in order to minimize the remaining error.
Noise P(z)
- +
H(z)
error
In order to simulate the effect of the step size on the algorithm’s convergence speed,
a random generated finite impulse response (FIR) low-pass filter with order 32 was used
(simulates the unknown P(z)), to which an adaptive FIR filter (H(z)) would have to adapt.
The reference signal used was random generated noise. Figure 5.2(a) shows the adaption
and the convergence of the filter with a step size of 0.05 using the standard LMS algorithm.
When changing the step size to 0.06 the filter is not going to be adapted, the error rises
and the system becomes unstable as can be seen in figure 5.2(b)).
Conclusion: The choice of the step size is playing an essential role in designing an
ANC algorithm. However, as described in section 3.3.2, the normalized LMS (NLMS) can
mitigate the problems with large step sizes. The same simulation as above - but now using
the NLMS algorithm - shows a constant diminishment of the remaining error. Setting the
27
5. ANC algorithms
(a) LMS with step size 0.05 (b) LMS with step size 0.06
step size to a low value, the system slowly starts to minimize the difference between P(z)
and H(z), as can be seen in figure 5.3(a) and 5.3(b).
(a) NLMS with step size 0.05 (b) NLMS with step size 0.06
The system now has a small remaining error but convergence is not yet reached. Thus,
the adaption must be influenced more by the computed update of the filter coefficients,
i.e. the step size must be increased. Setting the step size to a higher value - for example
1 - the filter adapts faster (figure 5.4).
Conclusion: The adaption still depends on the choice of the step size, but the NLMS
algorithm is not as sesitive regarding step sizes as the LMS algorithm. In order to develop
a good ANC system, stability, fast convergence and small residual error are preferred.
NLMS is therefore the better algorithm for this kind of application. (Note: in some
literatures, NLMS is implicitly know as LMS).
28
5.1. Algorithms
Noise P(z)
+
-
H(z) S(z)
error
LMS
The filter S(z) is the secondary path of the system. As shown in figure 5.5, the control fil-
ter H(z) is adaptive and drives the secondary source to generate the canceling signal which
influences the error measurement. After convergence (error=0), the resulting transmission
is:
S(z) is the sum of transfer functions of components with mostly unknown characteristics
like cable transmission, anti aliasing filter, DAC, power amplifier, actuator function etc.
29
5. ANC algorithms
The main problem is not knowing the transfer function of the actuators1 which shall sup-
ply the estimated canceling signal. In general, these unknown characteristics will produce
a change of the amplitude and phase shift. An obvious solution to eliminate this issues is
to place S(z)−1 in series with S(z). Since this inverse filter does not exist or is not known
exactly, the Filtered-X LMS (FXLMS) algorithm uses an estimation of S(z) to mitigate
that issue.
A part of the unknown transmission function S(z) can be reconstructed with off-line path
modeling [13]. The modeled transfer function can be used for convergence performance
by modifying the LMS algorithm. Figure 5.6 shows the modification which results in the
FXLMS algorithm.
Noise P(z)
+
-
H(z) S(z)
error
S’(z) LMS
S’(z) represents the estimated transfer function of S(z). S’(z) compensates for the effects
of the secondary path. Implementing this algorithm should result in quicker convergence
of the adaptive filter. The filter converges even with 90◦ of phase error between S(z) and
S’(z) ([13]). If the phase error increases more, the convergence will be slowed down. [20].
1
In the system under investigation, the acoustical transfer function from the headphone to the error
microphone
30
6. ANC system buildup
Since the sound sensation close to the human ear should be held as low as possible (de-
structive interference should leave only a small error after overlaying the correction ”anti-
signal”), additionally to a sensor measuring the primary disturbance, the ANC system
needs to have a sensor measuring the remaining error. With the conclusions made after
preliminary studies on ANC systems and the simulations, the decision fell on using a feed-
forward adaptive algorithm. Feedforward systems are more stable than feedback systems
and can also successfully operate at higher frequencies.
N(z) – Represents the ear muffs of the headphones. By means of their passive
isolation, the ear muffs show low pass characteristic.
H(z) – Represents the adaptive filter. The filter coefficients are adjusted on the
basis of the measured error.
S(z) – Represents the secondary path transmission. The signal is transformed from
an electrical into an acoustical signal. Since S(z) consists of transfer functions not
fully known, S(z) must be estimated with digital processing computations, as ex-
plained in section 6.2.
O(z) – Represents the error microphone. The remaining acoustical error is trans-
formed into an electrical signal. The adaptive filter is fed with the measured error
and the adaptive filter coefficients are adapted.
Note: O(z) and M(z) are microphones and should have the same characteristic.
Table 6.1 describes the different paths considering figure 6.1. Path 1) and 4) differ
in distance to the two sensors (microphones). Path 4) is shorter because the reference
microphone is located outside the headphone’s ear cup, while the microphone sits inside.
31
6. ANC system buildup
1) 2) 3)
Noise P(z) N(z)
4)
+
5) 6) 7) -
M(z) H(z) S(z)
8)
O(z)
9)
Topic Description
Noise Noise source
1) noise passing to P(z), acoustical signal
2) noise from P(z) to N(z), acoustical signal
3) noise from N(z) to ”addition” point, acoustical signal
4) noise passing to M(z), acoustical signal
5) noise from M(z) to H(z), electrical signal
6) noise from H(z) to S(z), electrical signal
7) noise from S(z) to ”addition” point, acoustical signal
8) acoustical error signal (acoustical destruction)
9) signal from O(z), electrical error signal
32
6.3. ANC system
noise was generated by a random noise generator2 . With the noise playing, the head-
phone and the error microphone signals (with the ANC system turned off) were recorded.
Computing the autocorrelation and cross correlation of the recorded signals, the filter
coefficients were computed on the basis of the LS algorithm (see section3.3.1).
headphones
reference error
microphone microphone
Since H(z) is also unknown, this filter also has to be computed. Again, white noise
was used for the computation, but this time the noise was played over speakers. By the
reason the adaptive filter H(z) is computed on the basis of played noise over speakers, its
precision varies because the speaker also has (unknown) filter characteristics. However,
test have shown that the adaptive filter will converge faster when initializing it with the
computed values even when they are imperfect.
6.4.1. PC system
The PCs used were the standard Fujistu Siemens workstations found at the workplace in
the Digital Signal Processing Laboratory. They provided more than enough processing
power to get the job done, the hardware specifications can be seen in table 6.3.
2
A 1390-B Random-Noise Generator manufacuted by General Radio Company, Massachusetts USA
33
6. ANC system buildup
1) 2) 3)
Noise P(z) N(z)
4)
+
5) 6) 7) -
M(z) H(z) S(z)
8) 12) 10)
9) 11)
S’(z) NLMS O(z)
Topic Description
Noise noise source
1) noise going to P(z), acoustical signal
2) noise from P(z) to N(z), acoustical signal
3) noise from N(z) to ”overlay” point, acoustical signal
4) noise passing to M(z), acoustical signal
5) noise from M(z) to H(z), ADC,
electrical signal → discrete values
6) noise from H(z) to S(z), computer internal computed values send for DAC,
discrete values → electrical signal
7) signal from S(z) to ”overlay” point,
electrical signal → acoustical signal
8) noise from M(z) to S’(z), ADC,
electrical signal → discrete values
9) values from S’(z) for NLMS algorithm, discrete values
10) error, acoustical signal
11) signal from O(z), DAC,
electrical error signal → discrete signal
12) values for filter adaption, discrete values
34
6.5. Hardware setup
Analog I/O: Two gold-plated RCA jacks each for in- and output
Dynamic Range: D/A 104dB(A), A/D 100.5dB(A), <0.002% THD @ 0dBFS
Frequency Response: 22Hz - 22kHz, +/-0.4dB
Sample rates (Hz): 8k, 9.6k, 11.025k, 21k, 16k, 22.05k, 24k, 32k, 44.1k, 48k, 88.2k and 96k
Resolution: 8, 16, 20 and 24 bit digital audio
6.4.4. Headphones
The headphones used were Sennheiser’s high-end model HD-580, the specifications of
which are shown in table 6.5. They are open headphones3 , meaning they have an open
grille on the back of the speaker, allowing the sound to vent freely, which usually provides
a better sound quality than closed headphones.
However, using open headphones for building a professional ANC system is definitely
suboptimal because the attenuation of higher frequencies is only minimal. Nevertheless,
for a proof-of-concept implementation where the nature of the external disturbance could
be controlled in order to measure the system’s performance, they did the job quite well.
For some practical tests, a swiss army earmuff4 was added on top of the headphones in
order to achieve better passive attenuation of high frequencies.
3
Also called ”open aire” headphones
4
Also known as ”pamir”
35
6. ANC system buildup
1 the headphones
2 the reference mic, placed dLatency away from the headphone (toward the noise source)
3 the error mic, measuring the remaining error inside the headphones ear cup
4 the noise coming into the system
5 the noise filtered by the headphones earmuffs
6 the signal played by the headphones. should be the inverted signal 5
7 the PC controlling the headphone speaker
dLatency the distance that compensates the I/O latency through the system
36
7. Programming framework
The following chapter discusses the programming framework, libraries and tools used dur-
ing the course of this diploma thesis.
7.2. ASIO
Today’s operating system’s audio support is usually restricted to stereo input and output
only, with shortcomings in the areas of multi-channel support, synchronization and low la-
tency. ASIO (Audio Streaming Input/Ouput) is an API defined and proposed by Steinberg
Media Technologies GmbH that tries to address these issues. ASIO allows the handling of
professional audio cards at different sample rates and in different sample formats. ASIO
drivers are available for the MacOS and Windows operating system [12].
Or as Steinberg’s marketing department likes to put it: The ASIO architecture forms
the backbone of Steinberg’s Virtual Studio Technology (VST). The user gets low latency,
high performance, easy set up and stable audio recording within VST. The entire system
becomes controllable and offers complete and immediate access to the audio system’s ca-
pabilities. Since its introduction, ASIO has become a supported standard by many leading
audio hardware manufacturers - for good reason [7].
The following sections give an overview over the ASIO API and were taken from the
Steinberg ASIO SDK 2.1 documentation [8]:
1
at 96kHz sample rate and a buffer size of 64 samples
37
7. Programming framework
7.2.1. Operation
The audio subsystem is treated as a software component called an audio driver, which
means that ASIO requires hardware manufacturers to provide a driver that abstracts the
hardware in an ASIO-compatible way. The host application loads the driver and links it
to itself. Depending on the operating system, different methods are necessary.
Init Initialize the driver for use by the application. Optionally acquire hard-
ware or load additional driver components. ASIOInit()
CreateBuffers Allocate memory for the audio buffers and allocate hardware resources
for the audio channels. ASIOCreateBuffers()
Start Starts the audio streaming process. ASIOStart()
Stop Stops the streaming process. ASIOStop()
DisposeBuffers Deallocates hardware resources for the used channels and disposes the
memory for the audio buffers. ASIODisposeBuffers()
Exit Deallocates any remaining resources and puts the driver back into the
uninitialized state. ASIOExit()
Additional queries were introduced with ASIO 2.0 and will occur via the ASIOFuture()
call. They are listed in table 7.3
passes the index of the double buffer half, which has to be processed, to the application.
Upon return of the callback the application has read all input data and provided all output
data.
Callback No: 0 1 2 3 4 5 6
BufferIndex: 0 1 0 1 0 1 0
SystemTime(ms): 2000 2000 2023 2046 2069 2092 2116
SamplePosition: 0 1024 2048 3072 4096 5120 6144
Please note in the above table the same system time is used for the first two call-
backs, as the hardware did not start yet. Since ASIO implements a constant streaming
model, the time information of the first few bufferSwitch callbacks has to be ignored.
The media synchronization process will start once the host application detects the con-
stant streaming process. It can be assumed that the streaming will be constant after the
third bufferSwitch callback, more sophisticated detection methods however are preferred
as some driver/hardware combinations might retrieve more audio data for the hardware
output processing.
Note: A host application has to defer processing of these notification to a later ”secure”
time as the driver has finish its processing of the notification. Especially on the kAsioRe-
setRequest it is a bad idea to unload the driver during the asioMessage callback since the
callback has to return back into the driver, which is no longer present.
sampleRateDidChange() informs the host application that the driver detected a sam-
ple rate change. Usually only used for an external clock
source which changes its sample rate
A more detailed description of the ASIO API as well as the complete function reference
can be found in [8].
7.3. PortAudio
PortAudio is an open-source library that provides streaming audio input and output.
It simplifies the development of audio applications by hiding the complexity of device
interfacing from the programmer. It is a cross-platform application programming interface
(API) that works on Windows, Macintosh, Linux, SGI, FreeBSD and BeOS. This means
that audio-processing programs can run on different architectures just by recompiling the
source code. PortAudio is intended to promote the exchange of audio synthesis software
between developers on different platforms [12].
41
7. Programming framework
7.3.3. Lifecycle
A PortAudio program goes through the following steps:
The PortAudio library is initialized and a stream for audio I/O opened
The stream is started. The callback function will be now be called repeatedly by
PortAudio in the background. It can read audio data from the inputBuffer and/or
write data to the outputBuffer
Table 7.7 shows the functions a standard PortAudio application runs through during it’s
life cycle. The right column shows the ASIO calls that are performed by the PortAudio
library on behalf of the caller.
Table 7.7.: PortAudio life cycle and corresponding ASIO calls [12]
#include "portaudio.h"
PortAudioStream *stream;
PaError err;
42
7.3. PortAudio
return err;
The next listing shows an example PortAudio callback function that calculates a simple
left and right sawtooth signal and writes it to the output buffer. This example was taken
from the PortAudio tutorial [4]:
int patestCallback( void *inputBuffer, void *outputBuffer,
unsigned long framesPerBuffer,
PaTimestamp outTime, void *userData )
{
unsigned int i;
/* Cast data passed through stream to our structure type. */
paTestData *data = (paTestData*)userData;
float *out = (float*)outputBuffer;
/* Generate simple sawtooth phaser that ranges between -1.0 and 1.0. */
data->left_phase += 0.01f;
/* When signal reaches top, drop back down. */
if( data->left_phase >= 1.0f ) data->left_phase -= 2.0f;
43
7. Programming framework
}
return 0;
}
A more detailed description of PortAudio can be found in [4], the PortAudio ASIO
implementation is documented in [12].
7.5. MATLAB
Mathworks’ MATLAB2 is a technical computing environment that combines algorithm de-
velopment, data analysis and visualization and numeric computation. It features some sort
of high-level programming language, but also has the ability to call external C subroutines
from within MATLAB.
7.5.2. PaWavPlay
PaWavPlay [6] is an open-source MATLAB library that provides real-time multi-channel
audio processing. It contains support for DirectX, Windows MultiMedia Extensions
(WMME) and ASIO drivers, making it more useful for ANC purposes than MATLAB’s
built-in audio processing functionality. It was used for a couple of first I/O tests, mea-
suring signals to calculate the transfer functions of the various components of the system,
and also as a starting point for the final application described in chapter 8.
2
The name MATLAB acutally stands for MATrix LABoratory
44
7.6. LaTex and TeXnicCenter
7.7. CVS
In order to manage document updates amongst the project participants and establishing
the possibility of doing rollbacks to a previous (known good) version, a concurrent versions
system (CVS) server was set up on a public internet server. All project-relevant documents,
such as reference material, pictures, measurement results, the LaTex documentation and
C++ source code were managed using CVS, which proved to be a flexible and secure way
of collaboration.
45
8. Application software
The final solution is a Windows Microsoft Foundation Class (MFC) application written in
C++ that shall be discussed in this chapter.
8.2. Classes
The application consists of the C++ classes described in table 8.1.
ANCApp the base class derived from CWinApp, see subsection 8.2.1
ANCDlg represents the main GUI window
AboutDlg represents the ”About” dialog window
PrefDlg represents the ”Preferences” dialog window
ANCPrefs stores global user preferences like sample rate, buffer size etc.
ANCWorker does the actual work of processing the audio data
ANCBuffer stores samples from the past that are required for FIR filtering
47
8. Application software
cation. Each application that uses the Microsoft Foundation classes can only contain one
object derived from CWinApp. This object is constructed when other C++ global objects
are constructed and is already available when Windows calls the WinMain function, which
is supplied by the MFC Library.
The MFC classes inheriting from CWinApp and CDialog were auto-generated in Vi-
sual Studio .NET, and the code looks a bit chaotic. However, maintainance of the GUI
components using Visual Studio is very easy, so no big efforts to clean up the mess were
undertaken.
48
8.3. Graphical user interface
Because only one set of options is required (and expected!), ANCPref implements a
singleton pattern, meaning that only one instance of ANCPrefs can exist throughout the
application. It is accessed through a static function getInstance(), that will return a
pointer to the current instance.
An UML diagram showing the classes that the final application consists of can be seen
in figure A.2 in the appendix.
For example, basic application settings can be configured in the Preferences dialog at
49
8. Application software
runtime, and bar graphs will visualize the current signal amplitudes on the various in-
and output channels of the system in order to give the user a visual impression about the
current state of the system.
Also, a button to reset the adaptive filter was added, allowing to enforce a new adapta-
tion cycle during runtime of the application.
Finally, a nice About dialog gives details about the authors of the software.
A screenshot of the running application is shown in figure 8.4.
50
8.5. Audio processing
to dynamically adjust the filter coefficients. The filtered samples are then written to the
output buffer to provide PortAudio with something to play back while recording the next
block. The current block (from the input buffer) is also written to the ring buffer in
order to make it available for future FIR calculations. After this is done, the callback
function has finished, and the process starts all over when it gets invoked the next time
by PortAudio.
In order to gracefully terminate streaming, a check for the thread handle stopThread is
performed every time the callback method gets invoked, returning anything unequal zero
then notifies the end of the stream to PortAudio, bringing the streaming process to an
end.
51
8. Application software
As latency is absolutely mission-critical in any ANC system, keeping the I/O latency
between the input and output of the sound card as low as possible was one of the major
challenges. Thanks to the ASIO compliant sound card and according driver-support, it
was possible to keep latency between the input and output of the sound card at 2ms,
which is about as good as it gets with modern professional PC sound-hardware.
The latency has the following causes while sound is being processed by the system:
First, the input buffer of the sound card is filled with samples. At 96kHz sample rate
with a buffer size of 64 samples, this takes 64 ∗ 1/96000 = 666us. Next, the PortAudio
library calls the callback function in order to do the actual processing. As the callback
function is called every time that PortAudio has a full input buffer and requires new data
for the output buffer, the application has another buffer-length to do the processing. After
processing, the filtered samples are put into the PortAudio output buffer and the callback
function ends. Now PortAudio will put these samples into the output buffer of the sound
card, that finally plays them back. This costs another block-length, which adds up to the
2ms total I/O latency, as shown in figure 8.7.
8.7. Multi-Threading
In order to keep the GUI ”alive” and responsive while processing the data, ANCWorker
is spawned in a different thread than the GUI, thread synchronization is done through
event-based communication.
For example, in order to gracefully stop a running thread, the thread has to be passed
two event-handles - let’s call them hStopThread and hWaitThread - when it’s started. It
will then periodically check the state of hStopThread, the event that in our case can be
set / unset by the user using the ”Start/Stop” button. As soon as the stop-event has been
received by the thread, hWaitThread is set, signaling to the caller that the thread is about
to end, but has not yet ended, i.e. it’s still working through it’s destructors.
Another thread, called DisplayThread is spawned in order to periodically update the
GUI with data from ANCWorker. This thread basically reads the amplitudes of the
various in- and outputs and displays them as progress bars in the GUI to give the user an
impression of the signal amplitudes currently involved.
52
8.8. Tests and debugging
53
9. Measurements and results
This chapter describes the tests and measurements performed with the final ANC system
and documents the results obtained.
9.1. Simulation
Before implementing a certain algorithm, a simulation was usually performed first in order
to determine its usefulness for ANC, analyzing aspects of convergence-speed, stability
and performance. Most of the simulations were performed in MATLAB, the first C++
implementations were also simulations in order to verify correct implementation of the
algorithm before testing with real signals.
9.2. Measurements
The hardware setup used to measure the ANC system’s noise reduction performance is
described in section 6.5.
55
9. Measurements and results
A downside of using periodic signals is that under certain circumstances, the LMS algo-
rithm can become unstable, a phenomenon called ”entrainment” that is still a matter of
research at this time [2]. For the ANC system under investigation, this would sometimes
56
9.2. Measurements
result in very loud audio feedback noises, a problem that had to be mitigated by imple-
menting a ”supervisor” function in the application that would reset the adaptive filter’s
coefficients when it became clear that things were getting out of hand.
(a) Spectrum between 0 and 2kHz (b) Spectrum between 0 and 10kHz
The spectrum shows good performance for frequencies between 500 and 1800 Hz. How-
ever, for higher frequencies, the system actually generates more noise.
57
9. Measurements and results
(a) Spectrum between 0 and 2kHz (b) Spectrum between 0 and 10kHz
sizes would result in the filter not adapting fast enough to the (slowly changing) distur-
bances, leading to no real cancellation of the disturbance. Bigger step sizes on the other
hand would make the filter adapt too fast, resulting in strange distortions of the original
disturbance rather than cancellation.
9.3. Competition
As already mentioned, a broad range of ANC headphones is already commercially avail-
able. This section has a look at some of those readily available solutions and how they
compare.
58
9.3. Competition
59
9. Measurements and results
problems noticed were aparently some hiss noises caused by the headphones’ electronics1 .
Retailing around 250 US$, the price tag for BOSE’s QuietComfort 2 headphones is quite
high compared to the other models.
1
A problem that BOSE claims to be only audible thanks to their superior ANC technology
60
10. Conclusion
This chapter discusses the conclusions reached during the course of the project, as well as
possible improvements of the system.
61
10. Conclusion
62
10.5. Acknowledgements
Besides, splitting up the different tasks between the team members provided for a flexible
way of arranging duties, allowing for independent work on the various assignments, with
coordination meetings to define deadlines and the future course of the project.
As project management can sometimes become quite a burden, we believe that our
approach of sticking to a couple of basic milestones but not spending too much time on
creating a super-detailed project-plan formed a good compromise.
Also, writing the theory parts of the documentation already during the preliminary
studies proved to be a time-saver toward the end of the project when the schedule got
tighter.
10.5. Acknowledgements
We would like to thank the Digital Signal Processing Laboratory assistants Matthias En-
gelhardt and Ursin Tuor for their support with Windows MFC and real-time programming
as well as digital signal processing.
We would also like to thank Prof. Dr. Guido Schuster for ad hoc support towards
the end of the project when urgent questions came up and our supervisor was missing in
action1 .
1
Unfortunately, Fabian Meier had to work abroad during our thesis and was sometimes hard to reach
63
A. Appendix
A.1. Pre-amplifier circuit diagram
65
A. Appendix
66
List of Abbreviations
67
List of Figures
69
List of Tables
71
Bibliography
73