You are on page 1of 36

DIRE DAWA UNIVERSITY INSTITUE OF

T TECHNOLOGY

DEPARTMENT OF ELECTRICAL AND COMPUTER

ENGINEERING

STREAM: COMMUNICTION ENGINEERING

SEMISTER MINI PROJECT

TITLE: ADAPTIVE ACOUSTIC ECHO CANCELLATION IN


DDU ADMINSTRATION HALL
GROUP MEMBER NAME ID NO

1. EYASU KITARO R /0670/06

2. DING WAL R/0592/06

3. YONAS LEMMA R/1608/06

4. YONAS TIZAZU R/4001/06

ADVISOR: Mr Melese.D

SUBMISSION DATE: 26/06/2017 G.C

Dire Dawa Ethiopia


Declaration
We declare that the work reported in the present project title adaptive aquatic echo
cancellation is a record of work done by us in the School of Electrical & Computer
Engineering, Institute of technology, Dire Dawa University. This project is a presentation of
our original project work, except that no place in the text is indicated by special reference and
no part of the project has been submitted for any other degree. The work was done under the
guidance of our teacher Mr.Melese.D at Dire Dawa University institute of Technology, in
Dire Dawa Ethiopia.
LIST OF CONTENTS
CONTENTS

ACKNOWLEDGEMENT................................................................................................. IV
ABSTRACT........................................................................................................................V
CHAPTER ONE: INTODUCTIION ABOUT ECHO..............................................1
1.1 Background of project....................................................................................................1
1.1.1Adaptive filter....................................................................................................1
1.2 Problem statement...................................................................................................……2
1.3 Objective.........................................................................................................................2
1.3.1 General objective.............................................................................................2
1.3.2 Specific objective.............................................................................................2
1.4 Limitation and challenge of the project..........................................................................3
1.5 Methodology and tools....................................................................................................3
1.6 Expected result................................................................................................................ 4
CHAPTER TWO: LITERATURE REVIEW AND THEORY.....................5
2.1 Literature Review............................................................................................................5
2.2 Theory..............................................................................................................................5
2.2.1 Speech signal..........................................................................................................6
2.2.2 Structure of Adaptive Filter....................................................................................7
2.2.3 Application of adaptive filter..................................................................................8
CHAPTER THREE: METHODOLOGY..............................................................9
3.1 Echo cancellation adaptive method..................................................................................9
3.2 LMS Adaptive Algorithm...............................................................................................10
3. 2.1 Derivation of LMS algorithm..................................................................................11
3.2.2 Implementation of LMS algorithm...........................................................................12
3.3 Simulation........................................................................................................................12
3.3.1 Why MATLAB need for this project......................................................................12
3.3.2 Requirements during simulation.............................................................................13
3.3.3 Flow chart of adaptive echo cancellation algorithm...............................................14
CHAPTER FOUR: RESULTS AND DISCUSSION..........................................16
4.1 RESULTS.........................................................................................................................16
4.2 DISCUSSION...................................................................................................................22
CHAPTER FIVE: CONCLUSSION AND RECOMENDATION.................23
5.1 Conclussion.......................................................................................................................23
5.2 Recomendation..................................................................................................................23
REFERENCE.........................................................................................................................24
APPENDIX: MATLAB CODE OF LMS.............................................................................25
LIST OF FIGURES
Figure 2.1 Microphone speech signal..............................................................................6
Figure 2.2 Adaptive filter block diagram........................................................................7
Figure 2.3 Block diagram of adaptive Identification.......................................................8
Figure 3.1 Adaptive acoustic echo cancellation...............................................................9
Figure 3.2 Flow chart of adaptive echo cancellation algorithm.......................................15
Figure 4.1Magnitude response.........................................................................................16
Figure 4.2 Room impulse response...................................................................................17
Figure 4.3 Near-end speech signal....................................................................................17
Figure 4.4 Far- end speech signal.....................................................................................18
Figure 4.5 Microphone speech signal...............................................................................19
Figure 4.6 Magnitude response of echo return loss enhancement....................................20
Figure 4.7 Over all work of output filter at mu= 0.025......................................................21
Figure 4.8 Over all work of output filter at mu= 0.04........................................................22
Abbreviations
DDU:-Dire Dawa university
AEC:-Acoustic Echo Cancellation
NLMS:-Normalized Least Mean Square
PC:-Personal Computer
MSE:-Mean Square Error
MMS:-Minimum Mine Square
LMS:-Least Mean square
NTVSSLMS:-New Time Varying Step Size LMS
DSP:-Digital Signal Processing
RLS:-Recursive Least Square
FIR:-Finite Impulse Response
TDL:-Tapped Delay Line
ACKNOWLEDGEMENTS
First of all, we would like to say thanks to God, who helped us in every aspect of our
life and in success in our education at university. Next we would like to express our deepest
and foremost thank to our advisor Melese.D and all staffs in our institute for being a constant
source of helps and inspiration throughout our proposal work. Their Timely advice and
guidelines have assisted us to get our work done through a lot of difficulty, situations and
obstacles. Our other committee members, the institute and department have been very
Considered and cooperated with us for the completion of this project and thank for their
prompt Feedback and being approachable and available whenever we needed any assistance.
We would also like to thank the ddu institute of technology for the help and valuable
suggestions. At this juncture and we would like to thanks our parents, brethren and friends for
their adequate support and encouragement. This project would have not been completed
without their support, so may God pay back their countless efforts, time, energy, and spirit
they give us for our success.
ABSTRACT
In hands-free telephony and in teleconference systems, the main aim is to provide
good free voice quality when two or more people communicate from different places. The
problem often arises during the conversation is the creation of acoustic echo and this problem
will cause the bad quality of voice signal and the talkers could not hear the contents of the
conversation clearly, despite the fact that they lost the important information. This acoustic
echo is actually the noise which is created by the reflection of sound waves by the wall, floor
of the room and the other things existing in the room. The main objective for our project is
the cancellation of this acoustic echo sound and provides an echo free environment for
speakers during conversation. For this purpose, scientists design different adaptive filter
algorithms. Our project is also to study and simulate the acoustics echo cancellation by using
different adaptive algorithms.

