Você está na página 1de 81

Diploma Thesis

Active Noise Control

Authors:

Aleksandar Milosevic and Urs Schaufelberger

Rapperswil, December 14, 2005

Supervisor:
Fabian Meier, CTO G–Innovation ”Geneva” GmbH

Digital Signal Processing Laboratory


Department of Electrical Engineering
University of Applied Sciences Rapperswil HSR
Abstract

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

3. Digital signal processing theory 15


3.1. System identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2. Adaptive filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3. MSE algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3.1. Least Square . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.3.2. Least Mean Square . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

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

6. ANC system buildup 31


6.1. Detailed environment description . . . . . . . . . . . . . . . . . . . . . . . . 31
6.2. Estimation of unknown filters . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.2.1. Estimation of S(z) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.3. ANC system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.4. Hardware components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.4.1. PC system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.4.2. Sound card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
6.4.3. Microphones and preamplifiers . . . . . . . . . . . . . . . . . . . . . 35
6.4.4. Headphones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
6.5. Hardware setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

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

8.4. Life cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50


8.5. Audio processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
8.6. I/O Latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
8.7. Multi-Threading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
8.8. Tests and debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

9. Measurements and results 55


9.1. Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
9.1.1. Simulations performed in MATLAB . . . . . . . . . . . . . . . . . . 55
9.1.2. Simulations performed in C++ . . . . . . . . . . . . . . . . . . . . . 55
9.2. Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
9.2.1. Measurement technique . . . . . . . . . . . . . . . . . . . . . . . . . 56
9.2.2. Low frequency periodic signals . . . . . . . . . . . . . . . . . . . . . 56
9.2.3. White noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
9.2.4. Engine noises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
9.2.5. Sine sweep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
9.2.6. Human voice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
9.3. Competition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
9.3.1. Pro Tech Communications’ Noisebuster . . . . . . . . . . . . . . . . 58
9.3.2. Plane Quiet NC6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
9.3.3. BOSE QuietComfort . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

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.

1.1. Problem definition


The project should first analyze the mechanisms of sound propagation and the principles
digital signal processing, particularly adaptive filters. Furthermore, the basics of active
noise cancelling (ANC) and the differences between wanted and unwanted signals (also
known as ”noise”) should be investigated. The next step will involve developing algorithms
to be used for active noise cancelling, verify them via simulations, and come up with a
practical software implementation of the discovered solution.
Possible implementations of an ANC system include:

ˆ ANC-Headphones in an open-plan office for comfort calmness on all frequency bands.


However, most of the higher frequencies will get absorbed by the headphones isola-
tion already, so this solution would mainly have to deal with low-frequency signals.
ˆ ANC-Headphones in a vehicle (car, helicopter, etc) to cancel engine noises only.
Easier because it only has to deal with (slowly varying) periodic signals. Again,
mainly low-frequency signals have to be dealt with.
ˆ Reading corner: A corner of a room that should be kept quiet for studying etc. while
the rest of the room can be filled with buzzing noises (human voices, cellphones, etc).
This would allow for an impressive presentation because people won’t have to wear
headphones to enjoy the soothing effects of ANC!
ˆ ANC-Auditium: Cancelling students’ noise while still allowing the lecturer to be
heard. Academically interesting, but probably one of the more challenging tasks as
global noise cancellation for a large room isn’t exactly straight-forward.
ˆ Music annihilator: Cancelling music coming directly out a loudspeaker. Presumably
quite easy to realize because the sound is coming from a clearly defined direction.

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.2. Responsibility assignments


The responsibilites in this project have been roughly split up between the two participants,
according to prior knowledge and personal interests.

1
1. Task definition

Aleksandar Milosevic will cover the following parts:

ˆ Digital signal processing and adaptive filters

ˆ Development and simulation of the required algorithms in MATLAB

Urs Schaufelberger will be made responsible for:

ˆ Choice of hardware / software platform, integrated development environment (IDE)


and programming language

ˆ Real-time implementation of the final solution on the chosen platform

Both participants will be equally responsible for:

ˆ Getting familiar with acoustics and the principles of ANC

ˆ Project management

ˆ Task definition and functional specification

ˆ Documentation and final presentation

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

Figure 1.1.: Project 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.

2.1.1. Sound characteristics


Sound is defined by many factors. The most important are:

ˆ 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

Figure 2.1.: Wave propagation [16]

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

Table 2.1.: Examples of sound-propagation velocities [16].

2.1.2. Sound, tone, noise

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:

f = (f0 + n · f0 ) Hz, n ∈ N ∧ n ≥ 0 (2.2)

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

2.1.3. Sound terms


The usage of some specific acoustics terms may confuse. The most common and important
terms and definitions are listed below. A more detailed description can be found in [16].

2.1.3.1. Sound pressure


The change of pressure caused by sound is called sound pressure. It is the most im-
portant factor in acoustics. The caused pressure is superposed to the existing ambient
pressure. Like in other areas, it is mostly given as an effective value. The used symbol is p
respectively peff . For harmonic vibration the sound pressure can be computed as follows:

pe = ∆p0 cos(ωt − kx) (2.3)

The effective value is then:

∆p0
peff = √ (2.4)
2

2.1.3.2. Sound particle velocity


The velocity of the vibrating particles (moving at their idle state) is called the sound
particle velocity v measured in ms−1 . It is computed by the derivation of the sound
pressure amplitude. For harmonic vibrations:

v = ξ˙ = ωξ0 cos(ωt − kx) = v0 cos(ωt − kx) (2.5)

(Note: Do not confuse the sound particle velocity with the wave propagation speed, both
are measured in ms−1 .)

2.1.3.3. Sound pressure amplitude


The amplitude of the vibrating particles is called the sound pressure amplitude ξ.

2.1.3.4. Sound radiation impedance


A characteristic of the medium in which the sonic wave is propagating is the sound radi-
ation impedance Z measured in kgm−2 s−1 . It can be considered as a kind of resistance
and is computed using equation 2.6, where ρ is the density of the medium.

Z = ρu (2.6)

The relation between sound pressure and the sound radiation impedance is shown in
equation 2.7

∆p0 = Zv0 (2.7)

7
2. Sound theory

2.1.3.5. Sound pressure level


The sound pressure level (SPL) describes the logarithmic ratio of a sound pressure to the
reference value of peff0 = 2 · 10−5 Pa. The SPL can be computed using equation 2.8.
 
peff
Lp = 20 log (2.8)
peff0
Note that this level is only valid for a medium with Z = 400kgm−2 s−1 , which is the
value for air at about 20 ‰.

2.1.3.6. Sound power level


The sound power level (SWL) describes the logarithmic ratio of a sound power to the
reference value of P0 = 10−12 W. The SWL can be computed using equation 2.9.
 
P
Lp = 10 log (2.9)
P0
Table 2.2 shows some sound sources and their power levels.

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

Table 2.2.: Power of different sound sources [16].

2.2. Sound perception and measurement


The human ear can hear sounds between 16 and 20000 Hz. The upper frequency limit is
dependent on the age of a human being, it decreases with aging. For example, a 25 year
old person can hear frequencies up to approximately 20000 Hz. A 35 year old person up
to 15000 Hz and a person of 65 years up to 5000 Hz [16].

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.

Figure 2.2.: Curves with same loudness [16]

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

loudness. Therefore another parameter is needed which describes a linear combination


between the objective numerical value and the psychoacoustic effect. This is reached with
the loudness value ”sone”. To a sound with the loudness of 40 phone, the value of 1 sone
is assigned. Over 40 phones, each rise of 10 phones doubles the sone value. The following
relationship between the two values can be established:

S = 20.1(LS −40) (2.10)


