You are on page 1of 43

Arba Minch University

Arba Minch Institute of Technology


Department of Electrical and Computer Engineering
Title: - Design and analysis of acoustic echo cancellation

PREPARED BY:- 1. Kirubel Asnake


2. Tadese Belayneh
3. Eyob Delelegn
4. Tsion Tesfa
5. Bekele Niguse

Advisor’s name: - Instructor. Eyayu

Arbaminch, SNNP, Ethiopia


March 2021

DECLARATION
We hereby declare that we carried out the work" Designing and Analysis of
Acoustic Echo Cancellation" in the department of Electrical and computer
engineering, University of Arbaminch, under the advisor of Mr. Eyayu H.
(MSc in communication Engineering). All source of knowledge used have
been duly acknowledge.
Name Signature
Date
Mr. A ____________
___________
Mr. A _____________
___________
Mr. A _____________
___________
APROVAL
It is approved that this project has been written in compliance with the formatting
rules laid down by electrical and computer engineering university of, Ethiopia.
……………………………………………………….
Advisor Signature Date
MR. A. __________ _________
Department head
MR. A. __________ _________

Examining Committee Members Signature Date


1. Mr. _______________________ ___________
2. Mr. _______________________ __________
3. Mr.
ACKNOWLEDGMENT

First of all our gratitude goes to the Almighty God for his positive will and help
without which the things we made here were value less. Secondly we, want to
thank our teachers especially, our Advisor Mr. Eyayu H.( MSC in electrical and
computer engineering) for his unlimited, truly help and guide us from the very
beginning of selecting the title and we also thank some other lectures for helping
us to do the project.
ABSTRACT

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 contains two signals:
- the near-end speech signal and the far-end echoed speech signal. 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 back to the far-end listener. Acoustic echo
cancellation is a common occurrence in today’s telecommunication systems. The
signal interference caused by acoustic echo is distracting to users and causes a
reduction in the quality of the communication. Acoustic echo path are more non
stationary due to opening and closing of a door or movement of people inside the
room, so the echo canceler must accurately estimate the echo path characteristic
and rapidly adapt to its variation. This involves the selection of an adaptive filter
and an algorithm for the adaptation. Adaptive filtering constitutes one of the core
technologies in digital signal processing and finds numerous application areas in
science as well as in industry.

Adaptive filtering techniques are used in a wide range of applications, including


echo cancellation, adaptive equalization, adaptive noise cancellation, and adaptive
beam forming. This paper will focus on the occurrence of acoustic echo in
telecommunication systems and adaptive filters are dynamic filters which
iteratively alter their characteristics in order to achieve an optimal desired output
and implementing the overall system of acoustic echo cancellation system using
mainly Least Mean Square (LMS) and also little about Normalized Least Mean
Square (NLMS) algorithms for adaptive filter. It is the result of a project in the
course adaptive signal processing at Arba Minch University.
Finally 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, so The Echo
cancellation algorithm presented in this paper successfully attempted to find a
software solution for the problem of echoes in the telecommunications
environment. The algorithm was capable of running in any PC with MATLAB
software installed.
Contents
DECLARATIO
N…………………………………………………………………………………………………i
ACKNOWLEDGMENT.........................................................................................ii