Keywords- Acoustic echo cancellation (AEC)

Least mean square (LMS)


CHAPTER ONE
1. INTRODUCTION ABOUT ECHO
1.1 Background of Project
In principle, “Echo is the phenomenon in which delayed and distorted version of an
original sound or electrical signal is reflected back to the source”. There are two types of
echo:-

 Electrical echo: caused by the impedance mismatch at the hybrids transformer


which the subscriber two-wire lines are connected to telephone exchange four- wire
lines in the telecommunication systems.
 Acoustic echo: caused by the reflection of sound waves and acoustics coupling
between the loudspeaker and the microphone. In teleconference system the speech
signal from far-end generated from loud speaker after directing and reflecting from
the wall, floor and other objects inside the room is receipt by microphone of near-
end, as the result this makes the echo that is sent back to the far-end. The acoustic
echo problem will disturb the conversation of the people and reduce the quality of
system. This is a common problem of the communication networks. Two main
characteristics of echo are reverberation and latency. Reverberation is the persistence
of sound after stopping the original sound. This sound will slowly decay because of
the absorption by the materials constructing the environment. Latency or delay is the
different time of the signal between the transmitter and receiver. In the case of
teleconference system, the sound is generated from loud speaker and received by
microphone, the delay can compute base on the distance between them the length of
the direct sound. Delay is the ratio of distance to the speed of sound.

1.1.1 Adaptive Filters


Adaptive filter is the most important component of acoustic echo canceller and it plays
a key role in acoustic echo cancellation. It performs the work of estimating the echo path of
the room for getting a replica of echo signal. It requires an adaptive update to adapt to the
environmental change. Another important thing is the adaptive algorithm is the heart of an
AEC, which decides the tracking and convergence behavior of the AEC. The tracking
behavior indicates how fast the adaptive filter can follow enclosure dislocations, whereas the
convergence behavior of the adaptive filter measures how fast the filter converges for best
estimation of the room acoustic path.
1.2 STATEMENT OF THE PROBLEM
There are many reasons and facts which motivate us to seek the solutions and
suggestions for the problems and situations caused by echo sound. As a result it initiated us to
develop this project. And these are some problems, the double talk, acoustic coupling and
active conversation.

 In case of double-talk, the error signal will contain both echo estimation error and
near-end speech signal. When we use this signal for updating the filter coefficient
then it diverges. As the result, the adaptive filter will work incorrectly and finally the
bad sound signal was issued.
 In an active conversation, both talkers often speak at the same time or interrupt each
other. Those situations are called “doubletalk”. Doubletalk presents a special
Processing challenge to echo.
 Acoustic coupling is due to the reflection of the loudspeaker’s sound waves from the
wall, door, ceiling, windows and other objects back to the microphone. The result of
the reflections is the creation of a multipath echo and multiple harmonics of echoes,
which are transmitted back to the far-end and are heard by the talker as an echo,

1.3 OBJECTIVES

1.3.1 General objective

The general objective of this project is to deal with adaptive echo canceller and
cancelation techniques, to write a MAT LAB program that can eliminate echoes from echoed
signal and finally to provide echo free signal to the far-end listener.

1.3.2 Specific objective

Specifically the main goal of this project is to deals about related ideas with adaptive
echo cancelation techniques, such as:

 To understand about the impact of echo in modern communication system.


 To understand Design and MAT LAB implementation of FIR filter.
 To understand Implementation of MSE, MMS and LMS algorism in mat lab.
1.4 Limitation and Challenges of the project
 In addition to the above project is limited only to simulation there is no microphone
hardware implementation due to the unavailability of some materials in the department.
 Another limitation of the system is the maximum mass that can be suspended.
 In doing this project we have faced many obstacles like absence of components and DSP
kit drivers and hard finding of MATLAB codes.
 Running simulation and code writing was rather difficult due to lack of experience and
knowledge in the software we used.

1.5 Methodology and tools


For the success of this project we have conducted several procedures which helped us to
get full information about the title and also help us for the success of the project, from these we
list some of them.

 Studding of Various Projects on echo canceler and cancelation.


 Searching the websites related to this title.
 Asking expert instructors with related to the concept of echo canceler and cancelation.
And moreover, this project began after the title was approved, then we start to collect data and
organize the data on the selected title from different literatures. After collecting and organizing
data, we started to understand and analyse the working principle of the system. The next step we
did is designing the simulation model of the adaptive aquatic echo cancellation. Designing the
adaptive filter structure took the next step of the mathematical modelling of the system.
Completing the design of each relevant subsystem we create a simulated aquatic echo
cancellation. As soon as we simulate the system we show the result of the simulation and discus
the result. In all the steps done there were troubleshooting part to resolve the problems faced.
START