Using sound level measurement instruments, several frequency selective filters can be
used. With their assistance the frequency dependent human ear can be reverse engineered
approximately for different sound level spans. The normed valuation curves are marked
with A, B, C and D. In practice, the A-scale is mostly used. Its unit is dB(A) or dBA.
The dB(A)-scale corresponds approximately to the phone-scale up to 90 phone. Sound
levels above 100 phone are scaled in the dB(C)-scale. The dB(B)-scale between the dB(A)
and the dB(C)-scale is no more used. The special dB(D)-scale is used for aircraft noise.
Table 2.3 shows some typical sound level values.

Source Sound Level in dB(A)


Silence, Beginning of Hear Sense 0...10
Susurration 20
Silence Backyard 30
Damped Speech, Silence Domicile 40
Normal Speech 50
Loud Speech, Vacuum Cleaner 60
Street Noise 70
Loud Music 80
Loud Street Noise 80...90
Klaxon, Jackhammer 90...100
Engine Test Bench 100...110
Riveting Hammer 110...120
Propeller (5 m distance) 120...130
Jet (5 m distances) 130...150
Explosion 150...160

Table 2.3.: Typical sound level values [16].

As there is no absolute way for measuring awareness, the question of perception is


hard to evaluate scientifically. Some sources [11] suggest that for lower frequencies (up to
approximately 600Hz), delays shorter than 10ms cannot be perceived, whereas differences
in delay of more than 2ms for higher frequencies can be heard by a human being. Of
course, the human perception uses very small delays in order to give us a three-dimensional
impression about where a certain sound might have come from, where differences as small
as 30us can be distinguished, but directional hearing is a subconscious process that will
only make the result of the lateration conscious. Delays above approximately 2ms are no
longer considered to be caused by directivity (probably because most people’s ears are
not more than 25cm away from each other, which should under normal circumstances
never result in delays of more than 1ms between the two ears), but are perceived as two
separate signals, usually an echo when the same signal comes in with different delays and
amplitudes.

10
2.3. Sound attenuation and sound damping

2.3. Sound attenuation and sound damping


First of all two terms must be explained which may confuse.

Sound attenuation means a sound reduction by absorption. Sound energy is transformed


to heat (energy) i.e. the medium which is penetrated by the sound gets warm.

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.

2.3.1. Sound attenuation


When a sound wave strikes the surface of another medium, a part of it is reflected and
another part is absorbed by the medium. The reflected part grows with the difference
between the sound radiation impedance (see section 2.1.3.4) of the medium and that one
of the air. The force of the absorbed part depends on the thickness of the medium. Also
the angle of incidence affects the absorption. When the incidence angle is unknown, a
statistical mean of the absorption value is used for the computation.

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.

For the measurement of the electro-acoustic properties of microphones and speakers,


reflexion depleted rooms are needed. If the surface of porous material has a lot
of little cotters or pyramids, a continuous crossover between the sound reflection
impedance of air and the one of the material results and the wave reflexion is held
low.

2. Porous layer with perforated media

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

A thin, air-impermeable disk, which is mounted in front of a massive wall is put


into vibration by the arrival of sound waves. The disk is that thin and mounted
in a fashion that the flexural stiffness can be disregarded so only the air between
it and the wall is used as springing. The disk and the air cushion together form a
spring mass system which exhibits a defined resonant frequency. The attenuation
of the system is accomplished by the interior friction in the vibrating disk, by fric-
tion of the disk in its reattachments and by vibration transmission to the wall. An
additional attenuation can be forced by filling the hollow space with porous material.

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

Helmholtz resonators (H.L.F. von Helmholz, (1821-1894)) are made up of a air


filled hollow and a short tube. The air in the hollow serves as spring and the air in
the tube as mass. Hollow resonators absorb at low frequencies. The combination
with acoustic disks is made easily.

The absorptance is defined as:


α=1−R (2.11)

 2
Z1 − Z2
R= (2.12)
Z1 + Z2

R is the reflectivity. With porous layers, an absorptance up to 0.8 can be reached.

12
2.3. Sound attenuation and sound damping

2.3.2. Sound damping


In sound transmission it must be differed between airborne sound and impact sound. There
are sources which emit (almost) all their sound energy into the air, typical examples are
the human voice, violins, speakers and wind instruments. Other sources transmit their
sound energy not only into the air but also into solid bodies. Bowed instruments like cello
or contrabass and piano or grand piano, transmit their sound energy directly to the floor.

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.

A measurement is the sound insulation:


 
P1
R = 10 log (2.13)
P2
(Note: Do not confuse the reflectivity (Equation 2.12) with sound insulation.)

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].

3.1. System identification


In many cases the transfer function of an unknown system is desired. Either an adaptive
algorithm (see section 3.2) is used or the transfer function is computed with some digital
processing.
Let’s consider the system in figure 3.1 with its input s(t) and the output f (t). The
autocorrelation function (ACF) of a signal shows the inner binding of a signal. For example
it is possible to look after periodic happenings of a signal. Equation eq:autocorrelation
shows the computation of the ACF of a signal:

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(ω)

Figure 3.1.: Filter with in- and output

Corresponding to the Wiener-Khintchine theorem, the autocorrelation function and the


power density spectrum build a Fourier couple. Passing this legality to the case of two
signals, the cross power density spectrum can be computed as Fourier transform of the
cross correlation function.

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.

3.2. Adaptive filters


The objective of an adaptive filter is to emulate the transfer function of an unknown
system. The coefficients of a finite impulse response (FIR) filter are changed (adapted)
to match as closely as possible the unknown transfer function. Infinite impulse response
(IIR) filters are rarely used in adaptive systems. They can get unstable and increase the
risk of the whole system getting unstable.

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) d(n) + d(n)


H(z) -

x(n)
H(z)

Figure 3.2.: Adaptive filter block diagram.

3.3. MSE algorithms


Figure 3.3 shows the basic structure of an adaptive filter. The aim is to adapt the FIR
filter coefficients so that the mean square error is getting minimized. Therefore, first of
all the MSE must be defined as a function of the filter coefficients and is labeled Q.

M SE = e2 (i) = Q(c0 , c1 , . . . , cN ) (3.5)


As can be seen in figure 3.3, the error and consequently Q are computed as:

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

s(i) s(i-1) s(i-n) s(i-N)


−1 −1 −1 −1
z z z z

c0 c1 cN cN

f(i)
+ -
r(i) s(i-n)
e(i) Algorithm

Figure 3.3.: Base structure of adaptive filters [18]

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:

gradQ = −2E{e(i)s(i − n)} (3.14)

The minimum condition can be given by equation 3.13:

E{e(i)s(i)} = 0 (3.15)

3.3.1. Least Square


In its simplest form, the algorithm solves equation 3.13 which describes the condition
for MSE. Considering equation 3.6, the algorithm can be described with the following
equations:

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 )