ABSTRACT ......................................................................................................... iv
TABLE OF CONTENT ........................................................................................ v
LIST OF FIGURE............................................................................................... vii
ACRONYMS ......................................................................................................viii
CHAPTER ONE .....................................................................................................1
Introduction ............................................................................................................1
Background .............................................................................................................1
Statement of problem .............................................................................................3
Objective of the Study ...........................................................................................3
General Objective ..................................................................................................3
The specific objectives ..........................................................................................3
Scope of this project ...............................................................................................4
Literature review ....................................................................................................4
Methodology .........................................................................................................6
Project organization ................................................................................................8
CHAPTER TWO ...................................................................................................8
Basic Echo Canceller .............................................................................................8
Acoustic Echo Cancellation in teleconference/Videoconference ...........................9
Acoustic Echo Cancellation (AEC) .....................................................................11
Adaptive filters .....................................................................................................12
General block diagram of the adaptive filters ......................................................13
Adaptive Algorithms .............................................................................................16
LMS algorithm .....................................................................................................16
Performance evaluation ...........................................................................................
Convergence Test .......................................................................................................
CHAPTER THREE ...................................................................................................
3. SYSTEM DESIGN FOR ECHO CANCELLATION ............................................
CHAPTER FOUR.......................................................................................................
4. SIMULATION AND RESULTS............................................................................
4.1 Discussion..............................................................................................................
4.2 Results...................................................................................................................
CHAPTER FIVE.........................................................................................................
5. CONCLUSION AND RECOMMENDATIONS ..................................................
5.1 Conclusion............................................................................................................
5.2 Recommendations.................................................................................................
REFERANCE..............................................................................................................
APPENDEX................................................................................................................
LIST OF FIGURE
Figure 1.1 principle of acoustic echo cancellation system ............................... 2
Figure2. 1 a Generic Adaptive Echo Canceller ............................................... 8
Figure2. 2 The basic model of adaptive filter ............................................... 10
Figure2. 3 block diagram of adaptive filter .........................................................
Figure2. 4 LMS Algorithm .............................................................................14
Figure2. 5 Generic LMS Algorithm .............................................................. 15
Figure3. 1 Flowchart for Echo Cancellation........................................................ 17
Figure4. 1 plot of the impulse response H(n) ........................................ 18
Figure4. 2 Plot of the Far-end Signal, x(n)............................................... 19
Figure4. 3 Plot of the Near-end Signal, x(n)............................................... 19
Figure4. 4 Plot of the microphone Signal............................................................ 20
Figure4. 5 Microphone Signal is entered into Adaptive filter and output of AC.20
Figure4. 6 Normalized LMS method................................................................... 21
Figure4. 7 convergence performance of regular LMS ........................................ 21
Figure4. 8 convergence performance of regular NLMS...................................... 22
Figure4. 9 comparing the LMS and NLMS convergence performance............... 22
ACRONYMS
AEC…………………………… acoustic echo cancellation
RIR………………………………room impulse response
AF………………………………. adaptive filters
LMS……………………………..least mean-square
FFT………………………………fast Fourier transform
FDAF……………………………frequency-domain adaptive filter
DSP……………………………..digital signal processing
NLMS……………………………normalized least mean square
FE……………………………….far end
NE………………………………. near end
EMSE…………………………… estimate mean square error
ERLE……………………………...echo return loss enhancement
ANC………………………………active noise cancellation
FIR………………………………..finite impulse response
IIR…………………………………infinite impulse response
BIBO……………………………..bounded input bounded output
CHAPTER ONE
1. Introduction

1.1 Background

People have been using telephones as a way of distant voice communication for
more than one century until now. In a phone conversation, echo is the sound of
one’s own voice being played back to him after a delay. There are two types of
echo presenting in typical communication networks: hybrid (line) echo and
acoustic echo. Acoustic echo cancellation and line echo cancellation both address
similar problems, and are often based on the same technology. However, a line
echo canceller generally cannot replace an acoustic echo canceller, because
acoustic echo cancellation is a more difficult problem. Hybrid echo is the outcome
of impedance mismatches along a telephone line, and is relatively easy to identify
and cancel. Acoustic echo is due to the leakage from loudspeaker to microphone in
a hands-free telephone, and is much more difficult to tackle. With acoustic echo
cancellation, the echo path is very complex (dozens or hundreds of reflections),
lasts 100-200 ms, and can vary continuously during a conversation as people move
around the room. Acoustic echo cancellers are therefore much more complicated
devices.

The solution to these problems is the elimination of the echo with an echo
suppression or echo cancellation algorithm. The echo suppressor offers a simple
but effective method to counter the echo problem. However, the echo suppressor
possesses a main disadvantage since it supports only half-duplex communication.
Half-duplex communication permits only one speaker to talk at a time. This
drawback led to the invention of echo cancellers. An important aspect of echo
cancellers is that full-duplex communication can be maintained, which allows both
speakers to talk at the same time.

This has led to intensive research into the area of echo cancellation, with the aim of
providing solutions that can significantly reduce or even remove acoustic echo.
Good acoustic echo cancellation system can greatly enhance the audio quality of a
communication system by allowing conversation to progress more smoothly and
naturally, keeping the participants more comfortable, and preventing listener
fatigue.

However, a poorly designed acoustic echo cancellation will not provide these
benefits and can even degrade audio quality significantly. This paper describes the
design and simulation of an acoustic echo cancellation (AEC) approach, which is
based on the least mean square(LMS) and somewhat normalized least mean square
(NLMS) algorithm. According to the simulation, the proposed acoustic echo
cancellation approach works well in the modest linear noisy environment.

The way how acoustic echo canceller works is shown in Figure 1.1. In general, the
near end microphone signal d(n) consists of signals from near end microphone,
near end, background noise and echo of the far-end audio signal originating from
the loudspeaker. The last signal is undesired. The objective of the echo canceller is
thus to form a replica of the acoustic echo signal picked up by the terminal
microphone by inserting an adaptive filter h(n) parallel to the signal path through
loudspeaker, room, and microphone.

The objective of the adaptive filter is to provide a response as equal as possible to


that of the acoustic signal path. The far end speech signal x(n) is then fed through
the adaptive filter h(n) to generate the signal y(n) to resemble the echo part of the
microphone signal. The echo y(n) is then subtracted from the microphone signal
d(n) to get the desire speech signal e(n).

Figure 1.1 principle of acoustic echo cancellation system

1.2 Statement of problem