RESULT &
DISCUSTION
PROPOSAL
APPROVED

COLLECTION END
&ORGANIZING DATA

UNDERSTAND
&ANALIZING DATA

MATHIMATICAL
MODELING

LMS Adaptive
Algorithm

NO SIMULATI YES
ON

Tools:-
For the success of this project we will use a soft were program known as
MAT LAB
1.6 Expected result
This project increases the capacity achieved through silence suppression by preventing echo
from traveling across a network or system, and accomplishing free communication in
communication system, ddu administration hall as for instance.
CHAPTER TWO
2. LITERATURE REVIEW AND THEORY
2.1 LITERATURE REVIEW
As we discussed in the above point of view in this 21th century, acoustic echoes are
indication of backwardness especially in communication system of developed countries.
Therefore several scientists, engineers, engineering students and others experts have seek the
solution for echoes. And we also find latest paper works from different fabulous people. For
example a paper prepared by “Dr.Thamer M.Jamel’’(instructor in university of technology and
department of electrical engineering) in Baghdad, Iraq. In the year 2013 with the title of
Performance of Adaptive Acoustic Echo Canceller Using a New Time Varying Step Size LMS
Algorithm (NTVSSLMS).In his paper he describe the way how echoes can eliminate by using
adaptive FIR filter and LMS algorithms. Similarly this group saw a paper work of “Sanjay
Nagendra” and “Vinay Kumar.S.B” from Dept. of Electronics &Communication in “Sri
Bhagawan Mahaveer Jain College of Engineering” (India) in the year 2011.with the title of
Echo Cancellation in Audio Signal using LMS Algorithm. By their paper they describe
varies algorithms which are used in echo cancellation like MSE and RLS; basically they
describe MAT LAB implementation of LMS algorithm for cancel acoustic echo. As we know
we are the first group with this title in this institute. So we try to LMS algorithms and MAT
LAB soft where to implement them. We forced to use MAT LAB because of the absence of
DSP kit in the institute.

2.1 THEORY
The invention relates generally to reducing unwanted audio or acoustic feedback in a
communication system, and particularly to an adaptive acoustic echo cancellation device for
suppressing acoustic feedback between the loudspeaker and microphone of a telephone unit in a
teleconferencing system. The telephone unit of a typical audio conferencing system includes a
loudspeaker for broadcasting an incoming telephone signal into an entire room. Similarly, the
telephone’s microphone is typically designed to pick up the voice of any person within the room
and transmit the voice to a remote telephone at the far end of the communication system. Unlike
conventional hand held telephone sets, conference telephone units are prone to acoustic
feedback between the loudspeaker unit and microphone. For example, a voice signal which is
broadcast into the room by the loudspeaker unit may be picked up by the microphone and
transmitted back over the telephone lines. As a result, persons at the far end of the
communication system hear an echo of their voice. The echo lags the person’s voice by the
round trip delay time for the voice signal. Typically, the echo is more noticeable as the lag
between the person’s voice and the echo increases. Accordingly, it is particularly annoying in
video conferencing systems which transmit both video and audio information over the same
telephone lines.

2.2.1 Speech Signal

A speech signal consists of three classes of sounds such as: voiced, fricative and plosive
sounds. Voiced sounds are caused by excitation of the vocal tract with quasi-periodic pulses of
air flow. Fricative sounds are formed by constricting the vocal tract and passing air through it,
causing turbulence results in a noise-like sound. Plosive sounds are created by closing up the
vocal tract, building up air behind it then suddenly releasing, this is heard in the sound made by
the letter p [2]. Fig (1), shows a time representation of a speech signal. That is, its mean values
vary with time and cannot be predicted using the above mathematical models for random
processes. However, a speech signal can be considered as a linear composite of the above three
classes of sound, each of these sounds are stationary and remain fairly constant over intervals of
the order of 40m.

Figure2.1 microphone speech signal


2.2.2 Structure of Adaptive Filter
This is structure to develop the lattice structure, let us consider in order to FIR filter. The
lattice structure is most widely used in digital speech processing and in adaptive filtering.

Tapped weights line


X (n) y(n)
W0
D

∑ Y(n)

D WN-1 e(n)

X (n-N+1) Adjust weights

Figure 2.2 adaptive filter block diagram