(Note: Rss is an even function, i.e. Rss (−n) = Rss (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:

Rss c = Rsr (3.21)


⇒c = R−1
ss Rsr (3.22)

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.

3.3.2. Least Mean Square


In many cases the system is adapted using the least mean square (LMS) algorithm or
variations like normalized LMS, standard-LMS or block LMS. LMS is the most widely
used adaptive filtering algorithm. Especially with ANC systems, the usage of LMS and
its variations is widespread.

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.

4.2. Noise control


In order to control unwanted sounds, two different approaches exist, called passive and
active noise control. In many cases a combination of both is used.

4.2.1. Passive noise control


The traditional approach of reducing noise (”sound proofing”) is to use passive methods
like insulation and silencers. A typical example are the ear muffs of headphones. As
described in section 2.3, good attenuation is achieved when using materials with special
characteristics. This form of noise reduction works best for higher frequencies, basically
acting like a low pass filter. In some cases, the low frequencies are noticed even more [1].
However, when used for lower frequencies, passive solutions tend to get bulky and heavy
as the size and mass of passive treatments usually depends on the acoustic wavelength,
making them bigger and more massive for lower frequencies [15].

4.2.2. Active noise control


Active techniques, known as ”active noise control”1 are one of the hot research topics in
acoustics these days. Active noise control (ANC) is using the phenomenon of wave interfer-
1
Active noise cancellation, adaptive vibration suppression, electronic disturbance rejection and many
other synonyms exist and can be used alternately

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.

4.2.3. Basic ANC components


In control systems jargon, an ANC system consists of the following four major parts:
Plant — The physical system to be controlled. A typical example is a headphone and
the air inside it.
Sensors — The vibration sensors, microphones, or other devices that sense the primary
disturbance and monitor how well the control system is performing by measuring the
remaining error.
Actuators — The devices that physically do the work of altering the plant response,
usually electromechanical devices such as speakers or vibration generators.
Controller — A signal processor that controls the actuators. It bases its commands
on the sensor signals and on some knowledge of the plant’s response to the actuators.

Figure 4.2 shows the fundamental structure of a basic ANC system.

Figure 4.2.: Basic structure of a feedforward ANC system

22
4.2. Noise control

4.2.4. Different kinds of ANC


The variety of behavior characteristics of sound waves in different physical surroundings
allow categorization of ANC systems into three different groups [10]:

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].

4.2.5. Basic ANC approaches


Under the assumption that the system is linear and time invariant (LTI), there are two
different basic approaches to ANC, which shall be discussed in this section.

Feedforward control — These systems depend on a direct measurement of the primary


disturbance and an a priori knowledge of the plant transfer function. The approach is
known as feedforward compensation because the compensator is not contained within a
feedback loop. The advantage of this approach is increased stability since the compensator
has no influence on the signal at it’s input.
Figure 4.3 shows a block diagram of a linear feedforward disturbance cancellation sys-
tem, where U(s) represents the command input, C(s) represents the compensator, P(s)
represents the plant transfer function, D(s) represents the external disturbance and Y(s)
represents the system output. G(s) represents the possibility of a linear transformation
2
usually below 600 Hz

23
4. ANC principles

Figure 4.3.: Linear feedforward control for disturbance rejection [5]

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.

Figure 4.4.: Linear feedback control for disturbance rejection [5]

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)

4.2.6. History of active noise control


The idea of active noise control has actually been around since the 1930s3 . However,
it was not until the advent of modern microcircuits and digital computers that active
control became truly practical. In recent years, the technology has been widely studied
3
Lueg, P., ”Process of silencing sound oscillation,” U.S. Patent No. 2 043 416, 1936

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.

4.3. Practical experiment


One of the very first ANC experiments consisted of two loudspeakers fed with sinus signals
of the same frequency and amplitude, but phase reversed. By setting these loudspeakers
up at the correct distance, global cancellation of the sinus signals could be achieved. This
is a special case because the signals are periodic and always stay the same (a standing
soundwave in the room if you like), and can thus be canceled not only by sending the
correct anti-signal in the same direction as the disturbance (the usual principle of ANC),
but also by sending the anti-signal against the propagation direction of the disturbance.

Figure 4.5.: Two speakers directed against each other at distance d

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.

4.4. Active noise control applications


Actually, there are many applications of ANC out there already, most of them probably
even unnoticed by the casual user.

4.4.1. Noise reduction in aircrafts


Using ANC to cancel low-frequency noise inside vehicle cabins for passenger comfort
is gaining popularity. Most major aircraft manufacturers are developing such systems,
mainly for noisy propeller-driven airplanes. For example, a system by Noise Cancellation
Technologies (NCT) now comes as standard equipment on the Saab 340B+ aircraft. This
equipment achieves an average reduction of about 6 dB(A). Another system for the SAAB
2000 propeller aircraft uses a multi channel controller with 27 loudspeakers and 72 micro-
phones to achieve a significant noise reduction of the first four harmonics of the propeller
blade passing frequency. On a King Air aircraft the usage of eight loudspeakers and 16
microphones reaches a reduction of noise of 10 dB.

4.4.2. Noise reduction in automobile industry


Automobile manufacturer Honda has an active noise cancellation system designed to re-
duce road noise using microphones and speakers placed under the vehicle’s seats, while
Siemens Automotive manufactures a system which utilizes a speaker mounted inside the

25
4. ANC principles

air intake manifold to suppress low frequency engine noise [5].

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].

4.4.3. Active headphones


One application that has achieved widespread commercial success are active headphones
to cancel low-frequency noise.
Actually, there are two different kinds of active headphones, but only one uses active
noise cancellation. Let’s call the two types active headphones and amplified earmuffs [15].
Active headphones — They rely on active noise cancellation for low-frequency qui-
eting. They are equipped with microphones on outside of the ear cups that measure the
noise arriving at the headphones. This noise is then being canceled by sending the corre-
sponding ”anti-noise” to the headphones’ speakers. For feedforward ANC, the unit also
includes a microphone inside each ear cup to monitor the error - the part of the signal
that has not been canceled by the speakers in order to optimize the ANC algorithm. Very
popular with pilots, active headphones are considered essential in noisy helicopters and
propeller-powered airplanes.
Amplified earmuffs — These are quite different, as they do not use active noise
cancellation at all. A heavy passive earmuff attenuates as much noise as possible while
microphones on the outside pick up sounds that would normally be heard by the ears.
These microphone signals are then filtered before being played by the speakers inside the
ear cups. The most common filtering is to mute loud, impulsive sounds such as gunshots.
Amplified earmuffs have therefore become quite popular with hunters, security forces and
the military, allowing users to maintain a conversation or even amplify sounds around
them while being protected from damage to their hearing[15].

4.5. Benefits of active noise control


The primary objective of most active noise control systems is the reduction of noise for
personal comfort, reduction of stress and increased concentration.
Another major benefit is low-frequency quieting for applications where passive insulation
would be too expensive, inconvenient or heavy. For example, the lead-impregnated sheets
used to reduce aircraft cabin propeller noise impose a severe weight penalty, but active
control can perform just as well at a much smaller weight. Active noise control also reduces
the vibrations induced into mechanical structures, thus prolonging lifetime and increasing
efficiency.
The cost for active noise canceling solutions is of course the additional power consump-
tion by the ANC sensors, controller and actuators, as well as increased complexity.

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

Figure 5.1.: Base problem analysis

5.1.1. LMS, NLMS algorithm


By the reason the error must be held as low as possible, the least mean square (LMS)
algorithm described in section 3.3.2 is considered, which is widely used in ANC systems.
One of the problems with LMS implementations is finding a decent value for the step size.

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

Figure 5.2.: LMS with different step sizes

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

Figure 5.3.: NLMS with different step sizes

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

Figure 5.4.: NLMS with the step size 1

5.1.2. Filtered-x LMS algorithm


As mentioned above, for the feedforward controlled system shown in figure 5.5, the primary
path P(z) should be reconstructed with an adaptive filter H(z). Since the error measure
should result in zero, the filtered reference signal should be the same as the transfered
signal over the primary path. But the reference signal filtered by the control filter H(z) is
not available directly and must be transformed over an unknown path S(z).

Noise P(z)

+
-
H(z) S(z)
error

LMS

Figure 5.5.: Block diagram feedforward control

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:

P (z) = H(z)S(z) (5.1)


P (z)
⇒ H(z) = (5.2)
S(z)

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

Figure 5.6.: Block diagram Filtered-x 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.