Our university is making relation with other universities with in country and
outside the country but still now we cannot get on line learning and training, so we
are assume the limitation is there is no good video and teleconferencing room and
even it needs good echo cancellation. During the meeting to address the
information uniformly from one place by the president or selected person to the
whole student attend in meeting hall is still impossible in our university.

The noise i.e. echo is now available everywhere which can harm or change the
original signal and a reduction in the quality of the communication. Noise can’t be
removed totally but can be reduced and controlled by using different mechanisms
Acoustic echo cancellation traditionally involves passive methods such as
enclosures, barriers and silencers to attenuate noise. These techniques use either
the concept of impendence change or the energy loss due to sound absorbing
materials. These methods are however not effective for low frequency noise. Many
factors influence the design of an AEC system, such as computational complexity,
memory consumption. A technique to overcome this problem is Acoustic echo
Cancellation (AEC), so we design of Adaptive Acoustic Echo Canceller Using
LMS Algorithm in MATLAB software, which is sound field modification by elect
acoustic means.

1.3 Objective of the Study

1.3.1 General Objective

The general objective is to design and implementation of acoustic echo


cancellation using MATLAB software.

1.3.2 The specific objectives

 To understand how echo cancelling is achieved.

 To develop and implement the active echo cancellation in accordance to the


established design parameters.

 Design of Adaptive Acoustic Echo Canceller Using LMS Algorithm.

 To cancel or reduce the echo signal as much as possible.

1.4 Scope of this project

Scope of this project is about echo cancelers have found wide use in full-duplex
data transmission over two-wire circuits and are now being applied to control echo
and howl in electronic conferencing applications. We simulated using adaptive
algorithm to reduce echo in a communication system by MATLAB software.

Implement an existing code to reduce Acoustic Echo by using different


Algorithms. The variations in the echo path models were small. They do not vary
as much as required during the process. The improvement on echo canceller with
very low complexity algorithms to work well even with big variations in echo path
models and in noisy environment will be the further scope.

1.5 Literature review

The aim of this work is to review the most recent acoustic echo cancellation
techniques and their applicability for current hands free applications. Therefore,
this paper presents Acoustic echo cancellation (AEC) systems challenges and
comparison between these techniques is also presented.

The history of echo cancellation begins on 10 July 1962.On that date, Bell
Laboratories ushered in the era of satellite communications with the launching of
Telstar, the first telecommunications satellite. Echo cancellation was developed in
the early 1960s by AT&T Bell Labs and later by COMSAT Tele-Systems. The
adaptive echo canceller tries to overcome the deficiencies of the classical methods
(Sondhi, Mar. 1967)].

Telephony via Telstar (mentioned earlier), which was a low-flying satellite at


about 200 mi above the surface of the Earth, would not have introduced any major
problems beyond those of terrestrial telephony. However, even in the early 1960s,
it was anticipated that telephony via satellites would eventually use so-called
geostationary satellites. These are satellites in the earth’s equatorial plane that take
exactly 24 h to complete an orbit, so they stay at a fixed position relative to the
earth. That corresponds to about 500 ms of propagation time for a radio wave.
With additional delays at the end point, the total round trip delay of the echo can be
as high as 600 ms. Experiments showed that a delay of this length in the absence of
echoes can be acceptable for telephony. However, such a long delay changes the
dynamics of a conversation to the extent that echo suppressors no longer provide a
satisfactory solution to the echo problem.
Bursts of unsuppressed echo and clipping of soft segments of the near-end speech
become much too frequent to be acceptable.

Improvements in the design of echo suppressors were not able to deal with this
problem. A new technique was required that did not interrupt the echo return path,
and that technique was echo cancellation as opposed to echo suppression.

The idea of adaptive echo cancellation, first proposed by John L. Kelly of Bell
Labs. John Kelly unfortunately died of a sudden heart attack so the task of writing
the first full paper summarizing this work fell on Man Mohan Sondhi (Sondhi,
Mar. 1967)

M.M Sondhi:- Clearly states the history of echo cancellation that is important used
as a background for this project and also idea of adaptive echo cancellation by
using different algorithm was addressed. However he did not evaluate the effective
working of the algorithm and compare the convergence performance of regular
LMS algorithm to the normalized variant also did not addressed by him.

Therefore in order to evaluate the effective working of the algorithm, some basic
tests were conducted that is convergence test and Compare the convergence
performance of regular LMS algorithm to the normalized variant in this project
were added.

Lin Bai et al:- Adaptive algorithm for ANC to filter a noisy speech signal is
proposed in this paper. The new algorithm further relaxes the constraint in the CS-
LMS algorithm. The new algorithm attempts to minimize the estimation error and
the estimation is obtained using the concept of Taylor’s expansion. CS-LMS can
be seen as a special case of the new algorithm. Analysis results show that the new
algorithm can obtain better EMSE performance than NLMS and the new algorithm
can get performance improvement.