Here we represents the coefficients of the adaptive filter tap weight vector, x (n) is the input
vector samples, the tapped delay line D, is needed to make full use of the filter. The input signal
enters from the left and passes through N-1 delays. The output of the tapped delay line (TDL) is
an N-dimensional vector, made up of the input signal at the current time, the previous input
signal, etc. the y (n) is the adaptive filter output, d (n) is the desired echoed signal and e (n) is
the estimation error signal at time n. The aim of an adaptive filter is to calculate the difference
between the desired signal and the adaptive filter output, e (n). This error signal is fed back into
the adaptive filter and its coefficients are changed algorithmically in order to minimize a
function of this difference, known as the mean square error function. In the case of acoustic
echo cancellation, the optimal output of the adaptive filter is equal in value to the unwanted
echoed signal. When the adaptive filter output is equal to desired signal the error signal goes to
zero. In this situation the echoed signal would be completely cancelled and the far user would
not hear any of their original speech returned to them, where the noise no (n) signal is assumed
zero.
2.2.3 Application of adaptive filters
The adaptive filters are widely used in areas such as control systems, communications,
signal processing, acoustics, and others to deal with random Signals with stationary or
quasistationary statistics. Although these applications are quite different, they have input,
output, error, and reference signals. The Applications of the adaptive filters can be classified
into four fundamental Classes based on the architecture of the implementation: adaptive
identification, Adaptive inverse, adaptive prediction, and active noise cancellation. But our
Project concerned on adaptive identification, because of the adaptive Identification is an
approach to model an unknown system. As seen in Figure, the unknown system is in parallel
with an adaptive filter, and both are receiving the input signal. The output of the unknown
system provides the reference signal for the adaptive digital filter. Applications for adaptive
Identification include room acoustic identification, channel estimation, echo Cancellation and so
on.

Figure 2.3 block diagram of adaptive identification


CHAPTER 3
3. METHODOLOGY

3.1 ECHO CANCELLATION ADAPTIVE METHODS

INTRODUCTION
Most echo cancellers use variants of the LMS adaptation algorithm [1] [2][3]. The
attractions of the LMS are its relatively low memory and computational requirements and its
ease of implementation and monitoring. In practice, LMS adaptation has produced effective line
echo cancellation system back to the far-end. The acoustic echo problem will disturb the
conversation of the people and reduce the quality of system. This is a common problem of the
communication networks.

From far-
end talker Loudspeaker
x(n)
Reflection

Direct coupling
Adaptive
filter

To far-end
talker y^(n) (Echo path)
d(n) d(n) h(n)

e(n) ∑ near-end talker
mic Microphone

Figure 3.1 adaptive acoustic echo cancellations


Where x(n) is far-end signal, d(n) is desired signal, h(n) is echo path or impulse response of
room, y^(n) is adaptive filter outputs, e(n) is error signal. The method used to cancel the echo
signal is known as adaptive filtering. Adaptive filters are dynamic filters which iteratively alter
their characteristics in order to achieve an optimal desired output. An adaptive filter
algorithmically alters its parameters in order to minimize a function of the difference between
the desired output d (n) and its actual output y (n). This function is known as the objective
function of the adaptive algorithm. Figure (1) shows a block diagram of the adaptive echo
cancellation model. Where the x (n) is input signal, the filter h (n) represents the impulse
response of the acoustic environment, w (n) represents the adaptive filter used to cancel the
echo signal. The adaptive filter aims to equate its output y (n) to the desired output d (n) (the
signal reverberated with in the acoustic environment). At each iteration the error signal, e (n) =
d (n)-y (n) is fed back into the filter, where the filter characteristics are altered. This presents the
basis of adaptive filtering technique as well as the development and derivation. Details the
simulations of adaptive filtering technique and acoustic echo cancellation system as developed
in Mat lab.

3.2 LMS Adaptive Algorithm


The LMS algorithm is a type of adaptive filter known as stochastic gradient-based
algorithms as it utilizes the gradient vector of the filter tap weights to converge on the optimal
wiener solution. It is well known and widely used due to its computational simplicity. It is this
simplicity that has made it the benchmark against which all other adaptive filtering algorithms
are judged (Haykin 1991, p. 299). The algorithm uses the previous sample values and errors to
update the FIR filter’s coefficients. It then uses the updated new Coefficients and the latest
sample values to calculate the FIR filter’s output. This Output is used to calculate the next error.
Equations for the calculations are given below. These equations assume that the echo path has a
finite impulse response with each iteration of the LMS algorithms, the filter tap weights of the
adaptive filter are updated according to the following formula (Farhang-Boroujeny 1999, p.
141).

W (n +1) = w (n) + 2μe (n) x (n) …..Equation 1

Here x (n) is the input vector of time delayed input values, x (n) = [x (n) x (n-1) x (n-2) ...

X (n-N+1)]T. The vector w (n) = [w0 (n) w1 (n) w2 (n) ... wN-1(n)] T represents the
Coefficients of the adaptive FIR filter tap weight vector at time n. The parameter μ is

Known as the step size parameter and is a small positive constant. This step size

Parameter controls the influence of the updating factor. Selection of a suitable value for μ

is imperative to the performance of the LMS algorithm, if the value is too small the time

The adaptive filter takes to converge on the optimal solution will be too long; if μ is too

Large the adaptive filter becomes unstable and its output diverges.

3.2.1 Derivation of the LMS algorithm.


The derivation of the LMS algorithm builds upon the theory of the wiener solution for the
optimal filter tap weights, w0 as outlined in section 3.2. It also depends on the steepest descent
algorithm as stated in equation 8, this is a formula which updates the filter coefficients using the
current tap weight vector and the current gradient of the cost function with respect to the filter
tap weight coefficient vector, ∇ξ (n).
W (n+1) = w (n)- ∇ξ (n)
Where ξ (n) =E [ ]…………..equation 2
As the negative gradient vector points in the direction of steepest descent for the N-dimensional
Quadratics cost function, each recursion shifts the value of the filter coefficients closer toward
their optimum value, which corresponds to the minimum achievable value of the cost function,
ξ (n). This derivation is based on Diniz 1997, [4] The LMS algorithm is a random process
implementation of the steepest descent algorithm, from equation 2 here the expectation for the
error signal is not known so the instantaneous value is used as an estimate. The steepest descent
algorithm then becomes equation 3
W (n+1) =w (n) - μ∇ξ (n)
Where ξ (n) = (n)…………………..equation 3
The gradient of the cost function, ∇ξ(n), can alternatively be expressed in the following
Form:-
∇ξ (n) = ∇( (n))