6.1. Detailed environment description


By the reason the ANC system is used in an environment with different transmission
characteristics, the challenge lies in recognizing and describing the different transmission
paths of the signals. Since the transmission of signals depends on the transmission medium,
the signal velocity changes (see section 2.1.1). Figure 6.1 and table 6.1 describe the
different transmission paths of the ANC system.

ˆ P(z) – Represents the primary transmission path of the noise source

ˆ N(z) – Represents the ear muffs of the headphones. By means of their passive
isolation, the ear muffs show low pass characteristic.

ˆ M(z) – Represents the reference microphone. The acoustic signal is transformed


into a electric one.

ˆ 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.

ˆ Summation/subtraction point – At this point the two signals 3) and 7) are


superimposed acoustically.

ˆ 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)

Figure 6.1.: Environment block diagram

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

Table 6.1.: Description of the environment

6.2. Estimation of unknown filters


As already discussed, the system has a few unknown transfer paths. With digital signal
processing work, some of the unknown information can be estimated. This estimated infor-
mation can be incorporated into the ANC system for a better and more stable performance
as shown in this section.

6.2.1. Estimation of S(z)


As described in section 5.1.2, the knowledge of the secondary path would increase the
performance of the ANC system. Since this transfer function is not known and it is not
possible to analyze it, only a part of it can be estimated. Considering the principles
of chapter 3, the transfer function of the headphones can be computed. By the fact
the headphones are close to the human ears and the error microphone is in between,
the transfer function is disturbed by acoustical reflections. However, measurements have
shown that implementing the estimated S(z) (S’(z)) increases the performance of the ANC
system.
The estimation of S’(z) was performed as follows:
White noise1 was played over the headphones (described in section 6.4.4). The white
1
In theory, white noise is a signal having the same power density over all frequencies

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

PC with ASIO support

Figure 6.2.: System buildup

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.3. ANC system


The final ANC system was developed on the basis of the congnitions above. Figure 6.3
shows the logical structure of the final ANC system. S’(z) represents the estimated filter
of the unknown transfer function.

6.4. Hardware components


This section describes the setup of the final ANC system, notably the hardware compo-
nents involved

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)

Figure 6.3.: System buildup

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

Table 6.2.: Final system description

Manufacturer: Fujitsu Siemens


Model: Celsius W340
Chipset: Intel 945G
CPU: Dual Pentium 4 3.4GHz
RAM: 2GB DDR2-533 SDRAM
HD: Seagate ST3160023AS, 160GB S-ATA, 7200 rpm, 8.5 ms
OS: Microsoft Windows XP, SP2

Table 6.3.: PC workstation specifications

34
6.5. Hardware setup

6.4.2. Sound card


The sound card was required to support the ASIO standard and come with the according
driver support. The choice fell on a M-Audio Delta Audiophile 2496, the hardware spec-
ifications for analog I/O are shown in table 6.4. The card also has digital (S/PDIF) and
MIDI I/O ports that were not used during this project.

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

Table 6.4.: M-Audio Delta Audiophile 2496 Specifications

6.4.3. Microphones and preamplifiers


For the reference and error microphone, electret condensator microphones small enough
to fit into the ear cups were used. To add some gain for weak signals and to provide the
microphones with the required bias voltage, small preamplifier circuits were built. The
design was taken from the Ferromel website[17], the circuit diagram can be seen in figure
A.1 in the appendix.

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.

6.5. Hardware setup


This section discusses the hardware components forming the final ANC system.
The headphones are equipped with one microphone on the inside (to measure the error),
and one on the outside (to measure the reference signal), the latter placed 69cm away
from the headphone in order to compensate for the 2ms constant I/O latency through
the system, as described in section 8.6. This should theoretically allow for broadband
cancellation, as the ANC system’s latency should be perfectly compensated by moving
the reference mic toward the signal to be canceled.
The setup can be seen in figure 6.4, the main components are described in table 6.6

3
Also called ”open aire” headphones
4
Also known as ”pamir”

35
6. ANC system buildup

Frequency response: 16Hz - 30kHz (-3dB)


12Hz - 38kHz (-10dB)
Acoustic principle: dynamic, ”open-aire”
Frequency curve: diffuse-field loudness equalization
Nominal impedance: 300W
Sensitivity @ 1 kHz: 97dB
Power handling capability: 0.2W as per DIN 45580
THD (as per DIN 45500): 0,1%
Sound coupling to the ear: circumaural
Headphone caliper pressure: approx. 2.5N
Weight (without cable): 260g

Table 6.5.: Sennheiser HD-580 specifications

Figure 6.4.: ANC system setup

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

Table 6.6.: Components of the ANC 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.1. Sound card driver


Because latency is absolutely mission-critical for any real-time application, and even more
so when dealing with ANC, using Windows MultiMedia Extensions (WMME) or DirectX
drivers for interfacing the sound card proved to be impractical.
Preliminary studies showed latencies - measured from the analog input, through the
software framework, and back to the output of the sound card - of over 40ms for Direct-
Sound, and with WMME things were even worse. Besides, neither DirectX nor WMME
can guarantee for constant latencies, so additionally supporting those two drivers in the
application was soon abandoned.
According to some sources [3], UNIX (including MacOS X and Linux) can obtain laten-
cies below 10ms when using very high thread priorities, however those values are still far
from the exceptionally low 2ms the ASIO driver turned out to provide1 .
A more detailed analysis of the system’s I/O latency can be found in section 8.6.

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.

The different states of the ASIO driver are:

Loaded — The driver code is accessible for the


application
Initialized — The driver has been allocated and
is accepting inquiries from the application. It is
not necessary that the hardware has already been
allocated
Prepared — The Audio buffers have been allo-
cated and the driver is prepared for running
Running — The hardware is running and the
audio streaming takes place

The commands to change from one state to an-


other can be found in table 7.1.
Figure 7.1.: Life cycle of the ASIO
driver [8]

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()

Table 7.1.: ASIO state change commands

7.2.2. Driver query by the host application


The ASIO API provides several inquiry functions for the host application and the driver.
After the driver is Initialized, the application will use the functions listed in table 7.2
to determine the hardware capabilities.
Note that as ASIOGetLatencies() will also have to include the audio buffer size of
the ASIOCreateBuffers() call, the application has to call this function after the buffer
creation. In the case that the call occurs beforehand the driver should assume preferred
buffer size.

38 Taken from Steinberg’s ASIO SDK 2.1 documentation


7.2. ASIO

ASIOGetChannels() query for the number of available audio channels


ASIOGetBufferSize() get the supported audio buffer sizes
ASIOCanSampleRate() ask whether a specific sample rate is supported by the
driver/hardware
ASIOGetSampleRate() get the current sample rate
ASIOGetClockSources() get the possible clock source options of the audio hardware
ASIOGetChannelInfo() get information about a specific channel (sample type, name,
word clock group)
ASIOSetSampleRate() Set a sample rate of the internal clock, should be used as
base sample rate if an external clock source is selected
ASIOSetClockSource() set the clock source of the card
ASIOGetLatencies() query for the constant audio latencies relative to the buffer-
Switch() callback

Table 7.2.: ASIO driver queries

Additional queries were introduced with ASIO 2.0 and will occur via the ASIOFuture()
call. They are listed in table 7.3

kAsioSupportsTimeInfo query for support of the new bufferSwitchTimeInfo() call-


back
kAsioSupportsTimeCode query for time code support of the audio hardware
kAsioSupportsInputMonitor query for direct input monitoring support

Table 7.3.: ASIO 2.0 capabilities queries

7.2.3. Host query by the driver


After the Prepared state the driver can query the application for information via the
asioMessage() callback. The possible queries are listed in table 7.4