Minimization the estimation error and performance increasing is achieving in a


good manner were considered as advantage. However it leads additional cost due
to computational complexity that is used Taylor’s explanation. Therefore in this
project minimize the computational complexity and specifying the project in echo
cancellation not consider the whole noise that is modified from Lin Bai et al.
From the literature review, the input that has been collected is useful for better
understanding of this project to overcome the problem caused by echo cancellation
is used. Now that the need for an acoustic echo canceller is recognized, this project
gives the best AEC solution for our university by MATLAB software. An
overwhelming breadth of the literature, curving different techniques for Acoustic
echo cancellation the project report’s in the area of Acoustic echo cancellation for
Arbaminch university.

1.6 Methodology
We had to start from the research phase at the beginning and need to gain
knowledge on all the echo cancellation and different type algorisms components
that we had intended to use for our project.
 Generally, the methods and steps involved throughout the study are as
following;
 Literature review: We are gathering different information and components by
referring different books and searching web site regarding with our project.

 System analysis and design approach: By using LMS Algorism we will design
acoustic echo cancellation and analyze how to remove delayed (echo) part from
original sound.
 Simulation: Simulate in MATLAB software

 Hardware tools: Desktop computer (laptop), Storage devices: hard disk, flash
disc, displaying devices like printer.

1.7 Project organization

This paper analyzed the echo cancellation by developing MAT LAB code. The
project is preceded by the use of MAT LAB software. Generally this project
includes five chapters, each describing different parts but in general related.

The first chapter introduces the background, statement of problem; objectives of


the project including the scope and limitation of the project, literature review and
methodology were explained.

The second chapter explores the basics of acoustic echo cancellation, the need and
advantage of the echo cancellation. It also explains about adaptive filters
application and different algorithms. The third chapter is about the system design
and flowchart for echo cancellation, the analysis of LMS algorithm and its block
diagram are explained.

The fourth part is the result and discussion of the project, in this part the MATLAB
Code is developed and run then the plots are put with explanation of their
characteristics. The output of echo canceller and comparison of the convergence
performance is shown in this part by simulating in MAT LAB software.

Finally the last part is about conclusion and recommendation based on result as this
is one parts of the projects.
CHAPTER TWO
2. Basic Echo Canceller
A basic echo canceller used to remove echo in telecommunication networks is
presented in Figure 2.1. This problem can be solved by using an adaptive filter that
gradually matches its estimated impulse response,h^ to that of the impulse response
of the actual echo path, h. The echo path is highly variable and can even depend on
such things as the movement of people in the room as well as other things. These
variations are accounted for by the adaptive control loop, which is built into the
canceller. The estimated echo ^y (n), desired response d(n) =r(n)+v(n) , error signal
is e(n) is given by
e ( n )=d ( n ) −^y (n) …… ……eq 2.1

In the ideal case, e(n) = v(n) this represents the case when the adaptive echo
canceller is perfect.

Figure 2. 1 a Generic Adaptive Echo Canceller


2.2 Acoustic Echo Cancellation in teleconference/Videoconference

When the telephone connection is between hands-free telephones or between two


conference rooms, then an acoustic echo problem emerges that is due to the
reflection of the loudspeaker’s sound waves from the boundary surfaces and other
objects back to the microphone.

This acoustic echo can be removed using an adaptive filter as illustrated in Figure
2.1 Echo is the delayed and distorted version of the original speech which is
reflected back to the source. If reflected wave arrives after a very short time of
direct sound, it is considered as a spectral distortion or reverberation. However,
when the reflected wave arrives a few tens of milliseconds after the direct sound, it
is heard as a distinct echo. In data communication, the echo can lead to a big data
transmission error. In application like hands-free telecommunications, this echo, in
multichannel conditions, can make conversations impossible. Thus the echo has
been a big problem in communications networks.

2.3 Acoustic Echo Cancellation (AEC)

Acoustic echo occurs when an audio signal is reverberated in an enclosed


environment such as conference rooms. The echo signal is the combination of
original signal plus attenuated and time delayed images of the original signal. In
this paper the echo path is generated using image model of the Room Impulse
Response (RIR).

Adaptive filters are efficient filters that iteratively alter their filter coefficients in
order to achieve an optimal output. Adaptive echo cancellation is achieved by
synthesizing the effect of echo path on voice or data and subtracting it from the
echo path output. The error function which is the difference between the desired
Signal and the filtered output is minimized algorithmically by the adaptive filter by
altering the coefficients. For the cancellation of echo the adaptive filter is used in
the feedback path. The role of the adaptive filter is to minimize the error between
the desired signal (i.e., the signal reverberated within the acoustic environment)
and filter output. The error signal is used to steer the filter coefficients to converge
fatly to optimum value which is depend on the input signals back into the adaptive
filter and its coefficients are converged according to an update equation to
minimize this error function or cost function. In case of AEC, the optimum value
of the output of the adaptive filter is equal to the echo signal. While the adaptive
filter output is equal to the desired signal the error signal goes to zero. In this
particular situation as we want the echo signal is completely cancelled and the FE
user would not receive the original speech returned back to them.