( )
=
( )
=2e (n)

( ( ) ( ))
= 2e (n)
( ) ( )
=-2e (n)
=2e (n) x (n)……………..equation 4
Substituting this into the steepest descent algorithm of equation 2 we arrive at the recursion for
the LMS adaptive algorithm.
W (n +1) = w (n) + 2μe (n) x (n) ………………………….equation

3.2.2 Implementation of the LMS algorithm.


From the iteration of the LMS algorithm requires 3 distinct steps in this order:
1. The output of the FIR filter, y(n) is calculated using equation 6
y(n)=∑ ( ) ( − )= ( ) ( )…………..equation 6
2. The value of the error estimation is calculated using equation 7
e(n)=d(n)-y(n)………………………..equation 8
3. The tap weights of the FIR vector are updated in preparation for the next iteration,
By equation 9
W (n +1) = w (n) + 2μe (n) x(n)………………..equation 9
The main reason for the LMS algorithms popularity in adaptive filtering is its computational
simplicity, making it easier to implement than all other commonly used adaptive algorithms.
For each iteration the LMS algorithm requires 2N additions and 2N+1 multiplications (N for
calculating the output, y (n), one for 2μe (n) and an additional N for the scalar by vector
multiplication) (Farhang-Boroujeny 1999, p. 141).

3.3 SIMULATION
The previous chapters provide a detailed sketch of an Acoustic Echo Cancellation (AEC).
In this chapter the flowchart for the software simulation and the results of Simulation of the
AEC algorithm, which was performed in MATLAB are discussed
3.3.1 Why MATLAB Need for this Project
MATLAB is a numerical computing environment that especially effective to calculate and
simulate the technical problems. This programming language is very powerful allows matrix
manipulation, plotting of functions and data, implementation of algorithms, creation of user
interfaces, and interfacing with other programming languages (C, C++, Fortran and Java). One
of the most beneficial features is graphical visualization which helps us have confidence in
results by monitoring and analyzing resultant plots. In addition, MATLAB implement Simulink,
the software package models, simulates and analyzes dynamic systems. It enables us to pose a
question about a system, model the system, and see what happens. For our simulation purpose,
MATLAB actually is necessary and effective software to attain the convincible results because
of some reasons as following. The MATLAB software environment suited the needs of this
project for the following reasons
 The input signals (far-end and near-end talker signals) were voices. These voices were
stored as wav files and the wav files were easily imported into the code.
 The intermediate signals (echo signals) and output signals (error signal and signals
obtained after echo cancellation) were obtained as wav files. Thus the audio of the voice
signals could be literally be heard, which aided immensely judgments with respect to the
results obtained.
 The signal processing toolbox has in-built functions for almost all signal processing
applications. The toolbox helped the efficiency of the code since these functions could
be called wherever necessary instead of writing separate sub-routines.
 Since MATLAB supports graphics, the results of a simulation could be presented in a
graphical format with ease.
3.3.2 Requirements during the simulation
 The speech signals (including far-end and near-end signals) were recorded by
MATLAB software at the sampling rate of 8 kHz. The speech signal is the audio signal
contains the frequencies between 300Hz-3400Hz. Because of the sampling theorem
(Nyquist–Shannon sampling theorem), the analog signal will reconstruct perfectly from
the sequence of samples if the sampling rate exceeds 2B (B is highest frequency of the
analog signal). Thus by using sampling rate fs of 8000Hz, we will satisfy to the
Sampling theorem (fs=8000Hz>2B=3400x2=6800Hz).
 For our simulation, the duration of the signals is 20 seconds (160.000 samples) which
can express 4 cases (5 seconds for each case, respective to 40.000 samples) of the
Communication between far-end and near-end in the teleconference system. These
Signals are plotted as the figures below. 4 cases in teleconference are:

1. Far-end talks only


2. Double talk
3. Near-end talks only
4. Both of them are silent
 Design specification
Fs=8 KHz
Fpass=300HZ
Fstop=5 KHz
Steep size =0.025
Frame Size = 8192;
M=7
Where:-
Fs: - sampling frequency
F pass: - pass band frequency
Fstop: - stop band frequency
M: - size of the filter

3.3.3 Flowchart of the AEC algorithm


The flowchart of the AEC algorithm is very important for us to orient all steps we need to do
in the simulation. This is shown in the figure next
Start

Read far-end signal x (n)


and room impulse
response h (n)

Create echo signal

Read near-end signal y(n)

Running LMS algorithm


calculate error signal

Double-talk detection (normalized


cross correlation method)

Freeze adaptive
filter

Updating adaptive filter


coefficients

Get residual echo e(n) by


subtracting estimated echo
from desired signal

STOP

Figure 3.2: Flowchart of acoustic echo cancellation algorithm