kAsioSelectorSupported query whether the asioMessage selector is supported


by the application
kAsioEngineVersion query the host application for the ASIO version it im-
plements. The application will return the highest im-
plemented version. The host application is expected
to always support lower version implementations

Table 7.4.: ASIO driver callback

7.2.4. Audio streaming


The audio streaming starts after the ASIOStart() call. Prior to starting the hardware
streaming the driver will issue one or more bufferSwitch() or bufferSwitchTimeInfo() call-
backs to fill its first output buffer(s). Since the hardware did not provide any input data
yet the input channels’ buffers should be filled with silence by the driver.
After the driver started the hardware streaming the bufferSwitch() or bufferSwitchTime-
Info() callbacks will always be called when the hardware requires more data. The driver

Taken from Steinberg’s ASIO SDK 2.1 documentation 39


7. Programming framework

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.

7.2.5. Media synchronization


In order to provide proper media synchronization information to the host application a
driver should fetch, at the occurrence of the bufferSwitch() or bufferSwitchTimeInfo()
callback invocation event (interrupt or timed event), the current system time and sample
position of the first sample of the audio buffer, which will be past to the callback. The host
application retrieves this information during the bufferSwitch() callback with ASIOGet-
SamplePosition() or in the case of the bufferSwitchTimeInfo() callback this information is
part or the parameters to the callback.
Table 7.5 shows the callback sequence and its values for the bufferSwitchTimeInfo()
callback (1024 samples audio buffer size at 44100 Hz, system time at start is 2000 ms):

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

Table 7.5.: ASIO callback sequence example

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.

7.2.6. Driver notifications to the host application


The driver can notify the host application of the occurrence of some events which need
special treatment by the host application. The following notification messages will be send
via the asioMessage() callback:

kAsioResetRequest the driver needs a reset, in case of an unexpected event or a


reconfiguration
kAsioBufferSizeChange the buffer sizes will change, issued by the user (however few
applications support this yet, hence it is recommended to
issue the kAsioResetRequest instead)
kAsioResyncRequest the driver detected underruns and requires a resynchroniza-
tion
kAsioLatenciesChanged the driver detected a latency change

Table 7.6.: ASIO driver notifications

Note: A host application has to defer processing of these notification to a later ”secure”

40 Taken from Steinberg’s ASIO SDK 2.1 documentation


7.3. PortAudio

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].

7.3.1. Writing a PortAudio application


In order to write an application using the PortAudio library, ”portaudio.h” must be in-
cluded:
#include "portaudio.h"

portaudio.h contains a complete description of the PortAudio functions and constants.

7.3.2. Callback function


Simply put, a callback function is a function in a program, the address of which is passed
to the OS or some library. This external code then invokes the callback function when it
feels like it.
Every PortAudio application must contain a callback function to be called by PortAudio
when audio processing is needed.
The callback function is called every time that the output buffer has been exhausted
and/or the input buffer is full. The callback function is thus responsible for processing the
input buffer and producing some useful output for the output buffer. Upon return of the
callback, the user application should have read all input data and provided all the new
output data.
The PortAudio callback function must return an integer and accept exactly the following
parameters:
typedef int (PortAudioCallback)(
void *inputBuffer, void *outputBuffer,
unsigned long framesPerBuffer,
PaTimestamp outTime, void *userData );

Because the callback function is periodically called by PortAudio, userData is used to


pass a pointer to the application data required within the callback function.

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

ˆ The stream is terminated by returning 1 from the callback, or by calling a stop


function

ˆ The stream is closed and the library terminated

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.

initialize the library loadAsioDriver


ASIOGetChannels
Pa Initialize
ASIOCanSampleRate
ASIOGetChannelInfo
access the driver and open a stream loadAsioDriver
ASIOInit
ASIOGetChannels
Pa OpenSteam ASIOGetBufferSize
ASIOCreateBuffers
ASIOGetLatencies
ASIOSetSampleRate
Pa StartStream start audio processing ASIOStart
Pa StopStream stop audio processing ASIOStop
deallocate the stream structure ASIODisposeBuffers
Pa CloseStream
ASIOExit
Pa Terminate deallocate the library structures removeAsioDriver

Table 7.7.: PortAudio life cycle and corresponding ASIO calls [12]

7.3.4. Example PortAudio application


The following code listing shows an example PortAudio application:

#include "portaudio.h"

PortAudioStream *stream;
PaError err;

err = Pa_Initialize(); // initialize the library


if( err != paNoError )
goto error;

err = Pa_OpenStream( // access the driver and open a stream


&stream,

42
7.3. PortAudio

recdevID, // input deviceID


recbufflastchannel, // num input channels
paFloat32, // input sample format
NULL, // input driver info
deviceID, // output device ID
bufchannels, // number of output channels
paFloat32, // output format
NULL, // output driver info
samplerate, // stream sample rate
64, // frames per buffer
0, // number of buffers
paNoFlag, // stream flag
patestCallback, // callback function
&data); // user data

if( err != paNoError )


goto error;

err = Pa_StartStream( stream ); // start audio processing

if( err != paNoError )


goto error;

while( Pa_StreamActive(stream) ) // sleep while the stream is active


Pa_Sleep( 50 );

err = Pa_StopStream( stream ); // stop audio processing

if( err != paNoError )


goto error;

err = Pa_CloseStream( stream ); // deallocate the stream structure

if( err != paNoError )


goto error;

Pa_Terminate(); // deallocate the library structures

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;

for( i=0; i<framesPerBuffer; i++ )