Figure 2. 2 The basic model of adaptive filter


The notations are used in the figure above are:
Far-end signal: x(n)
Near-end signal: v(n)
The true echo path (room impulse response): h
Echo signal: y(n)
Microphone signal: d(n) = v(n) + y(n)
Estimate echo path: h^ (n)
Estimate echo signal: ^y (n)
Error signal: e ( n )=v ( n )+ y ( n )−^y ( n ) ….. ….. eq 2.2
The echo path h of the room normally variable depends on the room structure and
the moving object inside. The estimated echo ŷ(n) is calculated from the reference
input signal x(n) and the adaptive filter ĥ(n). The near-end signal v(n) and
background noise are added into echo signal y(n) to create the desired signal d(n) ,
d ( n )=v ( n ) + y (n) …. …. eq 2.3

The signal x (n) and y (n) are correlated. Then, it gets the error signal as,
e ( n )=d ( n ) −~y ( n )=v ( n ) + y ( n ) −~y ( n ) …. …. eq 2.4

The adaptive filter works to minimize the echo ( y ( n )− ^y ( n )) to be zero to obtain only
near-end signal v(n) in the perfect case.

2.4 Adaptive filters

The adaptive filters can be implemented in a number of different structures or


realizations. The choice of the structure can influence the computational
complexity of the process and also the necessary number of iterations to achieve a
desired performance level. Basically, there are two major classes of adaptive
digital filter realizations, distinguished by the form of the impulse response,
namely the FIR filter and the Infinite duration Impulse Response (IIR) filters.

FIR filters are usually implemented with non-recursive structures, whereas IIR
filters utilize recursive realizations. FIR filter is preferred for AEC applications for
its stability during adaptation. IIR can normally achieve similar performance as
FIR, with smaller amount of coefficients and less computation. However, as the
complexity of the filter grows, the order of the IIR filter increases a lot and the
computational advantage is less dominant. Also, IIR suffers from the instability
problem.

2.4.1 General block diagram of the adaptive filters

The Wiener filter consists of a digital input signal x(k), an desired output d(k) and
a linear filter containing the answer to the impulse h(k); the input x(k) is used to
obtain the output y(k). The difference between the output of Wiener filter y(k) and
the desired output d(k) is the estimation error e(k).The importance of Weiner
filtration is given by the answer of the impulse h(k), which gives a small estimation
error. So, the main purpose is to minimize the square value of e(k).
Here w represents the coefficients of the FIR filter tap weight vector, x(n) is the
input vector sample, is a delay of one sample, y(n) is the adaptive filter output, d(n)
is the desired echoed signal and e(n) is the estimation of the 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). The error signal is fed back into the
adaptive filter and its coefficients are changed algorithmically in order to minimize
a function of this difference, which is known as the cost function.

Figure 2. 3 block diagram of adaptive filter


2.4.2 Adaptive Algorithms

The choice of algorithm is determined by the performances like rate of


convergence, miss-adjustment, tracking, robustness, computational complexity,
structure. Adaptive algorithms are broadly classified as sample-by-sample adaptive
and block adaptive algorithms.

In the sample-by-sample adaptive algorithms the adaptation can take place both in
time domain as well as in frequency domain. Therefore, sample-by sample
adaptive algorithm will further divided into two classes of algorithms. One class
includes filter that are updated in time domain sample-by-sample, called time
domain sample-by sample adaptive algorithm. Algorithms belonging to this
category are Least Mean Square (LMS) and Recursive Least mean Square (RLS)
which are popular due to number of advantages. Other class includes filters that are
updated in frequency domain and are known as Frequency Domain Adaptive Filter
(FDAF). FDAF is designed to achieve fast convergence rate and low
computational cost using of FFT reduces the computational complexity of FDAF.
The common algorithm belonging

to this category is frequency domain adaptive algorithm. Instead of linear


convolution and correlation that are performed in LMS and NLMS adaptive filter,
circular operation is performed in frequency domain on a block-by-block rule
instead of sample by sample in LMS and NLMS. The major drawbacks of FDAF is
has long delay due to some restore operation that is required to perform the circular
operation.

Adaptive filter algorithms are widely applied in acoustic echo canceller (AEC)
such as namely Recursive Least Square (RLS) filter and Least Mean Square
(LMS) filter. The RLS is a Recursive implementation of Wiener filter that is used
for stationary processes. A relatively simpler algorithm, LMS, uses the gradient
search method to search for the least square error filter coefficients. The LMS
algorithm provides good numerical stability and its hardware requirements are low,
therefore being the best choice on the available hardware platform. A disadvantage
of this algorithm is its weak convergence, but based on obtained results this didn’t
prove to become a major issue. On the other hand, the NLMS algorithm is one of
the most implemented adaptive algorithms in actual telecom/industrial
applications. The echo cancellation algorithm is recommended to be implemented
in hardware in case of Internet conversations (VoIP or voice chat) where high
latencies and echo can induce perturbations.