CHAPTER FOUR
4. RESULT AND DISCUSSION
4.1 RESULTS
The resulting plots below demonstrate the performance of acoustics echo canceller with
different algorithms. First, we show the graph of near-end speech which we need to compare
with the error signal (it is should be approximately equal). Second, the plots in turn are:
microphone signal d(n) , output signal y(n) of the adaptive filter and error signal e(n) . The error
signal in real teleconference system is transmitted from near-end user to the far-end user. If no
near-end speech, it should be a silent signal and if near-end talks, then the error signal contains
only near-end speech. Other graphs will express the evaluations of the estimated impulse
response, Doubletalk detector and performance of the adaptive filter (MSE, ERLE).
1. This section is graphical representation of the results obtained by simulating the algorithm in
MATLAB. This is plot of the overall magnitude response.

Figure 4.1 magnitude response


2. This section is a graphical representation of the results obtained by simulating the algorithm
in MATLAB. The plot of the room impulse response.

Figure 4.2 Room impulse responses

2 .This section is a graphical representation of the results obtained by simulating the algorithm
in MATLAB. The plot of the near-end speech signal.

Figure 4.3 Near-end speech signal


4 This section is a graphical representation of the results obtained by simulating the algorithm in
MATLAB. The plot of the far-end speech signal.

Figure 4.4 Far-end speech signal


5. This section is a graphical representation of the results obtained by
Simulating the algorithm in MATLAB. The plot of the microphone signal.

Figure 4.5 Microphone speech signal


6. This section is a graphical representation of the results obtained by simulating the algorithm
in MATLAB. The plot of the echo return loss enhancement

Figure 4.6 Magnitude response of echo return loss enhancement


7. This is a graphical representation of the results obtained by simulating the algorithm in
MATLAB. The plot of the overall work of output filter at m = 0.025 and echo return
enhancement.

Figure 4.7 over all work of output filter at mu = 0.025


8. This section is graphical representation of the results obtained by simulating the algorithm in
MATLAB. The plot of the overall output filter and echo return loss enhancement at mu = 0.04

Figure 4.8 over all work of output filter at mu = 0.04

4.2 DISCUSSION

From the experiment works and the resultant graphs, we can discuss the echo
cancellation algorithm in order to have a deeper understanding and the conclusion of the project.
As the results we have been discussed about LMS as, it could converge approximately to the
estimated impulse response of the true room impulse response h, thus the estimated echo yˆ(n )
signal look like similar to the true echo signal y( n) . And we have found that, error signals
almost obtain our desired results.
CHAPTER FIVE
5.CONCLUTION AND RECOMDATION

5 .1 CONCLUSION
 With the world shrinking into a global village because of superior Communications,
telephones, both conventional and hands-free sets, occupy a prominent position in
solving people’s communication needs. One of the major Problems in a modern
communication system is echo.
 The Echo cancellation Algorithm presented in this paper successfully attempted to find a
software Solution for the problem of echoes in the acoustic environment. The proposed
Algorithm was completely a software approach without utilizing any DSP Hardware
components. The algorithm was capable of running in any PC with MATLAB software
installed. The audio of the output speech signals were highly Satisfactory and validated
the goals of this project.

5.2 RECOMMENDATION
 This project can be more successful than this, if we get complete components for
DSP kit, so we recommended that DDU should have to provide the opportunity to
make sure that all components are available in university especially DSP Kit for the
generations.
 We also recommend that it is preferable to use NLMS and RLS algorism to handle
far-end speech signal for next generations and those who are voluntary to do this
project in the future.
 And we further recommended that NLMS and RLS algorism by using DSP-kit is
suitable for our new administration hall.
 REFFERENCE

www.researchgate.net
[1] Sadaoki Furui and M. Mohan Sondhi, “Advances in Speech Signal Processing”,
Marcel Dekker, Inc., 1992
[2] Digital Signal Processing, Fourth Edition
[3] Simon Haskin, “Adaptive filter theory,” 4th Edition
[4] Eberhard Hansler, Gerhard Schmidt, “Acoustic Echo and Noise Control-A Practical
Approach
[5]Farhang-Boroujeny, B. 1999, Adaptive Filters, Theory and Applications. John Wiley and
Sons, New York.
[6]Haykin, Simon. 1991, Adaptive Filter Theory. 2nd Edition. Prentice-Hall Inc., New
Jersey.
[7] Lester S.H Ngia, “System Modelling using Basis Functions and Application to Echo
Cancellation”, Ph. D. Dissertation, Chalmers University of Technology
[8] Paulo S.R. Diniz, “Adaptive Filtering Algorithms and Practical Implementation”,
Kluwer Academic Publishers, 1997
[9] J. Benesty, T. Gansler, D.R. Morgan, M.M. Sondhi and S.L. Gay, “Advances in
Network and Acoustic Echo Cancellation”, Springer-Verlag, 2001
[10] Mu Tian, P.K. Gupta, Marcus Harte and Danny Yip, “Improved Echo Canceller and
Implementation”, Dialogic Corporation
[11] Andrze Borys, “Nonlinear Aspects of Telecommunications”, CRC Press, 2001
Appendix: MATLAB code of LMS algorithm
%% Acoustic Echo Cancellation (AEC)
% This example shows how to apply adaptive filters to acoustic echo
% cancellation (AEC).
%
% Author(s): Scott C. Douglas
% Copyright 1999-2014 The MathWorks, Inc.