{
/* Stereo channels are interleaved. */
*out++ = data->left_phase; /* left */
*out++ = data->right_phase; /* right */

/* 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;

/* higher pitch so we can distinguish left and right. */


data->right_phase += 0.03f;
if( data->right_phase >= 1.0f ) data->right_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.4. Visual Studio .NET


Being restricted to the Windows platform due to a lack of ASIO drivers for UNIX / Linux
operating systems, the integrated development environment (IDE) chosen for the project
was Microsoft’s Visual Studio .NET 2003. It proved to be a quite versatile programming
environment, offering lots of functionality that made boring, repetitive tasks easier and
facilitated debugging. It also offered good integration with additional tools like Visual
Paradigm for UML that was used to generate some of the UML diagrams in this report.

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.1. MATLAB extensions


MEX-files are subroutines produced from C or Fortran source code. From a user’s point of
view, they behave just like normal M-files and built-in functions. MEX-files have several
applications:
ˆ Large pre-existing C and Fortran programs can be called from MATLAB without
having to be rewritten as M-files
ˆ Bottleneck computations (usually for-loops) that do not run fast enough in MATLAB
can be recoded in C or Fortran for efficiency
ˆ Special hardware (e.g. ASIO sound card driver) can be accessed from within MAT-
LAB through a MEX library.
MATLAB was used during the preliminary studies to get familiar with the principles of
digital sound processing, and for the development and simulation of the algorithms used
for ANC.

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.6. LaTex and TeXnicCenter


LaTex is a document preparation system for the TeX typesetting program.
For compilation of the documentation, LaTex was chosen as the formatting language
because it was already known from former semester thesis work and is the de facto standard
in typesetting for research papers and books.
The documentation was written in TeXnicCenter, a free open-source IDE for LaTeX
under Windows, using the MiKTeX distribution, which allows the user to format its doc-
ument in LaTex and compile it to PDF, PS, or other formats. TeXnicCenter also has the
ability to maintain a bibliography (using BibTeX) and an index (using MakeIndex).

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.

7.8. Programming approach


As time was short and the traditional OOA/OOD approach of analysis - design - im-
plementation doesn’t work well for short-time projects where the requirements are very
dynamic, an approach similar to ”eXtreme Programming” (XP) was chosen as program-
ming methology. The main idea of XP is that parts of the software that are already known
to be required can be developed and tested separately from the rest of the application,
allowing for an iterative approach toward the final solution.
For example, the GUI, ring buffer, and preference classes were implemented and tested
long before the final algorithm for ANC had been found, which was an advantage because
the implementation didn’t have to wait until all the requirements were clear, but also
had disadvantages because the sound-processing part had to be re-written several times
according to changing requirements.

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.1. Driver and libraries


The layers forming the foundation of the ANC application can be seen in figure 8.1.
At the bottom sits the sound card, interfaced by the ASIO driver. The ASIO driver is
accessed through the ASIO library sitting on top of the driver. The ASIO library in turn
is abstracted by the PortAudio API, that again hides some functionality while offering an
easier, portable interface for sound processing to the programmer. The ANC application
thus uses the PortAudio API to access the sound system and get its audio processing done.

Figure 8.1.: Application foundation layers

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

Table 8.1.: Classes of the ANC Application

8.2.1. CWinApp class


The CWinApp class is the base class from which a Windows application object is derived.
An application object provides member functions for initializing and running the appli-

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.

Figure 8.2.: CWinApp children

8.2.2. CDialog classes


The classes representing a dialog window are derived from CDialog, the MFC base class
used for displaying dialog boxes on the screen. A dialog box, like any other window,
receives messages from Windows, particularly notification messages from the dialog box
controls, thus allowing the user to change program parameters and interact with the
application.

Figure 8.3.: CDialog children

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.

8.2.3. ANCBuffer class


The ANCBuffer class is a slightly modified version of an open-source thread-safe ring
buffer class written by David Griffiths, adapted to the needs of the ANC application.
For example, ANCBuffer can provide x blocks from the past (so as to do the necessary
FIR filtering), but only advance the read-pointer by one block in order to return the
correct blocks in the next run. Then, one block is written to and one thrown out of the
ring buffer at every application cycle (determined by PortAudio callbacks).

8.2.4. ANCPrefs class


The ANCPrefs class stores global configuration options, notably sample rate, buffer size,
step size for the adaptive FIR filters, and the like. These settings can be configured
through the PrefDlg MFC class, allowing the user to comfortably configure the application
at runtime.

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.

8.2.5. ANCWorker class


The ANCWorker is where the actual stream processing happens. When the user presses
the start-button within the GUI, a new high-priority thread is spawned for ANCWorker.
Because of the way PortAudio works - a callback function is called every time new output
data is required - we have to pass a struct with pointers to all the required data to
Pa OpenStream in order to be able to exchange information with the callback function.
Again, because only one instance of the ANCWorker is required, the class implements
a singleton pattern.

An UML diagram showing the classes that the final application consists of can be seen
in figure A.2 in the appendix.

8.3. Graphical user interface


Because the main purpose of the project was to build a working proof-of-concept ap-
plication demonstrating the capabilities of ANC, a nice looking graphical user interface
(GUI) was not a primary goal. However, as Windows MFC makes creating a GUI quite
easy, some effort was put into making the most important components of the application
accessible via a graphical user interface.

Figure 8.4.: Screenshot of the running application

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.

8.4. Life cycle


The life cycle of the application goes as follows: The user starts the application and is
presented with a GUI where he can choose to start the preferences dialog in order to
modify buffer size, sample rate and such, or start processing with the default options.
After pressing the ”Start/Stop” button, a new ANCWorker is spawned, performing the
adaptive filtering according to the given preferences. Pressing the ”Start/Stop” button
again stops the worker thread and allows the user to modify the preferences. To quit
the application, the user can press the ”Quit” button at any time. The life cycle of the
application can be seen in figure 8.5.

Figure 8.5.: Application life cycle

8.5. Audio processing


The processing of sound samples is accomplished by configuring and starting a PortAudio
stream. PortAudio will then start periodically calling the callback method whenever it
has a new block of samples in the input buffer and requires new samples for the output
buffer.
The activity diagram in figure 8.6 shows the program flow within the callback function.
After the user presses the Start/Stop button, the preferences are read and a PortAudio
stream is created and started. PortAudio then starts processing sound samples and will
invoke the callback function after the configured buffer size has been filled with samples.
The callback function will now read those samples from the input buffer, and try to read
additional samples from the past from the ring buffer. Should this fail - because the
ring buffer is still empty - a special routine is performed to pre-fill the ring buffer with
enough zeros to make the next read-call successful. If reading from the ring buffer has
provided enough samples, FIR filtering is performed, and the LMS algorithm is starting

50
8.5. Audio processing

Figure 8.6.: Activity diagram of the PortAudio callback function

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

8.6. I/O Latency

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.

Figure 8.7.: Sound I/O latency

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

8.8. Tests and debugging


The parts of the application that didn’t require real-time testing were of course quite easy
to verify, like the GUI and the ring buffer classes. The final application was a bit harder
to test because it required real-time input (from the reference and error microphones)
and output (to the headphone speaker). The first algorithm that was implemented was a
simple FIR low-pass filter with fixed coefficients. After getting this algorithm to perform
as required, LMS was added for adapting the coefficients to the changing environment.
Later on, NLMS and Filtered-X LMS algorithms were implemented in order to improve
the system’s performance. Chapter 9 describes the various measurements performed on
the ANC system and documents the results obtained.

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.1.1. Simulations performed in MATLAB


In order to evaluate the performance and convergence speed of the ANC algorithm, exten-
sive simulations in MATLAB were performed. Mainly the difficulties regarding LMS step
size and the LMS variations like NLMS and FXLMS were evaluated in MATLAB prior to
the implementation in C++. Chapter 5 describes the development of the ANC algorithm.

9.1.2. Simulations performed in C++


To test the adaptive filter implementation in the final C++ application, a simulation in
software was performed. The headphone transfer function was presumed to be some low-
pass filter of a certain order. So, an arbitrary Hanning low-pass FIR with fixed coefficients
was implemented in order to calculate the signal arriving at the ”inside” the headphone
from the reference signal on the outside. Then, after starting the simulation, the LMS
algorithm’s task was to adjust the adaptive filter so that it would be a mirror-image of
the transfer function of the headphone in order to minimize the error. Depending on
the step size (see section 3.3.2), the adaption is faster when using a large step size, but
can’t completely eliminate the remaining error, while for smaller step sizes, adaption will
take longer but the remaining error is going to be smaller in the end. The simulations
went quite well as long as the adaptive filter’s order was the same or higher than the
presumed headphone’s transfer function, with less coefficients the adaptive filter would
fail to perfectly rebuild the low-pass function of the headphones.

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

9.2.1. Measurement technique


For measurements of the system, a Hewlett-Packard network analyzer 4395A with an
Agilent 41800A high-impedance active probe was used.
In order to measure the system’s performance, the error-microphone was hooked up
to the spectrum analyzer using the high impedance active probe so as to distort the
original signal as little as possible. Next, with the ANC system still inactive, an external
disturbance signal was emulated using a loudspeaker and the spectrum analyzer would
start building an average over the signal energy captured by the error microphone in the
frequency bands under investigation. Then, the ANC system was turned on and after a
short time of convergence of the adaptive filter, another measurement with the spectrum
analyzer was performed to get the average signal energy for the frequencies of interest.
These two measurements were then be compared, showing the attenuation for the fre-
quencies concerned to get an estimate of the performance of the system.
For measurements between 0 and 2kHz, a resolution bandwidth of 3Hz on the spectrum
analyzer was used, and averaging was done over 15 runs. For measurements between 0 and
10kHz, the resolution bandwidth was set to 10Hz in order to keep sweep time reasonably
low. Again, an average was built over 15 sweeps.

9.2.2. Low frequency periodic signals


One of the first disturbance signals used were low frequency sinusoidal (periodic) signals,
first of all because they made it easy to get an auditory impression of the performance
of the system. Also, measurements were quite easy because only a single frequency was
involved. With the ANC system turned off, a marker on the spectrum analyzer could be
set on the frequency of interest, and after turning on the system, the attenuation achieved
thanks to ANC could be directly read off the spectrum analyzer in dB. First tests showed
around 30dB of attenuation for low frequency sinusoidal signals up to a few hundred Hertz.
The spectrum for a 180Hz sine wave disturbance with the ANC system turned on and off
respectively can be seen in figure 9.1.

Figure 9.1.: Measurement with 180Hz sine wave disturbance

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.

9.2.3. White noise


In order to verify the system’s performance across a large frequency band, white noise was
used as the primary disturbance, the results of the measurements are shown in figure 9.2.

(a) Spectrum between 0 and 2kHz (b) Spectrum between 0 and 10kHz

Figure 9.2.: Measurement with white noise disturbance

The spectrum shows good performance for frequencies between 500 and 1800 Hz. How-
ever, for higher frequencies, the system actually generates more noise.

9.2.4. Engine noises


Another disturbance signal tested was the sound of the rotor blade noise heard inside a
helicopter. The difference with the ANC system turned on was well audible, again low
frequency noises are canceled nicely while some of the higher frequencies are amplified.
For the human hearing, the spectrum sounds more balanced and less disturbing though.
The measurements using helicopter rotor noise as the primary disturbance can be seen
in figure 9.3.

9.2.5. Sine sweep


As noted above, a pure sine wave proved to be a suboptimal way to test the performance,
mainly due to the stability problems around certain frequencies, therefore attempts to use
a sine sweep for measuring the system’s performance were made.
However, using sine sweeps showed the same problems as constant sinusoidal signals,
resulting in instability of the system after coming across certain frequencies. Those mea-
surements could therefore not be fulfilled.

9.2.6. Human voice


Measurements using human voice recordings as the primary disturbance were also per-
formed, but it proved difficult to find a decent setting for the step size. Too small step

57
9. Measurements and results

(a) Spectrum between 0 and 2kHz (b) Spectrum between 0 and 10kHz

Figure 9.3.: Measurement with helicopter rotor noise disturbance

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.

Figure 9.4.: Measurement with speech disturbance

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.

9.3.1. Pro Tech Communications’ Noisebuster


Pro Tech Communications, Inc. manufactures a line of ANC headphones called Noise-
buster. Figure 9.5 shows the performance of the Noisebuster NB-FX active noise reducing
headphones in comparison with some (unfortunately unnamed) competitor models, try-
ing to underline Pro Tech Communication’s claim to manufacture the ”World’s BEST

58
9.3. Competition

Performing!” ANC headphones.

Figure 9.5.: Noisebuster NB-FX performance [14]

The specifications of the Noisebuster NB-FX can be found in table 9.1.

Frequency range: 20 - 20000Hz


Noise cancellation range: 40 - 1200Hz, maximum 18dB at 100-200Hz
Impedance: 15 Ohm/active - 36 Ohm/passive
Maximum power input: 60mW
Power: 1-AAA battery (included)

Table 9.1.: Noisebuster NB-FX specifications

The Noisebuster NB-FX retails for around 70 US$.

9.3.2. Plane Quiet NC6


An ANC headphone set manufactured by Plane Quiet, the NC6, gives a lot less details
about its performance, and only claims a ”combined passive and active noise cancellation
of 15dB at 300 Hz”. However, according to the ”Travel Insider” website [14], the difference
between the Noisebuster and the NC6 is barely audible. The NC6 sells for roughly 80 US$.

9.3.3. BOSE QuietComfort


Another manufacturer of ANC headphones is BOSE with their QuietComfort line of active
headphones. BOSE claims to have over 20 years experience in ANC, and owns over
10 U.S. patents regarding their ”full spectrum noise reduction” technology not found in
conventional active noise-reduction headphones.
Unfortunately, no detailed specifications or measurements are available, making it hard
to estimate their performance. However, they get pretty good user reviews, the only

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.

10.1. Technical conclusion


On the technical side, a broad range of technologies was covered during the course of
this thesis, some of which were already known (like the basics of digital signal processing,
C/C++ programming, etc.) and some were, more or less, new to us (like adaptive filter al-
gorithms, Windows MFC programming etc.). This definitely made the project interesting
and instructive, but also imposed an initial barrier that had to be overcome first.
The complexity of building a working ANC solution was probably underestimated at
the beginning, it proved to be a quite challenging task. With many factors having an
influence on the system, like nonlinearities of the analog components such as microphones
and headphone speakers, strong restrictions regarding latencies, instabilities of adaptive
filters when fed with certain signals, a lot of problems had to be solved in order to achieve a
system that worked more or less well. Building an application with real-time requirements
was also new to us, adding difficulties to the areas of debugging and of course timing.
This project has not only shown how to use the learned theoretical aspects during the
studies, it was also important to see how a prospective electrical engineer should proceed
doing his work. As already mentioned, at the beginning the pending subject was not well
known. So the decision felt on separating the unknown in different subjects what was
extremely helpful.

10.2. Possible improvements


The following section describes ideas for possible enhancements of the ANC system that
could not be realized during the project.

10.2.1. Active gain control


One improvement would be adding some sort of active gain control (AGC) between the
microphone pre-amplifiers and the sound card ADCs, on one hand to make full use of the
24-bit ADC resolution, but also to keep the adaptive filter from taking too big steps in
the case of very strong disturbance or error signals.
However, in combination with an ANC system, where knowledge about the original
signal’s amplitude is essential in order to successfully cancel the disturbance, it was not
possible to add a hardware AGC in front of the sound card without losing important
information about the original amplitude.

61
10. Conclusion

10.2.2. Considering the field of application


Since ANC can be used for various applications, like engine noise canceling, active head-
phones for personal comfort etc., the specific area of usage of the ANC system has to be
considered to optimize its performance. If ANC is used for canceling engine noises, the
system should concentrate on low frequencies, while for active headphones, the transfer
function of the headphones earmuffs is critical to the design of a good ANC system. The
next section describes how the system can be modified to respond to certain frequency
bands only.

10.2.3. Additional bandpass filters


In order to limit the system’s response to certain frequency bands that actually need to be
canceled - as opposed to the broadband ANC approach that the current system implements
- adding additional bandpass filters into the reference- and error-path would be necessary.
This would prevent the system from trying to cancel frequencies that don’t really need to
be actively canceled, like higher frequencies that get absorbed by the headphones passive
insulation. For other applications, this modification would also allow to cancel out only
certain frequencies while leaving the rest of the spectrum untouched.

10.2.4. Improved supervisor function


To alleviate the entrainment problems with LMS algorithms and periodic signals, a basic
supervisor function has already been implemented in the current solution. However, the
current function only watches the adaptive filters coefficients and will reset them to their
initial state if they become too big. The problems with entrainment are still a matter of
research [2], a smarter supervisor function would probably be a good enhancement.

10.3. Cooperation during the project


The cooperation between the team members was good, we were able to profit a lot from
each others knowledge and experience. Besides, we had a pretty good time and lots of
fun!
Cooperation with our supervisor was a bit difficult because communication was only
possible via e-mail, making it hard to discuss practical problems that require a physical
presence in front of the spectrum analyzer for example.
In compensation, we got a lot of support from our professor, Guido Schuster, helping
us with his vast knowledge and experience in the field of digital signal processing when we
needed it. 10 minutes help from an expert can sometimes save you from running in the
wrong direction for days!

10.4. Project management


Because of the large degree of uncertainty in research projects, proper project planning is
usually difficult, so no big efforts were put into setting up detailed schedules beforehand.
Some deadlines were defined at the beginning, such as the time frame reserved for pre-
liminary studies, design and implementation, and documentation towards the end of the
project. Then, care was taken to meet those basic milestones.

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

Figure A.1.: Microphone preamplifier circuit [17]

A.2. Application class diagram

65
A. Appendix

Figure A.2.: Class diagram of the ANC application

66
List of Abbreviations

ADC Analog-to-Digital Converter


AGC Active Gain Control
ANC Active Noise Control
API Application Programming Interface
ASIO Audio Streaming Input/Ouput
CPU Central Processing Unit
DAC Digital-to-Analog Converter
FXLMS Filtered-x Least Mean Square
GUI Graphical User Interface
HD Hard Disk
LMS Least Mean Square
LTI Linear and Time Invariant
MFC Microsoft Foundation Class
MSE Mean Squared Error
I/O Input / Output
OOA Object Oriented Analysis
OOD Object Oriented Design
OS Operating System
PC Personal Computer
PDF Portable Document Format
PS PostScript
RAM Random Access Memory
SDK Software Development Kit
S/PDIF Sony/Philips Digital Interconnect Format
SPL Sound Pressure Level
SWL Sound Power Level
THD Total Harmonic Distortion
UML Unified Modeling Language
VST Virtual Studio Technology
WMME Windows MultiMedia Extensions
XP eXtreme Programming

67
List of Figures

1.1. Project timeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.1. Wave propagation [16] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6


2.2. Curves with same loudness [16] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.1. Filter with in- and output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15


3.2. Adaptive filter block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3. Base structure of adaptive filters [18] . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4.1. A signal gets erased by its ”anti-signal”. The result is zero. . . . . . . . . . . . . . 22


4.2. Basic structure of a feedforward ANC system . . . . . . . . . . . . . . . . . . . . . 22
4.3. Linear feedforward control for disturbance rejection [5] . . . . . . . . . . . . . . . . 24
4.4. Linear feedback control for disturbance rejection [5] . . . . . . . . . . . . . . . . . 24
4.5. Two speakers directed against each other at distance d . . . . . . . . . . . . . . . . 26

5.1. Base problem analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27


5.2. LMS with different step sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.3. NLMS with different step sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.4. NLMS with the step size 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.5. Block diagram feedforward control . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.6. Block diagram Filtered-x LMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

6.1. Environment block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32


6.2. System buildup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.3. System buildup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.4. ANC system setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

7.1. Life cycle of the ASIO driver [8] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

8.1. Application foundation layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47


8.2. CWinApp children . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
8.3. CDialog children . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
8.4. Screenshot of the running application . . . . . . . . . . . . . . . . . . . . . . . . . 49
8.5. Application life cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
8.6. Activity diagram of the PortAudio callback function . . . . . . . . . . . . . . . . . 51
8.7. Sound I/O latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

9.1. Measurement with 180Hz sine wave disturbance . . . . . . . . . . . . . . . . . . . . 56


9.2. Measurement with white noise disturbance . . . . . . . . . . . . . . . . . . . . . . . 57
9.3. Measurement with helicopter rotor noise disturbance . . . . . . . . . . . . . . . . . 58
9.4. Measurement with speech disturbance . . . . . . . . . . . . . . . . . . . . . . . . . 58
9.5. Noisebuster NB-FX performance [14] . . . . . . . . . . . . . . . . . . . . . . . . . . 59

A.1. Microphone preamplifier circuit [17] . . . . . . . . . . . . . . . . . . . . . . . . . . 65


A.2. Class diagram of the ANC application . . . . . . . . . . . . . . . . . . . . . . . . . 66

69
List of Tables

2.1. Examples of sound-propagation velocities [16]. . . . . . . . . . . . . . . . . . . . . . 6


2.2. Power of different sound sources [16]. . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3. Typical sound level values [16]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

6.1. Description of the environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32


6.2. Final system description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.3. PC workstation specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.4. M-Audio Delta Audiophile 2496 Specifications . . . . . . . . . . . . . . . . . . . . . 35
6.5. Sennheiser HD-580 specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.6. Components of the ANC system . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

7.1. ASIO state change commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38


7.2. ASIO driver queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
7.3. ASIO 2.0 capabilities queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
7.4. ASIO driver callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
7.5. ASIO callback sequence example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
7.6. ASIO driver notifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
7.7. PortAudio life cycle and corresponding ASIO calls [12] . . . . . . . . . . . . . . . . 42

8.1. Classes of the ANC Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

9.1. Noisebuster NB-FX specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

71
Bibliography

[1] BOSE. Bose Acoustic Noise Cancelling Headphone Technology. http://www.bose.co.uk/


technologies/signal_processing/intro.asp, 2005.
[2] Steven Brossi and Janosch Nikolic. Entrainment in Adaptive Feedback Cancellation Systems.
University of Applied Sciences, Rapperswil, 2005.
[3] Phil Burk. PortAudio Latency. http://www.portaudio.com/docs/latency.html, 2002.
[4] Phil Burk and Ross Bencina. PortAudio Tutorial. http://www.portaudio.com/docs/pa_
tutorial.html, 2000.
[5] John C. Canfield. Active Disturbance Cancellation In Nonlinear Dynamical Systems Using
Neural Networks. University of New Hampshire, 2003.
[6] Matt Frear. Matlab multi-channel audio. http://sourceforge.net/projects/pa-wavplay/,
2004.
[7] Steinberg Media Technologies GmbH. Steinberg ASIO 2.1 Release Note. http://www.
steinberg.de/Steinberg/Company/NewsItem_06042005_asio21_eu.html, 2005.
[8] Steinberg Media Technologies GmbH. Steinberg ASIO SDK 2.1. http://www.steinberg.
de/Steinberg/Developers483b.html, 2005.
[9] S. M. Kuo and D.R. Morgan. Active Noise Control Systems. John Wiley & Sons Inc., New
York, 1996.
[10] S. M. Kuo, I. Panahi, K. Chung, T. Horner, M. Nadeski, and J. Chyan. Active Noise Control
Systems with the TMS320 Family. Texas Instruments Application Note, June, 1996.
[11] D. Leckschat. Verbesserung der Wiedergabequalität von Lautsprechern mit Digitalfiltern.
RWTH, Aachen, 1992.
[12] Stephane Letz. Porting PortAudio API on ASIO. http://kmt.hku.nl/~pieter/SOFT/CMP/
src/portaudio/pa_asio/Pa_ASIO.pdf, 2001.
[13] Vadakkan Ranjit Raphael. FXLMS Algorithm. http://education.vsnl.com/active_
noise_control/FXLMS.html, 2005.
[14] David Rowell. The Travel Insider. http://www.thetravelinsider.info, 2005.
[15] Christopher E. Ruckman. Active Noise Control FAQ. http://users.erols.com/ruckman/
ancfaq.htm, 2001.
[16] A. Ruh and B. Bucher. Wellen. HSR, 2003.
[17] Wilhelm Scharenberg. Mikrofon-Vorverstärker für Kristall-, Elektret- und dynamische Mikro-
fone. http://www.ferromel.de/tronic_1906.htm, 2005.
[18] A. Schüeli. Digitale Signalverarbeitung. HSR, 2002.
[19] J. Sedgewick. Cut Out That Racket. The Atlantic Monthly, November, 1991.
[20] van Dijk. Theory of Active Noise Control. http://www.wa.wb.utwente.nl/Lectures/
113172/.

73

Você também pode gostar