2.5 LMS algorithm

The least mean square, (LMS), is a search algorithm that is widely used in various
applications of adaptive filtering. The main features that attracted the use of the
LMS algorithm are low computational complexity, proof of convergence in
stationary environments and stable behavior when implemented with finite
precision arithmetic. Figure 2.4 illustrates how such an algorithm works. A path
that changes the signal x is called h. Transfer function of this filter is not known in
the beginning. The task of the LMS algorithm is to estimate the transfer function of
the filter.

The result of the signal distortion is calculated by convolution and is denoted by r.


In this case r is the echo and h is the transfer function of the hybrid. The near-end
speech signal v is added to the echo. The adaptive algorithm tries to create a filter
w. The transfer function of the filter is an estimate of the transfer function for the
hybrid. This transfer function in turn is used for calculating an estimate of the
echo. The echo estimate is denoted by rˆ.
Figure2. 4 LMS Algorithm

The signals are added so that the output signal from the algorithm is

v+ r−^r =v +e …. …. eq 2.4b

Where denotes the error signal. The error signal and the input signal x are used for
estimation of the filter coefficient vector w. One of the main problems associated
with choosing the filter weight is that the path h is not stationary. Therefore, the
filter weights must be updated frequently so that the adjustment to the variations
can be performed.

The filter is a FIR filter with the form

−1
w=b 0+ b 1 z +…+(bL−1) z
−( L−1)
…. …. eq 2.5

A perfect FIR filter is linear, time-invariant and stable in a BIBO sense.

However, in a real-time environment, linearity is never a possibility and the first


criterion is not fulfilled so the filter can never be perfect. Updating of the filter
weights is realized in accordance with

w ( k +1 )=w(k )μgw (k ) …. …. eq 2.6


For k = 0, 1, 2…. Where gw(k) represents an estimate of the gradient vector and μ
is the convergence factor or step size.

Figure 2. 5 Generic LMS Algorithm


Figure 3.5 shows that
e ( k )=d ( k )− ^y ( k )=d ( k )−x t (k )w (k ) …. …. eq 2.7

Where w(k) is a vector containing the filter weights [b0,b1,b2,…,b0] and x(k)
represents the vector[x(n),x(n-1),…,x(n-L)]T. L is the length of the adaptive filter.
Then the gradient estimate gw(k) is given by
gw ( k )=2d ( k ) x ( k ) +2 x (k) X (k ) w(k) …. …. eq 2.8
T

¿ 2 x ( k ) ( d ( k )+ X ( k ) w ( k )) …. …. eq 2.9
T

=2 e ¿k)x(k) …. ….eq 2.10


The resulting gradient-based algorithm is known. It minimizes the mean of the
squared error, as the least-mean square (LMS) algorithm, whose updating equation
is given by
w ( k +1 )=w ( k ) +2 μe (k ) x( k ) …. ….. eq 2.11

2.6 Performance evaluation


2.6.1 Convergence Test
The first and paramount test of the algorithm was whether or not the algorithm
converged. If the filter coefficients used in the adaptive algorithm did not
converge, the code would be useless. Therefore, several tests were performed on
the simulated data in order to verify the convergence of the filter coefficients.
These tests were conducted by varying the convergence factor, μn, and examining
the effect on the filter coefficients and the plot of the error signal e(n). Through
careful observation it was determined that produced faster convergence. And we
can evaluate by Echo Return Loss Enhancement (ERLE) this is measured in dB is
defined as the ratio of the instantaneous power of the signal, d(n), and the
instantaneous power of the residual error signal, e(n), immediately after
cancellation.
Pd
ERLE=10 log .... …. eq 2.12
Pe

For a good echo canceller circuit, an ERLE in the range of 30 dB – 40dB is


considered to be ideal. ERLE measures the amount of loss introduced by the
adaptive filter alone but in this project evaluate only by Convergence Test.
CHAPTER THREE

3. SYSTEM DESIGN FOR ECHO CANCELLATION

The echo cancellation system design flowchart is shown in following figure 5. This
flow chart is designed for acoustic echo cancellation system using LMS algorithm.
This program must create echo signal and desired signal d (n). From overall flow
chart, the process must read far-end signal, x (n) and room impulse response, h.
Then, the program created echo signal from near-end speech signal, v (n) and read
near end signal. The program must create desired signal, d (n) to compare the
result from the output results. The echo canceller run using LMS and NLMS
algorithm to compute error signal. Then, the echo cancellation process gets
residual echo by subtracting estimate echo from the desired signal. Finally, the
nonlinear processor removed the remaining echo from adaptive filter output.