%% Introduction
% Acoustic echo cancellation is important for audio teleconferencing when
% simultaneous communication (or full-duplex transmission) of speech is
% necessary. In acoustic echo cancellation, a measured microphone signal
% |d(n)| contains two signals:
%
% * the near-end speech signal |v(n)|
% * the far-end echoed speech signal |dhat(n)|
%
% The goal is to remove the far-end echoed speech signal from the
% microphone signal so that only the near-end speech signal is transmitted.
% This example has some sound clips, so you might want to adjust your
% computer's volume now.

%% The Room Impulse Response


%
% First, we describe the acoustics of the loudspeaker-to-microphone signal
% path where the speakerphone is located. We can use a long finite impulse
% response filter to describe these characteristics. The following sequence
% of commands generates a random impulse response that is not unlike what a
% conference room would exhibit assuming a system sampling rate of |fs =
% 8000 Hz|.

fs = 8000;
M = fs/2 + 1;
frameSize = 8192;

[B,A] = cheby2(4,20,[0.1 0.7]);


IIR = dsp.IIRFilter('Numerator', [zeros(1,6) B], 'Denominator', A);

FVT = fvtool(IIR); % Analyze the filter


FVT.Color = [1 1 1];

%%
H = step(IIR, ...
(log(0.99*rand(1,M)+0.01).*sign(randn(1,M)).*exp(-0.002*(1:M)))');
H = H/norm(H)*4; % Room Impulse Response
firRoom = dsp.FIRFilter('Numerator', H');

fig = figure;
plot(0:1/fs:0.5, H);
xlabel('Time [sec]');
ylabel('Amplitude');
title('Room Impulse Response');
fig.Color = [1 1 1];
%% The Near-End Speech Signal
%
% The teleconferencing system's user is typically located near the system's
% microphone. Here is what a male speech sounds like at the microphone.

load nearspeech

AP = dsp.AudioPlayer('SampleRate', fs);
nearSpeechSrc = dsp.SignalSource('Signal',v,'SamplesPerFrame',frameSize);
nearSpeechScope = dsp.TimeScope('SampleRate', fs, ...
'TimeSpan', 35, ...
'YLimits', [-1.5 1.5], ...
'BufferLength', length(v), ...
'Title', 'Near-End Speech Signal', ...
'ShowGrid', true);

% Stream processing loop


while(~isDone(nearSpeechSrc))
% Extract the speech samples from the input signal
nearSpeech = step(nearSpeechSrc);
% Send the speech samples to the output audio device
step(AP, nearSpeech);
% Plot the signal
step(nearSpeechScope, nearSpeech);
end

%% The Far-End Speech Signal


%
% Now we describe the path of the far-end speech signal. A male voice
% travels out the loudspeaker, bounces around in the room, and then is
% picked up by the system's microphone. Let's listen to what his speech
% sounds like if it is picked up at the microphone without the near-end
% speech present.

load farspeech
farSpeechSrc = dsp.SignalSource('Signal',x,'SamplesPerFrame',frameSize);
farSpeechSink = dsp.SignalSink;
farSpeechScope = dsp.TimeScope('SampleRate', fs, ...
'TimeSpan', 35, ...
'YLimits', [-0.5 0.5], ...
'BufferLength', length(x), ...
'Title', 'Far-End Speech Signal', ...
'ShowGrid', true);

% Stream processing loop


while(~isDone(farSpeechSrc))
% Extract the speech samples from the input signal
farSpeech = step(farSpeechSrc);
% Add the room effect to the far-end speech signal
farSpeechEcho = step(firRoom, farSpeech);
% Send the speech samples to the output audio device
step(AP, farSpeechEcho);
% Plot the signal
step(farSpeechScope, farSpeech);
% Log the signal for further processing
step(farSpeechSink, farSpeechEcho);
end

%% The Microphone Signal


%
% The signal at the microphone contains both the near-end speech and the
% far-end speech that has been echoed throughout the room. The goal of the
% acoustic echo canceler is to cancel out the far-end speech, such that
% only the near-end speech is transmitted back to the far-end listener.

reset(nearSpeechSrc);
farSpeechEchoSrc = dsp.SignalSource('Signal', farSpeechSink.Buffer, ...
'SamplesPerFrame', frameSize);
micSink = dsp.SignalSink;
micScope = dsp.TimeScope('SampleRate', fs,...
'TimeSpan', 35, ...
'YLimits', [-1 1], ...
'BufferLength', length(x), ...
'Title', 'Microphone Signal', ...
'ShowGrid', true);

% Stream processing loop


while(~isDone(farSpeechEchoSrc))
% Microphone signal = echoed far-end + near-end + noise
micSignal = step(farSpeechEchoSrc) + step(nearSpeechSrc) + ...
0.001*randn(frameSize,1);
% Send the speech samples to the output audio device
step(AP, micSignal);
% Plot the signal
step(micScope, micSignal);
% Log the signal
step(micSink, micSignal);
end

%% The Frequency-Domain Adaptive Filter (FDAF)


%
% The algorithm that we will use in this example is the *Frequency-Domain
% Adaptive Filter (FDAF)*. This algorithm is very useful when the impulse
% response of the system to be identified is long. The FDAF uses a fast
% convolution technique to compute the output signal and filter updates.
% This computation executes quickly in MATLAB(R). It also has improved
% convergence performance through frequency-bin step size normalization.
% We'll pick some initial parameters for the filter and see how well the
% far-end speech is cancelled in the error signal.

% Construct the Frequency-Domain Adaptive Filter


FDAF = dsp.FrequencyDomainAdaptiveFilter('Length', 2048, ...
'StepSize', 0.025, ...
'InitialPower', 0.01, ...
'AveragingFactor', 0.98, ...
'Method', 'Unconstrained FDAF');

AECScope1 = dsp.TimeScope(4, fs, ...


'LayoutDimensions', [4,1], ...
'TimeSpan', 35, ...
'BufferLength', length(x));
AECScope1.ActiveDisplay = 1;
AECScope1.ShowGrid = true;
AECScope1.YLimits = [-1.5 1.5];
AECScope1.Title = 'Near-End Speech Signal';

AECScope1.ActiveDisplay = 2;
AECScope1.ShowGrid = true;
AECScope1.YLimits = [-1.5 1.5];
AECScope1.Title = 'Microphone Signal';

AECScope1.ActiveDisplay = 3;
AECScope1.ShowGrid = true;
AECScope1.YLimits = [-1.5 1.5];
AECScope1.Title = 'Output of Acoustic Echo Canceller mu=0.025';

AECScope1.ActiveDisplay = 4;
AECScope1.ShowGrid = true;
AECScope1.YLimits = [0 50];
AECScope1.YLabel = 'ERLE [dB]';
AECScope1.Title = 'Echo Return Loss Enhancement mu=0.025';

% Near-end speech signal


release(nearSpeechSrc);
nearSpeechSrc.SamplesPerFrame = frameSize;

% Far-end speech signal


release(farSpeechSrc);
farSpeechSrc.SamplesPerFrame = frameSize;

% Far-end speech signal echoed by the room


release(farSpeechEchoSrc);
farSpeechEchoSrc.SamplesPerFrame = frameSize;

%% Echo Return Loss Enhancement (ERLE)


%
% Since we have access to both the near-end and far-end speech signals, we
% can compute the *echo return loss enhancement (ERLE)*, which is a
% smoothed measure of the amount (in dB) that the echo has been attenuated.
% From the plot, we see that we have achieved about a 35 dB ERLE at the end
% of the convergence period.

firERLE1 = dsp.FIRFilter('Numerator', ones(1,1024));


firERLE2 = clone(firERLE1);
setfilter(FVT,firERLE1);

micSrc = dsp.SignalSource('Signal', micSink.Buffer, ...


'SamplesPerFrame', frameSize);

% Stream processing loop - adaptive filter step size = 0.025


while(~isDone(nearSpeechSrc))
nearSpeech = step(nearSpeechSrc);
farSpeech = step(farSpeechSrc);
farSpeechEcho = step(farSpeechEchoSrc);
micSignal = step(micSrc);
% Apply FDAF
[y,e] = step(FDAF, farSpeech, micSignal);
% Send the speech samples to the output audio device
step(AP, e);
% Compute ERLE
erle = step(firERLE1,(e-nearSpeech).^2)./ ...
(step(firERLE2, farSpeechEcho.^2));
erledB = -10*log10(erle);
% Plot near-end, far-end, microphone, AEC output and ERLE
step(AECScope1, nearSpeech, micSignal, e, erledB);
end

%% Effects of Different Step Size Values


%
% To get faster convergence, we can try using a larger step size value.
% However, this increase causes another effect, that is, the adaptive
% filter is "mis-adjusted" while the near-end speaker is talking. Listen
% to what happens when we choose a step size that is 60% larger than
% before.

% Change the step size value in FDAF


reset(FDAF);
FDAF.StepSize = 0.04;

AECScope2 = clone(AECScope1);
AECScope2.ActiveDisplay = 3;
AECScope2.Title = 'Output of Acoustic Echo Canceller mu=0.04';
AECScope2.ActiveDisplay = 4;
AECScope2.Title = 'Echo Return Loss Enhancement mu=0.04';

reset(nearSpeechSrc);
reset(farSpeechSrc);
reset(farSpeechEchoSrc);
reset(micSrc);
reset(firERLE1);
reset(firERLE2);

% Stream processing loop - adaptive filter step size = 0.04


while(~isDone(nearSpeechSrc))
nearSpeech = step(nearSpeechSrc);
farSpeech = step(farSpeechSrc);
farSpeechEcho = step(farSpeechEchoSrc);
micSignal = step(micSrc);
% Apply FDAF
[y,e] = step(FDAF, farSpeech, micSignal);
% Send the speech samples to the output audio device
step(AP, e);
% Compute ERLE
erle = step(firERLE1,(e-nearSpeech).^2)./ ...
(step(firERLE2, farSpeechEcho.^2));
erledB = -10*log10(erle);
% Plot near-end, far-end, microphone, AEC output and ERLE
step(AECScope2, nearSpeech, micSignal, e, erledB);
end

%% Echo Return Loss Enhancement Comparison


%
% With a larger step size, the ERLE performance is not as good due to the
% misadjustment introduced by the near-end speech. To deal with this
% performance difficulty, acoustic echo cancellers include a detection
% scheme to tell when near-end speech is present and lower the step size
% value over these periods. Without such detection schemes, the performance
% of the system with the larger step size is not as good as the former, as
% can be seen from the ERLE plots.

displayEndOfDemoMessage(mfilename)

You might also like