Figure 3. 1 Flowchart for Echo Cancellation


CHAPTER FOUR

4. SIMULATION AND RESULTS

4.1 Discussion

The previous chapters provide a detailed sketch of an AEC and the flowchart for
the software simulation. In this chapter the results of simulation of the AEC
algorithm, which was performed in MATLAB are discussed.

4.2 Results

First modeled the acoustic of the loudspeaker-to-microphone signal path where the
speakerphone is located. Use a long finite impulse response filter to describe the
characteristics of the room. The plot of impulse response is H(n) presented in
Figure 4.1

Figure 4. 1 plot of the impulse response H(n)

This section presents a graphical representation of the results obtained by


simulating the algorithm in MATLAB. The plot of the far-end signal x(n) is
presented in Figure 4.2.
Figure 4. 2 Plot of the Far-end Signal, x(n)

The plot of the near-end signal x(n) is presented in Figure 4.3.

Figure 4. 3 Plot of the Near-end Signal, x(n)


The far-end signal was delayed and scaled in order to produce the echo 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.
Figure 4. 4 Plot of the microphone Signal
The desired signal, d(n) or Now this Microphone Signal is entered into Adaptive
filter to get desired Echo free signal which can be transmitted to the receiver end
contain only near end signal (Sender speech). After Filtering echo free Signals
shown in figure 4.4. 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. Pick some initial parameters for the filter and see how well the far-end
speech is cancelled in the error.

Figure 4. 5 Microphone Signal is entered into Adaptive filter and output of AEC
By using Normalized LMS method in this paper can generate Echo free signal
which can be transmitted to the receiver end in figure 4.6

Figure 4. 6 Normalized LMS method

In order to evaluate the effective working of the algorithm, some basic tests were
conducted. This section provides a brief account of these tests.

Compare the convergence performance of regular LMS algorithm to the


normalized variant, we see the normalized version adapts in far fewer iterations to
a result almost as good as normalized version.

Figure 4. 7 convergence performance of regular LMS


Figure 4. 8 convergence performance of regular NLMS

Figure 4. 9 comparing the LMS and NLMS convergence performance


CHAPTER FIVE

5. CONCLUSION AND RECOMMENDATIONS

5.1 Conclusion

The Echo cancellation algorithm presented in this paper successfully attempted to


find a software solution for the problem of echoes. This paper is improves the
overall system of acoustic echo cancellation system using mainly LMS and also for
comparison NLMS. The performance of the LMS adaptive filtering algorithm is
expressed by its simplicity to implement and its stability when the step size
parameter is selected appropriately, however the convergence rate is poor.
Therefore from the result concluded that the convergence rate of NLMS is better
than LMS but it introduce misadjustment.

5.2 Recommendations

There are many possibilities for further development in this work. Other
techniques such as infinite impulse response (IIR) or lattice filtering may prove to
be more effective in an echo cancellation application, but with more hardware
complications and need more than one chip to implement.

This project is not implementing in hardware or without utilizing any DSP


hardware components because the Speakerphone, Voice-Enabled Internet of
Things (IoT) Equipment, Automatic Speech Recognition (ASR) Preprocessing,
very large scale integrated DSP processer needs high power, high memory
consumption and expensive even no available TMS320C6748 DSP low-cost
development kit (LCDK). Therefore anyone having interest to support by budgets
can implement this project in hardware for the university or for any other in
demand.
REFERANCE
[1] (Sondhi, Mar. 1967.[2])
[2] (Lin Bai, March, 2010.)
[3] (S. Raghavendran, October 2003)
[4] (H.HAYES, 1996)
APPENDEX
%on line sound importing or recourding
recObj = audiorecorder;
recordblocking(recObj, 15);
play(recObj);
y = getaudiodata(recObj);
plot(y);
play(recObj);
y = getaudiodata(recObj);
plot(y);
%code of AEC
M=4001;
fs=8000;
[B,A]=cheby2(4,20,[0.1, 0.7]);
Hd=dfilt.df2t([zeros(1,6) B]);
hFVT=fvtool(Hd);
set(hFVT, 'color' ,[1 1 1])
v=340;
H = filter(Hd,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
plot(0:1/fs:0.5,H);
xlabel('Time [sec]' );
ylabel('Amplitude' );
title( 'Room Impulse Response' );
set(gcf, 'color' , [1 1 1])
figure(1)
hold on
load nearspeech
n = 1: length (v);
t=n/fs;
plot(t,v);
axis([0 33.5 -1 1]);
xlabel('Time [sec]' );
ylabel('Amplitude' );
title('Near-end speech signal' );
set(gcf, 'color' , [1 1 1])
figure(2)
hold on
load farspeech
x =x( 1: length (x));
dhat = filter(H,1,x);
plot(t,dhat);
axis([0 33.5 -1 1]);xlabel('Time [sec]' );
ylabel('Amplitude' );
title('Far-End speech Signal' );
set(gcf, 'color' , [1 1 1])
figure(3)
hold on
d=dhat + v+0.001*randn(length(v),1);
plot(t,d);
axis([0 33.5 -1 1]);
xlabel('Time [sec]' );
ylabel('Amplitude' );
title('Microphon Signal' );
set(gcf, 'color' , [1 1 1])
figure(4)
hold on
mu=0.025;
W0 = zeros(1,2048);
del = 0.01;
lam = 0.98;
x = x(1:length(W0)*floor(length(x)/length(W0)));
d = d(1:length(W0)*floor(length(d)/length(W0)));
% Construct the Frequency-Domain Adaptive Filter
fdafilt = dsp.FrequencyDomainAdaptiveFilter('Length',32,'StepSize',mu);
[y,e] = fdafilt(x,d);
n = 1:length(e);
t = n/fs;
pos = get(gcf,'Position');
set(gcf,'Position',[pos(1), pos(2)-100,pos(3),(pos(4)+111)])
subplot(3,1,1);
plot(t,v(n),'g');
([0 33.5 -1 1]);
xlabel('Time [sec]');
ylabel('Amplitude');
title('Near-End Speech Signal of MR.ABERA');
subplot(3,1,2);
plot(t,d(n),'b');
axis([0 33.5 -1 1]);
ylabel('Amplitude');
title('Microphone Signal Mr. Amex + Mr.Abera');
subplot(3,1,3);
plot(t,v(n),'r');
axis([0 33.5 -1 1]);
ylabel('Amplitude');axis
title('Output of Acoustic Echo Canceller');
set(gcf, 'color' , [1 1 1])
#%Normalized LMS method
FrameSize = 102; NIter = 14;
lmsfilt2 = dsp.LMSFilter('Length',11,'Method','Normalized LMS', ...
'StepSize',0.005);
firfilt2 = dsp.FIRFilter('Numerator', fir1(10,[.05, .075]));
sinewave = dsp.SineWave('Frequency',0.001, ...
'SampleRate',1,'SamplesPerFrame',FrameSize);
TS = dsp.TimeScope('TimeSpan',FrameSize*NIter,'TimeUnits','Seconds',...
'YLimits',[-3 3],'BufferLength',2*FrameSize*NIter, ...
'ShowLegend',true,'ChannelNames', ...
{'echo signal', 'Filtered signal'});
%%
% Pass the echo input signal into the LMS filter and view the filtered
% output in the time scope.
for k = 1:NIter
x = randn(FrameSize,1); % Input signal
d = firfilt2(x) + sinewave(); % echo + Signal
[y,e,w] = lmsfilt2(x,d);
TS([d,e]); % echo = channel 1; Filtered = channel 2
end
#% convergence performance of regular NLMS
x = 0.1*randn(500,1);
[b,err,res] = fircband(12,[0 0.4 0.5 1], [1 1 0 0], [1 0.2],...
{'w' 'c'});
d = filter(b,1,x);
lms_normalized = dsp.LMSFilter(13,'StepSize',mu,...
'Method','Normalized LMS','WeightsOutputPort',true);
[~,e1,~] = lms_normalized(x,d);
plot([e1]);
title('NLMS Conversion Performance');
legend('NLMS Derived Filter Weights');
#% convergence performance of regular LMS
x = 0.1*randn(500,1);
[b,err,res] = fircband(12,[0 0.4 0.5 1], [1 1 0 0], [1 0.2],...
{'w' 'c'});
d = filter(b,1,x);
lms_normalized = dsp.LMSFilter(13,'StepSize',mu,...
'Method','LMS','WeightsOutputPort',true);
[~,e2,~] = lms_normalized(x,d);
plot([e2]);
title('LMS Conversion Performance');
legend('LMS Derived Filter Weights');
#% comparing the LMS and NLMS convergence performance
x = 0.1*randn(500,1);
[b,err,res] = fircband(12,[0 0.4 0.5 1], [1 1 0 0], [1 0.2],...
{'w' 'c'});
d = filter(b,1,x);
lms = dsp.LMSFilter(13,'StepSize',mu,'Method',...
'Normalized LMS','WeightsOutputPort',true);
lms_normalized = dsp.LMSFilter(13,'StepSize',mu,...
'Method','Normalized LMS','WeightsOutputPort',true);
lms_nonnormalized = dsp.LMSFilter(13,'StepSize',mu,...
'Method','LMS','WeightsOutputPort',true);
[~,e1,~] = lms_normalized(x,d);
[~,e2,~] = lms_nonnormalized(x,d);
plot([e1,e2]);
title('Comparing the LMS and NLMS Conversion Performance');
legend('NLMS Derived Filter Weights', ...
'LMS Derived Filter Weights','Location', 'NorthEast');

You might also like