Nothing Special   »   [go: up one dir, main page]

0% found this document useful (0 votes)
114 views80 pages

Acoustic Echo Cancellation

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 80

BULE HORA UNIVERSITY

College of engineering Technology


Department of Electrical and computer Engineering
Title: Analysis of acoustic echo cancellation in
Teleconference using adaptive filter
Engineering (Communication
engineering)
PREPARED BY: -
NAME ID NUMBER
1. Desale chali…………………………….ru-1440/10
2. Mosisa nugusa………………………….ru-
3. Jiregna marara…………………………ru-
4. Daba fufa………………………………ru-

Advisor Mr. luile.N

Co - Advisor: Mr.Desalegn.K

Submission Date:-/-/2022
Bule Hora ,Ethiopia
Declaration
We, the undersigned, declare that this thesis shall be our original work, and the project work
has not been presented for a degree in this or any other universities and all sources of
materials that will be used for the project work will have been fully acknowledge.
Name ID Number Signature
1. Desale chali 1440/10 ________________
2. Mosisa Nugusa 0921/10 _______________
3. Jiregna Marara 0526/10 ________________
4. Daba Fufa 0706/10 _______________

Approved by: -
Advisor
Name:luiel.N
Signature:
_______________

Co - Advisor: -
Desalegn.K

Signature:
_______________
ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Acknowledgment
At the very beginning we would like to express our deepest gratitude to almighty God for giving
us the strength and the composure to prepare this document within the scheduled time. Then we
would like to express our gratitude to our Adviser Luile.N without his Assistance and
dedicated involvement in every step throughout the process, this proposal would have never
been accomplished. Finally, we consider it ultimate to pay regards to our parents and all the
teachers. Electrical Engineering Department Electronics and Communication Stream and we
would like to thank our friends and classmate who helped us a lot in finalizing this project.

COMMUNICATION STREAM, BHU, FINAL PROJECT 3


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Contents
Declaration .......................................................................................................................................................... ii

Acknowledgment ................................................................................................................................................. 3

Abstract ................................................................................................................................................................ 6

Abbreviations ....................................................................................................................................................... 7

CHAPTER ONE .................................................................................................................................................. 8

1. INTRODUCTION............................................................................................................................................ 8

1.1 Introduction to adaptive filters: ................................................................................................................ 14

1.2 Statement of the problem.......................................................................................................................... 17

1.3 Objective of project .................................................................................................................................. 17

1.3.1 General Objective .............................................................................................................................. 17

1.3.2 Specific Objectives ............................................................................................................................ 17

1.4 Methodology for the work ........................................................................................................................ 17

1.5 Significance of the project ........................................................................................................................ 18

1.6 scope of the project................................................................................................................................... 18

CHAPTER TWO................................................................................................................................................ 19

LITRATURE REVIEW ..................................................................................................................................... 19

2.1 Over view ................................................................................................................................................. 19

2.2 Related works Upal Mahbub et al...... .................................................................................................... 19

2.3 Approaches of literature to solve the problem .......................................................................................... 22

2.4 Limitation of the approaches of literature: .............................................................................................. 23

2.5 This project approaches ............................................................................................................................ 23

CHAPTER THREE ............................................................................................................................................ 24

SYSTEM OF DESIGN ...................................................................................................................................... 24

3.1 Mean Square Error (MSE) Adaptive Filters ............................................................................................. 24

3.1.1 Least mean square of adaptive filter .................................................................................................. 24

3.1.2 Normalized Least Mean Square (NLMS) Algorithm ........................................................................ 25

3.2 Normalized cross-correlation (NCC) algorithm ....................................................................................... 27

COMMUNICATION STREAM, BHU, FINAL PROJECT 4


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

3.3 Various parameters to calculate filter performance .................................................................................. 28

3.4 Measurement of the echo cancellation: .................................................................................................... 30

3.4.2 Misalignment: .................................................................................................................................... 31

3.5 The overall system design of this project are viewed by this diagram ..................................................... 32

3.5.1. Adaptive filter algorithms ................................................................................................................. 33

3.6 Matlab....................................................................................................................................................... 36

3.6.1 Requirements during the simulation .................................................................................................. 38

3.6.2 Explanation of MATLAB Code ...................................................................................................... 40

CHAPTER FOUR .............................................................................................................................................. 43

SIMULATION RESULT AND DESCUSSION................................................................................................ 43

4.1 simulation result ....................................................................................................................................... 43

4.2 Discussion ................................................................................................................................................ 50

CHAPTER FIVE ................................................................................................................................................ 51

CONCLUSION AND RECOMMENDATION ................................................................................................. 51

5.1 Conclusion ................................................................................................................................................ 51

5.2 Recommendation ...................................................................................................................................... 51

REFERENCE ..................................................................................................................................................... 52

Appendix ............................................................................................................................................................ 55

COMMUNICATION STREAM, BHU, FINAL PROJECT 5


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Abstract
In modern telecommunication systems like hands-free and teleconferencing systems, the
Problem arise during conversation is the creation of an acoustic echo. This problem degrades
the quality of the information signal. All speech processing equipment‟s like noise cancelling
headphones and hearing aids should be able to filter different kinds of interfering signals and
produce a clear sound to the listener. Currently, echo cancellation is a most interesting and
challenging task in any communication system. Echo is the delayed and degraded version of
original signal which travels back to its source after several reflections. Eliminating this
effect without affecting the original quality of the speech is a challenge of research in present
days. Echo cancellation in voice communication is a process of removing the echo to
improve the clarity and quality of the voice signals. In our thesis we mainly focused on the
acoustic echo cancellation using LMS and NLMS algorithms to reduce this unwanted echo,
thus increasing communication quality. The Acoustic echo cancellation with adaptive
filtering technique will more accurately enhance the speech quality in hands free
communication systems. The main aim of using adaptive algorithms for echo cancellation is
to achieve higher ERLE at higher rate of convergence with low complexity. The adaptive
algorithms NLMS, is implemented using MATLAB. This algorithm is tested with the
simulation of echo occurring environment by using constant room dimensions, microphone
and source positions. The performance of the NLMS is evaluated in terms ERLE and
misalignment. A teleconference is a telephone meeting among two or more
participants involving technology more sophisticated than a simple two-way phone
connection. At its simplest, a teleconference can be an audio conference with one or both
ends of the conference sharing a speaker phone. With considerably more equipment
and special arrangements, a teleconference can be a conference, called a
videoconference, in which the participants can see still or motion video images of each
other. Because of the high bandwidth of video and the opportunity for larger and multiple
display screens, a videoconference requires special telecommunication arrangements and a
special room at each end. A teleconference is an easy and affordable way to conduct
meetings between people unable to meet face-to-face. It can be used to educate or train,
collaborate and network.

COMMUNICATION STREAM, BHU, FINAL PROJECT 6


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Abbreviations
AEC Normalized Least Mean Square
ANC
PSTN Active Noise Control
NLMS
RIR Convergence Rate
ERLE
FIR
SNR
CRA
Room Impulse
Response
Echo Return Loss
Enhancement
Finite Impulse
Response
Signal to Noise
Ration

coustic Echo
Cancellation

Active Noise
Control

Public Switched
Telephone
Network

COMMUNICATION STREAM, BHU, FINAL PROJECT 7


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

CHAPTER ONE

1. 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 contains two signals. The near-end speech
signal and the far-end echoed speech signal. The acoustic echo, which is also known as a
multipath echo is produced by Poor voice coupling between the earpiece and microphone
in handsets and hands-free Devices. 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.
Speech enhancement is a globally rampant topic in research due to the use of speech enabled
systems in a variety of real-world telecommunication applications [4].
The rapid growth of technology in recent decades has changed the whole dimension of
communications. Today people are more interested in hands-free communication. This
would allow more than one person to participate in a conversation at the same time such as a
teleconference environment. Another advantage is that it would allow the person to have
both hands free and to move freely in the room. However, the presence of a large
acoustic coupling between the loudspeaker and microphone would produce a loud echo
that would make conversation difficult. This is the main problem in hands free
communication. When the speech signal is generated in the reverberated environment, the
echo is created. This acoustic echo is actually the echo which is created by the reflection of
sound waves by the walls of the room and other things that exist in the room such as
chairs, tables etc. The solution to this problem is the elimination of the echo and provides
echo free environment for speakers during conversation. This process of acoustic echo
cancellation is truly useful in enhancing the audio quality of a hand free communication
system. It prevents the listener fatigue and makes participants more comfortable [7].
In hands-free telephony and in teleconference systems, the main aim is to provide a 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. This problem will cause
the bad quality of voice signal and thus talkers could not hear clearly the content of the

COMMUNICATION STREAM, BHU, FINAL PROJECT 8


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

conversation, even though lost the important information. This acoustic echo is actually the
noise which is created by the reflection of sound waves by the wall of the room and the
other things exist in the room. Since the advent of telephony

COMMUNICATION STREAM, BHU, FINAL PROJECT 9


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Echoes have been a problem in communication networks. In particular, echoes can be


generated electrically due to impedance mismatches at various points along the transmission
medium. The most important factor in echoes is called end-to-end delay, which is also known
as latency. Latency is the time between the generation of the sound at one end of the call and
its reception at the other end. Round trip delay, which is the time taken to reflect an echo, is
approximately twice the end-to-end delay. The main objective for engineers is the
cancellation of this acoustic echo and provides an echo free environment for speakers during
conversation. For this purpose, scientists design different adaptive filter algorithms. Our
thesis is also to study and simulate the acoustics echo cancellation by using different adaptive
filter algorithms [9].
Echo
“Echo is the phenomenon in which delayed and distorted version of an original sound or
electrical signal is reflected back to the source”. In nature there are two types of echo: -
1. Electrical echo
2. Acoustic echo
1. 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.
2. 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.

COMMUNICATION STREAM, BHU, FINAL PROJECT 10


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Figure 1 A teleconference system with echo paths of room


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
be computed based on the distance between them (i.e., the length of the direct sound) [12].
Delay = distance/speed of sound
Acoustic Echo Cancellation (AEC)
The acoustic echo, which is also known as a “multipath echo”, is produced by poor voice
Coupling between the earpiece and microphone in handsets and hands-free devices. Further
voice degradation is caused as voice-compressing and encoding/decoding devices process the
voice paths within the handsets and in wireless networks. This results in returned echo signals
with highly variable properties. When compounded with inherent digital transmission delays,
call quality is greatly diminished for the wire line caller. Acoustic coupling is due to the
reflection of the loudspeaker‟s sound waves from walls, door, ceiling, windows and other

COMMUNICATION STREAM, BHU, FINAL PROJECT 11


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

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 unless eliminated. Adaptive cancellation of such acoustic
echoes has become very important in hands-free communication systems such as
teleconference or videoconference systems.

Figure 2 Sources of Acoustic Echo in a Room


To handle with the acoustic echo problem above in teleconference systems, one can use voice
switches and directional microphones but these methods have placed physical restriction on
the speaker. The common and more perfective method is implementing the Acoustic Echo
Cancellation (AEC) to remove the echo. AEC enhances greatly the quality of the audio signal
of the hands-free communication system. Due to their assistance, the conferences will work
more smoothly and naturally, keep the participants more comfortable.

COMMUNICATION STREAM, BHU, FINAL PROJECT 12


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Adaptive filter is a good supplement to achieve a good replica because of the echo path is
usually unknown and time-varying. The figure below illustrates about three step of the AEC
using adaptive filter. Using adaptive filter for AEC follows the three basic steps above:
1. Estimate the characteristics of echo path h (n) of the room: ℎ (n)
2. Create a replica of the echo signal: (n)
3. Echo is then subtracted from microphone signal (includes near-end and echo signals) to
obtain the desired signal: clear signal = d (n) − (n)
In the modern digital communication system such as: Public Switched Telephone Network
(PSTN), Voice over IP (VoIP), Voice over Packet (VoIP) and cell phone networks; the
application of AEC is very important and necessary because it brings the better quality of
service and obtains the main purpose of the communication service providers.

Figure 3: Implement Acoustic Echo Canceller using adaptive filter

COMMUNICATION STREAM, BHU, FINAL PROJECT 13


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

1.1 Introduction to adaptive filters:


The adaptive filtering is an imperative fraction of statistical signal processing. The adaptive
filters are frequently used where the statistical parameters of the system are indefinite. The
use of adaptive filtering provides us new signal processing capabilities which were not
feasible with ordinary fixed filters. An adaptive filter is a special category of filter that
automatically changes its parameters in harmony with input signal by keeping error into
account, using some optimizing algorithms. Due to the complexness of the updating
algorithms, numerous of the adaptive filters are digital in nature that execute digital filtering.
Adaptive filtering originates applications in numerous fields such as, noise and echo
cancellation, system identification, channel equalization, adaptive inverse system
configuration and adaptive linear prediction. This research employment is based on the
implementation of adaptive filtering algorithms for noise and echo cancellation Least Mean
Square (LMS), Normalized Least Mean Square (NLMS), Recursive Least Square (RLS)
algorithms.
MATLAB is used as a Software tool. Our employment is basically divided into two parts.
First part is Noise Cancellation and second is the Echo cancellation. Input audio signal is
taken from MIC which goes to the PC where adaptive filtering algorithms are implemented in
MATLAB to remove noise and echo from the information bearing signal and presents us
valuable information as an output. This research employment contains a brief impression of
our achievements in the field of adaptive filtering for noise and echo cancellation, inclusive
investigation and evaluation of LMS, NLMS and RLS algorithms for noise and echo
cancellation. Simulation consequences of the algorithms in the form of graphs; with the help
of these consequences performance of each algorithm is analyzed.
Basically, filtering is a signal processing technique whose objective is to process a signal in
order to manipulate the information contained in the signal. In other words, a filter is a device
that maps its input signal into another output signal by extracting only the desired information
contained in the input signal. An adaptive filter is necessary when either the fixed
specifications are unknown or time-invariant filter cannot satisfy the specification. Strictly
speaking an adaptive filter is a nonlinear filter since its characteristics are dependent on the
input signal and consequently the homogeneity and additively conditions are not satisfied.
Additionally, adaptive filters are time varying since their parameters are continually changing
in order to meet a performance requirement. An adaptive filter is a system with a linear filter

COMMUNICATION STREAM, BHU, FINAL PROJECT 14


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

that has a transfer function controlled by variable parameters and a means to adjust those
parameters according to an optimization algorithm. Because of the complexity of the
optimization algorithms, almost all adaptive filters are digital filters. Adaptive filters are
required for some applications because some parameters of the desired processing operation
(for instance, the locations of reflective surfaces in a reverberant space) are not known in
advance or are changing. The closed loop adaptive filter uses feedback in the form of an error
signal to refine its transfer function. The term filter is frequently referred to as a system
which is intended to extract valuable information about a prescribed quantity of curiosity
from a noisy channel or data. With such an extensive aim, the filter theory finds applications
in many diverse fields, such as communication system (for example telephone exchanges),
biomedical engineering, radars, sonar‟s.
An adaptive filter is the one which self-adjust its transfer function according to its input by
using some optimizing algorithms such as LMS, NLMS and RLS, which makes it probable
for the filter to perform satisfactorily in an environment where complete knowledge about the
relevant signal characteristics is not available. The algorithm starts its computation from
prescribed initial condition and use information contained in the input data in order to
estimate the weights of the filter. As the parameters of adaptive filters are updated from one
iteration to next, it means that the parameters of the filter become information reliant provide
that the adaptive filter in reality is a non-linear system. A system is said to be non-linear if it
do not obeys the principle of superposition otherwise system is linear .Adaptive filters have
extensive applications. They are used for adaptive noise and echo cancellation system
identification, channel equalization, adaptive inverse system configuration and adaptive
linear prediction. Nowadays a day a wide Varity of adaptive algorithm is available.

COMMUNICATION STREAM, BHU, FINAL PROJECT 15


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

The choice of an adaptive filter heavily depends upon one of the following factors:-
 Computational requirements.
 Rate of convergence.
 Robustness.
 Numerical properties.
 Structure.
These abovementioned factors influences a great deal on the selection of an adaptive
Algorithm for the cancellation of noise and echo. In this paper adaptive filter algorithms such
as Least Mean Square (LMS), Normalized Least Mean square (NLMS) and Recursive Least
Square (RLS) are used for adaptive noise cancellation and echo cancelation. The simulation
results shows the efficiency of adaptive algorithms in the presence of white noise. The rest of
the paper is organized as follows: Section I represents the system model for adaptive noise
cancellation and adaptive echo cancellation. Section III represents the adaptive algorithms
such Least Mean Square (LMS), Normalized Least Mean Square (NLMS), Recursive Least
Square (RLS). In Section IV, simulation results are presented and Section Concludes the
paper.
Application of adaptive filter.
Owing to the powerful digital signal processors and the development of advanced adaptive
algorithms there are a great number of different applications in which adaptive filters are
used. The number of different applications in which adaptive techniques are being
successfully used has increased enormously during the last two decades. There is a wide
variety of configurations that could be applied in different fields such telecommunications,
radar, sonar, video and audio signal processing, noise reduction, between others.
The adaptive filtering is an important part of statistical signal processing. The adaptive filters
are mostly used where the statistical parameters of the system are unknown or in anon-
stationary environment. The use of adaptive filtering provides us new signal processing
capabilities which were not possible with ordinary fixed filters. In this paper adaptive filter
algorithms such as Least Mean Square (LMS) and Normalized Least Mean Square (NLMS)
are used for adaptive noise cancellation and echo cancelation. The simulation results show the
efficiency of adaptive algorithms in the presence of white noise. During analysis of LMS and

COMMUNICATION STREAM, BHU, FINAL PROJECT 16


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

NLMS it is concluded that the performance of NLMS algorithm is better than LMS
algorithms for the considered problem.

1.2 Statement of the problem.


The study of echo cancellation is needed because, noise is now available everywhere which can
harm or change the original signal. 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. A technique we used in our
project to overcome this problem is Acoustic echo Cancellation (AEC), which is sound field
modification by elect acoustic means.
1.3 Objective of project
1.3.1 General Objective
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.
To develop and design acoustic echo cancellation using adaptive filter in MATLAB software.
1.3.2 Specific Objectives
To understand how active audio noise cancelling is achieved and to use this
knowledge to write the code on MATLAB and generate the desired signal, then
compare these signals their effectiveness over the audio frequency range
 To establish the design parameters of noise cancellation using MATLAB.
 To develop and implement the active noise cancellation in accordance to the
established design parameters.
 To evaluate system‟s performance and acceptability of the active noise cancellation
using acceptable test measurements.
 Design of Adaptive Acoustic Echo Canceller
1.4 Methodology for the work
 Prepare a work plan for this problem.
 Select and collect components (the reading material and MATLAB software) needed
for the project.

COMMUNICATION STREAM, BHU, FINAL PROJECT 17


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

 Select and collect the reading materials that used to for the
project.
 Design and analysis the mathematical model and simulation
system.

1.5 Significance of the project


In a teleconferencing system, the coupling between loudspeakers and microphones usually
Results in many undesirable properties. This property leads the creation of echo signal that
affect the original signal. As result communication is difficult to communicate due noise or
echo. To overcome the difficulties, it is well accepted that an Acoustic Echo Canceller (AEC)
is required. This method is limited the amount of echo from the original by using adaptive
filters.

1.6 scope of the project


The scope of this project is:
 Limited an echo from the desired signal to obtain the original signal
 By implement adaptive filter algorithms that are Lms and Nlms
 By measuring several performance of adaptive filter like SNR,ERLE
 By estimating impulse response of that environment

COMMUNICATION STREAM, BHU, FINAL PROJECT 18


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

CHAPTER TWO

LITRATURE REVIEW
2.1 Over view
Echo is the reflected copy of the voice heard some time later and a delayed version of the
Original sound or electrical signal is reflected back to the source. Echo is a congenital
Problem which mainly occurs in PSTN (public switching telephone network). Echo occurs in
analogy part of a telecommunication system. Echoes of our speech are heard as they are
reflected from the floor, walls and other neighboring objects. If a reflected wave arrives
after a very short time of direct sound, it is considered as a spectral distortion or
reverberation. However, when the leading edge of 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 incur a big data transmit error. In applications like hands free telecommunications,
the echo, with rare exceptions, conversations take place in the presence of echoes.

2.2 Related works Upal Mahbub et al......


 He proposed method, in which the echo cancellation is performed prior to the noise

 Reduction operation. The major problem of getting a separate reference signal is


tactfully overcome by using the delayed version of the echo and noise suppressed
signal.
 Using such reference signal, the gradient based adaptive filter algorithm is derived to
obtain an optimum Wiener-Hopf solution and thereby a modified LMS update
equation is proposed.
 In the spectral subtraction based noise cancellation scheme noise floor is also updated
in a regular fashion.
 The performance of the proposed method is measured in terms of ERLE (dB) and
SDRI (dB).
 It is found that the proposed AENC can provide high values of these performance
measures indicating an excellent echo and noise cancellation performance.

COMMUNICATION STREAM, BHU, FINAL PROJECT 19


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 20


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Steven L. Gay and Jacob Benesty, “Acoustic Signal Processing for


Telecommunication”,
 In a teleconferencing system, the coupling between loudspeakers and microphones
usually results in many undesirable properties.
 To overcome the difficulties, it is well accepted that an Acoustic Echo Canceller
(AEC) is required.
 Operation of AEC is illustrated in Fig. 1. Essentially, the adaptive filter endeavors to
model the room characteristics possibly using an FIR filter. Attempts have been made
towards implementation of AEC using several techniques including FPGA.
 However, most existing works do not address the issue of optimal implementation.
Monson H. Hayes, “Statistical Digital Signal Processing And Modeling”,
 In a room with no propagation delay and no room impulse response (i.e. a studio with
Dampening walls and the microphone placed with no distance from the loudspeaker)the
solution would simply be to subtract the input (far-end talk), which is readily available,
from the output signal picked up by the microphone, which consists of both near-end talk and
far-end talk
 After the subtraction the output signal would consist of near-end talk only. This is
not possible, since the room both alters the sound and spreads it over time.
 Using IP-telephony this spread over time will vary according to the delay in the net
and therefore IP telephony introduces even more problems. Due to these problems the
input must be modified accordingly before we subtract it.
 The problem is that the parameter after which it should be modified is unknown. This is
where the adaptive filtering technology comes in.
 The adaptive filter adjusts according to inputs and outputs to form the parameters
mentioned after which the input must be modified if a subtraction is to be useful .

COMMUNICATION STREAM, BHU, FINAL PROJECT 21


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Rachana Nagal et al.


 LMS and Normalized LMS have been demonstrated in frequency domain. Their
corresponding results have also been shown after their implementation in both the time as
well as frequency domain.
 Later their results have been compared on the basis of the SNR and the output graphs
obtained.
 In the LMS algorithm, problem arises in deciding the value of the step size so,
Normalized LMS algorithm have been implemented. The results obtained in time
domain have less SNR value and more noise in the output signal as compared to the
one in the frequency domain.
 So, implementation of both LMS and NLMS in frequency domain raise the SNR
around 8-9 times.
Srinivasaprasath
 implementation of acoustic echo canceller process is using:
 MATLAB but the near end and far end signals are taken separately.
Patrashiya magdolina halder
 Has proposed an echo cancellation process using inverse filtering in MATLAB, which
analyze the received signal and remove echo from the acqorithorithmsuired signal.
2.3 Approaches of literature to solve the problem
 B y using different algorithms of adaptive filtering
 Inverse filtering of different algorithms
 B y using least mean square

COMMUNICATION STREAM, BHU, FINAL PROJECT 22


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

 B y using normalized least mean square


 B y applying mat lab software in the far end signals and near end signal with There existed
echo

2.4 Limitation of the approaches of literature:


 Limitation of lms due to fixed size
 Measurements the literature assumed to whether to reach the echo
 Using of filter types as the input vary due to the surrounding

2.5 This project approaches


Our project is based on by assuming the above limitation we can solve the problem by applying lms
with its normalized .and also choosing the adaptive filter from the other because of its several feature
.After all measures the echo by several adaptive filter measurement. This all about of our project
based on above approach and its recovery.

COMMUNICATION STREAM, BHU, FINAL PROJECT 23


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

CHAPTER THREE

SYSTEM OF DESIGN
3.1 Mean Square Error (MSE) Adaptive Filters.
Adaptive filter have several algorithms from those this project is based on least mean square
and normalized least mean square there working principle are listed below.

3.1.1 Least mean square of adaptive filter.


The Least Mean Square (LMS) algorithm was first developed by Windrow and Hoff in 1959
through their studies of pattern recognition. From there it has become one of the most widely
used algorithms in adaptive filtering. 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 [2-4]. 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. With each iteration of the LMS algorithm,
the filter tap weights of the adaptive filter are updated according to the following formula.
w(n+1)=w(n)+2𝜇(𝑛)e(𝑛)x(n)
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.
Implementation of the LMS Algorithm
Each 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 1.
∑𝑁−1 w(n)x(n − i) = 𝑊 𝑇 (𝑛)𝑥(𝑛)(2)………………………………….1
2. The value of the error estimation is calculated using equation 2.
e(n)=d(n)-y(n) …………………………………………………2
3. The tap weights of the FIR vector are updated in preparation for the next iteration, by equation 3
w(n+1)=w(n)+𝜇(𝑛)𝑒(𝑛)x(n)………………………………….……3

COMMUNICATION STREAM, BHU, FINAL PROJECT 24


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

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.

3.1.2 Normalized Least Mean Square (NLMS) Algorithm.


One of the primary disadvantages of the LMS algorithm is having a fixed step size parameter
for every iteration. This requires an understanding of the statistics of the input signal prior to
commencing the adaptive filtering operation. In practice this is rarely achievable. Even if we
assume the only signal to be input to the adaptive echo cancellation system is speech, there
are still many factors such as signal input power and amplitude which will affect its
performance. The normalized least mean square algorithm (NLMS) is an extension of the
LMS algorithm which by passes this issue by selecting a different step size value, μ(n), for
each iteration of the algorithm. This step size is proportional to the inverse of the total
expected energy of the instantaneous values of the coefficients of the input vector, x(n)
The recursion formula for the NLMS algorithm is stated as

1
(𝑛 + 1) = 𝑊(𝑛) + 𝑒(𝑛)𝑥(𝑛)
𝑋 𝑇 (𝑛)𝑥(𝑛)

As the NLMS is an extension of the standard LMS algorithm, the NLMS algorithms practical
implementation is very similar to that of the LMS algorithm. Each iteration of the NLMS
algorithm requires these steps in the following order [32].
Implementation of the NLMS algorithm:
1. The output of the adaptive filter is calculated.

𝑁−1

(𝑛) = ∑ (𝑛)𝑥(𝑛 − 𝑖) = 𝑤 𝑇 (𝑛)𝑥(𝑛) 𝑖=0

COMMUNICATION STREAM, BHU, FINAL PROJECT 25


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

2. An error signal is calculated as the difference between the desired signal and the filter
output.

e(n)=d(n)−y(n)

3. The step size value for the input vector is calculated.

1
𝜇(𝑛) =
𝑥(𝑛)𝑥(𝑛)𝑇

4. The filter tap weights are updated in preparation for the next iteration.

w(n+1) =w(n)+𝜇(𝑛)𝑒(𝑛)x(n)

COMMUNICATION STREAM, BHU, FINAL PROJECT 26


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Advantages and disadvantages:


Advantages
 NLMS algorithm has low computational complexity, with good convergence speed
which makes this algorithm good for echo cancellation.
 It has minimum steady state error.
 The noise amplification becomes smaller in size due to the presence of normalized
step size.
Disadvantages
Computational complexity:
 NLMS requires more number of computations for evaluation when compared to
LMS algorithm due to the presence of the reference signal power.
 NLMS algorithm requires 3N+1 multiplications which is N times more than the LMS
Algorithm. Where N is the length of the coefficient vector.

3.2 Normalized cross-correlation (NCC) algorithm.


The NCC algorithm computes the decision statistic depending on the relations of microphone signal
and error signal. It can be approached by considering the values of variance of near-end signal and
cross correlation between error signal and microphone signal.
The cross- correlation red between the error signal e (n) and microphone signal d (n) which is given
as 𝑟 𝑑 = 𝐸{𝑒(𝑛)𝑑(𝑛)}
Now one introduces the normalized decision statistic as the adaptive filter works well to
converge to estimate echo path ℎ that approximately equal to the true echo path h. Therefore,
it is easy to obtain the conclusion below:
Thus, finally we get the double-talk decisions as,

𝐷𝑒𝑐𝑖𝑠𝑖𝑜𝑛={{ 𝜉𝑁𝐶𝐶 (𝑡) < 𝑇 𝑑𝑜𝑢𝑏𝑙𝑒𝑡𝑎𝑙𝑘


𝜉𝑁𝐶𝐶 (𝑡) > 𝑇 𝑛𝑜 𝑑𝑜𝑢𝑏𝑙𝑒𝑡𝑎𝑙𝑘

Where, T is a threshold with the chosen value approximately 1.

𝑇ℎ𝑒 𝑣𝑎𝑙𝑢𝑒𝑠 𝑜𝑓 𝑟 𝑑𝑎𝑛𝑑 𝜎 are not available in practice, so we define the new estimated
decision statistic as,

COMMUNICATION STREAM, BHU, FINAL PROJECT 27


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

𝑅𝑒𝑑
𝜉𝑁𝐶𝐶 = 1 −
𝑑

Where,
𝑟 𝑑 𝑖𝑠 𝑡ℎ𝑒 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑒 𝑜𝑓 𝑟 𝑑

𝜎𝑑 𝑖𝑠 𝑡ℎ𝑒 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑒 𝑜𝑓 𝜎

We can found these estimates by using the exponential recursive weighting algorithm

(𝑛) = ⅄𝑟 𝑑(𝑛 − 1) + (1 − ⅄)𝑒(𝑛)𝑑 𝑇 (𝑛)

(𝑛) = ⅄𝑑 (𝑛 − 1) + (1 − ⅄)𝑑(𝑛)𝑑 𝑇 (𝑛)

Where,
 e(n) is the captured cancellation error sample at time n
 d(n) is the captured microphone signal sample at time n
 λ is the exponential weighting factor (λ <1 and λ ≈1)
3.3 Various parameters to calculate filter
performance
 Convergence rate (CR)
Convergence rate is a performance specification of acoustic echo cancellers. The
convergence rate should be fast to estimate the desired filter. The convergence rate is defined
as the number of iterations required for the algorithm to converge to its steady state mean
square error.
 Estimated error
Mean square estimation is the average of the squares of the error.
The mean square estimation is given as

COMMUNICATION STREAM, BHU, FINAL PROJECT 28


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

𝜉 = ∑|(𝑖 )| 2

 Echo return loss


This is expressed as the difference between the echo signal level and speech signal level
generally expressed in db.

 Echo return loss enhancement


It is the ratio of the instantaneous power of the echo signal to the instantaneous power of the
residual error signal.

COMMUNICATION STREAM, BHU, FINAL PROJECT 29


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

 Complexity
The computational complexity is the measure of the number of arithmetic calculations like
multiplications, additions and subtractions for different adaptive algorithms.

 Signal to noise ratio (SNR)


The Signal-to-Noise Ratio is used to measure the amount of desired signal level with the
noise level. The ideal method for calculating the SNR is the amount of speech energy over
the noise energy after the enhancement method. The input SNR and output SNR are
calculated as below:

(𝑛) 2
10𝑙𝑜𝑔10 | ( )
| ⁄
𝑆𝑁𝑅𝑖𝑛 = 𝑛

(𝑛)2
10𝑙𝑜𝑔10 | ( )
| ⁄
𝑆𝑁𝑅𝑜𝑢𝑡 = 𝑛
Where 𝑠𝑜𝑢𝑡 and 𝑛𝑜𝑢𝑡 are the filtered outputs of the Wiener beam former i.e. pure speech
signal s(n) and pure noise signal d(n) separately and also „n‟ is the length of the speech and
noise signals
3.4 Measurement of the echo cancellation:
3.4.1 Echo return loss enhancement
(ERLE):
Echo return loss enhancement is the ratio of input desired signal power and the power of a
residual error signal immediately after echo cancellation. It is measured in dB. ERLE
depends on the size of the adaptive filter and the algorithm design. The higher the value of
ERLE represents the better echo cancellation. It also measures the amount of loss introduced
by the adaptive filter. The ERLE measurement helps to calculate echo loss done by the
adaptive algorithm. In our simulations we noticed that ERLE increases with the increase in
the order of the filter.

𝑝𝑑
𝐸𝑅𝐿𝐸 = 10𝑙𝑜𝑔 ( )
𝑝
𝑒

COMMUNICATION STREAM, BHU, FINAL PROJECT 30


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Where pd is the desired signal power and pe is the power of a residual error signal after echo
cancellation.
3.4.2 Misalignment:
In our thesis we also evaluated the performance of the echo canceller in terms of the
misalignment as defined by

COMMUNICATION STREAM, BHU, FINAL PROJECT 31


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

‖𝒉 − 𝒉‖
∈=
‖𝒉‖

Where || . || denotes the norm of a vector and h = [h(0),…..h(L-1)]. It measures the mismatch
between the true and the estimated impulse response of the receiving room.
Receiving room is where the acoustic coupling between the loud speaker and the microphone
happens and thus echo generates.

3.5 The overall system design of this project are viewed by this diagram

Figure 5 Acoustic echo cancellations


We describe a block diagram of an AEC system as in Figure 5. This system consists of the
Following three components:
1. Adaptive filter.
2. Doubletalk detector.
3. Nonlinear processor.
1. Adaptive Filter

COMMUNICATION STREAM, BHU, FINAL PROJECT 32


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

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 convergence rate of the adaptive filter
which measures that how fast the filter converges for best estimation of the room acoustic
path.
2. Double-talk detector (DTD)
It is rather difficult to predict when the adaptation of the filter should stop or slow down and
it is also important to know that the near-end speech signal exists or not in the presence of
far-end signal. In the situation when both ends talk (near-end and far-end), this is known as
double-talk. 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. So to overcome this problem, one uses Double-talk Detector.
3. Nonlinear Processor (NLP)
The nonlinear processor (NLP) is required for completely or partly cancels the residual signal
in the absence of near-end speech signal. By removing the residual signal will cancel any
occurring acoustic echo. The NLP will gradually cancel the signal and insert a form of
comfort noise to give the impression to far-end. The NLP as well as the adaptive filter need
an accurate estimation from the DTD to operate efficiently

3.5.1. Adaptive filter algorithms.


Adaptive filtering is the process which is required for echo canceling in different application.
Adaptive filter is such type of filter whose characteristics can be changed for achieving
optimal desired output. An adaptive filter can change its parameters to minimize the error
signal by using adaptive algorithms. The error is the difference between the desired signal
and the output signal of the filter [31].

COMMUNICATION STREAM, BHU, FINAL PROJECT 33


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

The figure below shows the basic model of adaptive filter used in AEC. Most extensively
used algorithms in this research employment are LMS and NLMS.

Figure 6 double talk detectors with AEC

COMMUNICATION STREAM, BHU, FINAL PROJECT 34


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

The notations are used in the figure above and during this thesis in turn 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)
 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒𝑑 𝑒𝑐ℎ𝑜 𝑝𝑎𝑡ℎ: ℎ
 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒 𝑒𝑐ℎ𝑜 𝑠𝑖𝑔𝑛𝑎𝑙: (𝑛)
 Error signal: e(n) = v(n) + y(n) −(n)
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. 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)

COMMUNICATION STREAM, BHU, FINAL PROJECT 35


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

The signal x(n) and y(n) are correlated. We get the error signal as,
error(n) = d(n) −(n)= v(n) + y(n) −(n)
The adaptive filter works to minimize the echo (y(n) −(n)) to be zero to obtain only near-end
signal v(n) in the perfect case. In Acoustic Echo Cancellation (AEC), the adaptive filter plays
the main role to adapt the filter tap weight in order to overcome the echo problem. There
are different types of algorithms are used for this purpose such as Least Mean Square (LMS),
Normalized Least Mean Square (NLMS), Recursive Least Square (RLS) and Affine Projection
Algorithm (APA) and etc. The LMS is widely used algorithm for adaptive application
such as channel equalization and echo cancellation. This algorithm is the most simple if we
compare it with NLMS and RLS algorithm. The normalized least mean square(NLMS) is
also famous algorithm due to its computational simplicity

3.6 Matlab.
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++, for Tran 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 [33]:
 Easy to record audio signals of the far-end and near-end speeches. These data
are indispensable of the simulation.
 Matrix calculation is very important since data was processed as the matrix formats.
 Easy to monitor the results by plotting desired graphs. Especially, we need to hear
the resultant sounds by MATLAB, it is simple to achieve the structure of the
commands is suitable to compute with Signal Processing.
 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

COMMUNICATION STREAM, BHU, FINAL PROJECT 36


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

signals could be literally being 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.

COMMUNICATION STREAM, BHU, FINAL PROJECT 37


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

3.6.1 Requirements during the simulation.


 This simulation tries to perform the tasks of the acoustic echo canceller and doubletalk
detector at the near-end conference room. We assume that both far-end and near end rooms
are the same characteristics (size, acoustic features). In the case of the perfectively
performance of the far-end echo canceller, we only try to do the task of near-end room.

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

COMMUNICATION STREAM, BHU, FINAL PROJECT 38


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Flowchart of the AEC algorithm

COMMUNICATION STREAM, BHU, FINAL PROJECT 39


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

3.6.2 Explanation of MATLAB Code.


Adaptive Filter Algorithms
In these code segments, the purpose we need to obtain is processing and performing the LMS
and NLMS algorithms. The comparison below between the theory and the simulation parts
(MATLAB code) may bring the better understanding about not only the algorithm but the
programming work. The summary of the algorithms (LMS, NLMS) and the code segments are
demonstrated in the tables below.
Least Mean Square (LMS) algorithm
Table 1 Summary of LMS algorithm
LMS algorithm

0 < μ <1
Length of adaptive filter: L
Initial Conditions: Input vector:𝑥 , = [0,0, . . . ,0]
Weight vector:𝑊 , =[0,0, . . . ,0]

For each instant of time, n = 1, 2,…, compute:


Output signal: y(n) = w (n)x(n)
Estimation Error: e(n) = d(n) − y(n)
Tap-Weight Adaptation: w(n +1) = w(n) + 2μx(n)e(n)

Table 2 Matlab code

MATLAB code
Initial Conditions: mu=0.014;
L=length(h); %the same length of RIR
w=zeros(L,1); %Initial weight vector
xin=zeros(L,1); %Initial input signal
For each instant of time, k = 1, 2,…, compute:

Output signal: y(i)=w'*xin;

Estimation Error: error= d(i)-y(i);

COMMUNICATION STREAM, BHU, FINAL PROJECT 40


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Figure: Echo Return Loss Enhancement Comparison

COMMUNICATION STREAM, BHU, FINAL PROJECT 41


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 42


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

CHAPTER FOUR.

SIMULATION RESULT AND DESCUSSION.


4.1 simulation result.
The previous chapters provide a detailed sketch of an Acoustic Echo canceller, (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. The idea that drove the
simulation was to show that convincible results could be achieved in the software
environment. The resulting plots below demonstrate the performance of acoustics echo
canceller with different algorithms. First, we have shown 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). The following graph shows the result of
LMS code that includes:
 room impulse
responses.
 Desired signal.
 Output signal.
 Error signal.

COMMUNICATION STREAM, BHU, FINAL PROJECT 43


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Figure:Block diagram of of echo cancellation


The Room Impulse Response

You first need to model the acoustics 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 following code generates a random impulse response that is not unlike what a
conference room would exhibit. Assume a system sample rate of 16000 Hz.

Figure: room impulse responses.

COMMUNICATION STREAM, BHU, FINAL PROJECT 44


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Figure: Far-end speech signal

Figure: Echo Return Loss Enhancement (ERLE

COMMUNICATION STREAM, BHU, FINAL PROJECT 45


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Figure; least mean square.

figure : magnitude response

COMMUNICATION STREAM, BHU, FINAL PROJECT 46


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Figure:Magnitude response and phase response.

Figure:microphone signal.

COMMUNICATION STREAM, BHU, FINAL PROJECT 47


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Figure:near speech signal.

Figure:nlms comparsion….

COMMUNICATION STREAM, BHU, FINAL PROJECT 48


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Figure:nlms error curve.

COMMUNICATION STREAM, BHU, FINAL PROJECT 49


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

4.2 Discussion
From the experiment works and the resultant graphs, we can evaluate the echo cancellation
algorithm in order to have a deeper understanding and the conclusion of the thesis. Results
above of two echo cancellation algorithms are LMS and NLMS, we have some evaluations as
follow. And rather we design Simulink to be shown how echo cancel by MAT LAB. That is
simple use as an input sine wave and as a noise white Gaussian noise.
1. Comparison between LMS and NLMS
Both of them could converge approximately the estimated impulse response h of the true
room impulse response h, thus the estimated echo y (n) signal look like similar to the true
echo signal y(n) .
2. Convergence test
Convergence is the most important factor to observe when running the echo cancellation
algorithm. If the filter coefficients used in the adaptive filter algorithm did not converge, the
code could get problem. In this simulation, we used the standard signals as white noise (as the
input signals), the low pass filter (model the impulse response) to check the operation of the
algorithm. If the problem still exists, then we verify the convergence factor. By varying this
factor, we can control and adjust the convergence of the adaptive filter algorithm.
3. Echo Return Loss Enhancement (ERLE)
This parameter is used in order to evaluate the quality of the echo cancellation algorithm. If the
echo cancellation algorithm perform well, then the values of ERLE should be in the range of
(45dB, -40dB) (for Signal to Noise ratio SNR of 45dB).

COMMUNICATION STREAM, BHU, FINAL PROJECT 50


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

CHAPTER FIVE

CONCLUSION AND RECOMMENDATION


5.1 Conclusion.
In this thesis we studied how to cancel acoustic echo by AEC. One of the major problems in a
telecommunication application over a telephone system is echo. The Echo cancellation
algorithm presented in this thesis successfully attempted to find a software solution for the
problem of echoes in the telecommunications environment. AEC is the conventional method for
solving the acoustic echo problem. Under ideal conditions AEC can achieve perfect echo
cancellation, because it estimates both the phase and amplitude of the echo signal. The
proposed algorithm was completely a software approach without utilizing any Digital Signal
Processing (DSP) hardware components.
Speech has most of its energy concentrated to lower frequencies. Therefore it is most
important to achieve an optimal echo cancellation at these frequencies. At higher frequencies
the ear is not sensitive to phase information. The algorithm was capable of running in any
PC with MATLAB software installed. In addition, the results obtained were convincing.
The audio of the output speech signals were highly satisfactory and validated the goals of this
research.

5.2 Recommendation
Future work can be extended by implementing the experimental setup for the double talk
situations. Double talk is an important characteristic of a good acoustic echo canceller. It is a
condition where both the, far-end user and near-end user speak simultaneously. Comparing
the performance of double talk detector with the other adaptive algorithms is also equally
important. The work in thesis is regarded as work in offline mode so implementing the system
for real-time can be done in future work. There is a lot, which can be done in future for
improvement on the methods for acoustic echo cancellation. The field of digital signal
processing and in particular

COMMUNICATION STREAM, BHU, FINAL PROJECT 51


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

REFERENCE
[1] Iqbal, M.A., Stokes, J.W. and Grant, S.L., 2007, July. Normalized double-talk detection based on
microphone and AEC error cross-correlation. In 2007 IEEE International Conference on Multimedia and
Expo (pp. 360-363). IEEE.
[2] Benesty, J., Amand, F., Gilloire, A. and Grenier, Y., 1995, May. Adaptive filtering algorithms for
stereophonic acoustic echo cancellation. In 1995 international conference on acoustics, speech, and signal
processing (Vol. 5, pp. 3099-3102). IEEE.
[3] Haykin, S. and Widrow, B. eds., 2003. Least-mean-square adaptive filters (Vol. 31). John Wiley &
Sons.
[4] Sudhir, V.V., Murthy, A.S.N. and Rani, D.E., 2014. Acoustic echo cancellation using
adaptive algorithms. International Journal of Advances in Computer Science and
Technology, 3(4).
[5] Schroeter, J. and Sondhi, M.M., 1992. Speech coding based on physiological models of
speech production. Advances in speech signal processing, pp.231-267..
[6] Hayes, M.H., 2009. Statistical digital signal processing and modeling. John Wiley & Sons..
[7] Jacob Benesty, Tomas Gansler, Denis R. Morgan, M. Mohan Sondhi and Steven L. Gay,
“Advances in Network and acoustic echo cancellation”, ISBN: 3- 540-41721-4, Springer,
2001.
[8] Habets, E.A., 2006. Room impulse response generator. Technische Universiteit Eindhoven,
Tech. Rep, 2(2.4), p.1.
[9] Zhang, H. and Wang, D., 2018. Deep learning for acoustic echo cancellation in
noisy and double-talk scenarios. Training, 161(2), p.322.
[10] Benesty, J., Gänsler, T., Morgan, D.R., Sondhi, M.M. and Gay, S.L., 2001. Advances in
network and acoustic echo cancellation.
[11] Gilloire, A., 1987, April. Experiments with sub-band acoustic echo cancellers for teleconferencing.
In ICASSP'87. IEEE International Conference on Acoustics, Speech, and Signal Processing (Vol. 12, pp.
2141-2144). IEEE.
Gilloire, A. and Vetterli, M., 1992. Adaptive filtering in sub-bands with critical sampling: analysis, experiments,
and application to acoustic echo cancellation. IEEE transactions on signal processing, 40(ARTICLE), pp.1862-
1875.
[12] Krishna, E.H., Raghuram, M., Madhav, K.V. and Reddy, K.A., 2010, May. Acoustic echo cancellation
using a computationally efficient transform domain LMS adaptive filter. In 10th International Conference on
Information Science, Signal Processing and their Applications (ISSPA 2010) (pp. 409-412). IEEE.

COMMUNICATION STREAM, BHU, FINAL PROJECT 52


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

[13] Gänsler, T. and Benesty, J., 2000. Stereophonic acoustic echo cancellation and two‐channel
adaptive filtering: an overview. International Journal of adaptive control and signal
processing, 14(6), pp.565-586.
[14] Buchner, H., Spors, S. and Kellermann, W., 2004, May. Wave-domain adaptive filtering:
Acoustic echo cancellation for full-duplex systems based on wave-field synthesis. In 2004 IEEE
International Conference on Acoustics, Speech, and Signal Processing (Vol. 4, pp. iv-iv). IEEE.
[15] Pauline, S.H., Samiappan, D., Kumar, R., Anand, A. and Kar, A., 2020. Variable tap-length
non-parametric variable step-size NLMS adaptive filtering algorithm for acoustic echo
cancellation. Applied Acoustics, 159, p.107074.
[16] Long, G., Shwed, D. and Falconer, D., 1987. Study of a pole-zero adaptive echo canceller. IEEE
transactions on circuits and systems, 34(7), pp.765-769.
[17] Benesty, J. and Morgan, D.R., 2000, June. Frequency-domain adaptive filtering revisited,
generalization to the multi-channel case, and application to acoustic echo cancellation. In 2000 IEEE
International Conference on Acoustics, Speech, and Signal Processing. Proceedings (Cat. No.
00CH37100) (Vol. 2, pp. II789-II792). IEEE.
[18] Tyagi, R. and Agrawal, D., 2012. Analysis the results of Acoustic Echo Cancellation for speech
processing using LMS Adaptive Filtering Algorithm. International Journal of Computer
Applications, 56(15), pp.7-11.
[19] Ni, J. and Li, F., 2010. Adaptive combination of subband adaptive filters for acoustic echo
cancellation. IEEE Transactions on Consumer Electronics, 56(3), pp.1549-1555.
[20] Adapa, N. and Bollu, S., 2013. Performance analysis of different adapative algorithms based on
acoustic echo cancellation.
[21] Benesty, J., Morgan, D.R. and Sondhi, M.M., 1998. A better understanding and an improved
solution to the specific problems of stereophonic acoustic echo cancellation. IEEE transactions on
speech and audio processing, 6(2), pp.156-165.
[22] Dhull, S., Arya, S. and Sahu, O.P., 2011. Performance evaluation of adaptive filters structures
for acoustic echo cancellation. International Journal of Engineering (IJE), 5(2), pp.208-215.
[23] Deb, A., Kar, A. and Chandra, M., 2014, April. A technical review on adaptive algorithms for
acoustic echo cancellation. In 2014 International Conference on Communication and Signal
Processing (pp. 041-045). IEEE.

COMMUNICATION STREAM, BHU, FINAL PROJECT 53


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

[24] Tahernezhadi, M., Liu, J. and Kong, X., 1994, August. An improved subband acoustic echo
canceller for teleconferencing applications. In Proceedings of 1994 37th Midwest Symposium on
Circuits and Systems (Vol. 2, pp. 1424-1427). IEEE.
[25] Romoli, L., Squartini, S. and Piazza, F., 2010, August. A variable step-size frequency-domain
adaptive filtering algorithm for stereophonic acoustic echo cancellation. In 2010 18th European
Signal Processing Conference (pp. 26-30). IEEE.
[26] Kotte, S., 2011. Performance Analysis of Adaptive Algorithms based on different parameters
Implemented for Acoustic Echo Cancellation in Speech Signals.
[27] Patil, A.P. and Patil, M.R., 2018. Performance Analysis of Adaptive Filtering Algorithms for
Acoustic Echo Cancellation. International Journal of Engineering Research and Technology, 7(8),
pp.169-173.
[28] Kuo, S.M. and Pan, Z., 1993. Adaptive acoustic echo cancellation microphone. The Journal of
the Acoustical Society of America, 93(3), pp.1629-1636.
[29] Uncini, A., Nalin, A. and Parisi, R., 2002, September. Acoustic echo cancellation in the
presence of distorting loudspeakers. In 2002 11th European Signal Processing Conference (pp. 1-4).
IEEE.
[30] Vaseghi, S.V., 1996. Echo Cancellation. In Advanced Signal Processing and Digital Noise
Reduction (pp. 328-342). Vieweg+ Teubner Verlag.
[31] Rupp, M., 1998. A family of adaptive filter algorithms with decorrelating properties. IEEE Transactions on
Signal Processing, 46(3), pp.771-775.
[32] Benesty, J. and Gay, S.L., 2002, May. An improved PNLMS algorithm. In 2002 IEEE international
conference on acoustics, speech, and signal processing (Vol. 2, pp. II-1881). IEEE.
[33] Higham, D.J. and Higham, N.J., 2016. MATLAB guide. Society for Industrial and Applied Mathematics.

COMMUNICATION STREAM, BHU, FINAL PROJECT 54


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

Appendix

LMS MATLAB algorithm

clear all

%---------------------------------------------------------------------
%Load Data
framesize=8000;

% [Fname1,Pname1] = uigetfile('*.wav','Select nearspeech FIle');


[x, Fs, nbits] = wavread('01 Far speech'); %Far-end signal
[v, Fs, nbits] = wavread('01 Near Speech'); %Near-end signal
[h, Fs, nbits] = wavread('RIR'); %Room impulse response
%Declare the needed variables
L=length(h); %Length of adaptive filter (same length of RIR)
v=v(:);
figure(14)
sound(v);
plot(v);
title('near11')
L=L(:);
N=length(x); %Number of iterations
N=N(:);
T=0.92; %Threshold for Double talk detection

lambda_DTD=0.92; %Constant for calculating decision statistic of DTD


DTDbegin=21000; %The time to activate DTD %Intial value 0
w=zeros(L,1); %Initial weight vector of AF Lx1
xin=zeros(L,1); %Initial input signal of AF Lx1

varMIC=zeros(N,1); %Initial variance of microphone signal of AF Nx1

COMMUNICATION STREAM, BHU, FINAL PROJECT 55


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

r_em=zeros(N,1); %Initial Cross correlation between error and microphone signals


%Ambient noise
WhiteNoise = wgn(N,1,-65); %With make SNR of 45dB
plot(WhiteNoise);
%----------------Microphone signal
EchoSignal=filter(h,1,x); %Echo signal after filter H
sound(EchoSignal);
% figur(1);
plot(EchoSignal);
title('Echo Signal');
d=EchoSignal+WhiteNoise+v; %Desired signal (Microphone Signal)
%Make column vectors
x=x(:); %Far end signal Nx1
figure(11)
title('far end signal');
sound(x);
plot(x)

d=d(:); %Desired signal Nx1


sound(d);
plot(d);

%The values for calculate Step-Size of Adaptive Filter


mu=0.014;
%Calculate the average SNR (desired signal/noise)
powerMic = sum(abs(d).^2)/N; %Power of Microphone signal
powerN = sum(abs(WhiteNoise).^2)/N; %Power of White Noise
SNR=10*log10(powerMic/powerN); %Calculate the SNR
% sound(powerMic);
% plot(powerMic);
%----------------------------------------------------------------------

COMMUNICATION STREAM, BHU, FINAL PROJECT 56


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

%-------------LMS algorithm for Adaptive Filter-----------------------


for i=1:50000
for j=L:-1:2
xin(j)=xin(j-1);
end
xin(1)=x(i); %Insert new sample at beginning of input
y(i)=w'*xin; %Output signal after adaptive filter
error=d(i)-y(i); %ERROR
e(i)=error; %Store estimation error

wtemp = w + 2*mu*error*xin;%Update filter

% -----------NORMALIZED CROSS-CORELATION ALGORITHM DTD--------------


threshold(i)=T; %Threshold for plotting DTD
if (i<=DTDbegin) %The beginning time of the DTD
w=wtemp; %Update filter coefficients63
end
if (i>DTDbegin)
%Cross correlation between error and microphone signal
r_em(i)=lambda_DTD*(r_em(i-1))+(1-lambda_DTD)*e(i)*d(i)';
%Variance of microphone signal
varMIC(i)=sqrt(lambda_DTD*(varMIC(i-1)^2)+(1-lambda_DTD)*d(i)*d(i)');
decision_statistic(i)=1-(r_em(i)/varMIC(i)^2); %Decision statistic
%Making the double-talk decision if
(decision_statistic(i)>threshold(i))
w=wtemp; %Update filter coefficients
end
end

%-------------ERLE-------------------------------------
powerD(i) = abs(d(i))^2; %Power of Microphone signal
powerE(i)=abs(e(i))^2; %power of Error signal
%--------------MSE-------------------------------------
mse_iteration(i)=error^2; %Square Error

COMMUNICATION STREAM, BHU, FINAL PROJECT 57


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

end

for i=1:10000-L

%MSE - Mean Square Error


mse(i)=mean(mse_iteration(i:i+L));
%Echo Return Loss Enhancement
ERLE(i)=10*log10(mean(powerD(i:i+L))/mean(powerE(i:i+L)));
%Plotting Double-talk Detection
if (i>DTDbegin)
ds(i)=mean(decision_statistic(i:i+L));
else
ds(i)=1;e
nd
end
%----------------------------------------------------------------------
%PlOTTING THE NECESSARY SIGNALS
%----------------------------------------------------------------------
figure(1)
%-------echo signal-------------------------
% subplot(4,1,1)
plot(EchoSignal)
xlabel('time (samples)');
ylabel('echo(n)');
title('ECHO SIGNAL: echo(n)')
grid on
axis([0 N -1 1]);
sound(e)
%-------Desired signal-----------------------
% subplot(4,1,2)
figure (2)
plot(d)

COMMUNICATION STREAM, BHU, FINAL PROJECT 58


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

xlabel('time (samples)');
ylabel('d(n)');
title('DESIRED SIGNAL: d(n)')
grid on
axis([0 N -1 1]);
sound(d)
%-------Output signal x(n)-------------------
% subplot(4,1,3)

COMMUNICATION STREAM, BHU, FINAL PROJECT 59


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

figure(3)
plot(y)
xlabel('time (samples)');
ylabel('y(n)');
title('OUTPUT SIGNAL (AFTER W): y(n)')
grid on
axis([0 N -1 1]);
sound(x)
%-------Error signal x(n)--------------------
% subplot(4,1,4)
figure(4)

plot(e,'red') xlabel('time (samples)');


ylabel('E(n)');
title('ERROR SIGNAL: e(n)')
axis([0 N -1 1]);
grid on
sound(e)
%-------Estimation system w-----------------
figure(5)
% subplot(2,1,1)
plot(w,'red')
xlabel('Tap');
ylabel('Magnitude (W)');
title('ESTIMATE SYSTEM: W(N)')
grid on
sound(w)

%-------True system h----------------------


% subplot(2,1,2)
figure(6)
plot(h)

COMMUNICATION STREAM, BHU, FINAL PROJECT 60


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

xlabel('Sample number (n)');


ylabel('Magnitude (H)');
title('TRUE IMPULSE RESPONSE: h(n)')

COMMUNICATION STREAM, BHU, FINAL PROJECT 61


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

grid on
sound(h)
%-------Estimator for DTD------------------
figure(7)
%-------Decision Statistic-----------------
% subplot(311)
plot(ds,'green')
hold all
plot(threshold,'red')
hold off
xlabel('Sample number (n)');
ylabel('Decision Statistic');
title('DOUBLE TALK DETECTION')
grid on
% sound(n)
%-------Mean square error-------------------

% subplot(312)
figure(8)
plot(mse)
xlabel('Sample number (n)');
ylabel('Mean(Error^2)');
title('MEAN SQUARE ERROR')
grid on
%-------Echo return loss enhancement---------
% subplot(313)
figure(10)
plot(ERLE)
xlabel('Sample number (n)');
ylabel('Desired signal/Error signal (dB)');
title('ECHO RETURN LOSS ENHANCEMENT')
grid on
sound(ERLE)

COMMUNICATION STREAM, BHU, FINAL PROJECT 62


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

LMS MATLAB algorithm


clear all

%---------------------------------------------------------------------
%Load Data
[x, Fs, nbits] = wavread('output11'); %Far-end signal
[v, Fs, nbits] = wavread('output11'); %Near-end signal
[h, Fs, nbits] = wavread('RIR'); %Room impulse response
%Declare the needed variables
L=length(h); %Length of adaptive filter (same length of RIR)
N=length(x); %Number of iterations
T=0.92; %Threshold for Double talk detection

lambda_DTD=0.95; %Constant for calculating decision statistic of DTD


DTDbegin=210; %The time to activate DTD%Intial value 0
w=zeros(L,1); %Initial weight vector of AF Lx1
xin=zeros(L,1); %Initial input signal of AF Lx1

varMIC=zeros(N,1); %Initial variance of microphone signal of AF Nx1


r_em=zeros(N,1); %Initial Cross correlation between error and microphone signals
%Ambient noise
WhiteNoise = wgn(N,1,-65); %With make SNR of 45dB
%Microphone signal
EchoSignal=filter(h,1,x); %Echo signal after filter H
d=EchoSignal+WhiteNoise+v; %Desired signal (Microphone Signal)
%Make column vectors
x=x(:); %Far end signal Nx1
sound(x)
d=d(:); %Desired signal Nx1
sound(d)
%The values for calculate Step-Size of Adaptive Filter

COMMUNICATION STREAM, BHU, FINAL PROJECT 63


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

alfa=0.42; %Alfa
c=0.01; %A small constant

%Calculate the average SNR (desired signal/noise)

powerMic = sum(abs(d).^2)/N; %Power of Microphone signal


powerN = sum(abs(WhiteNoise).^2)/N; %Power of White Noise
SNR=10*log10(powerMic/powerN); %Calculate the SNR
%----------------------------------------------------------------------

%-------------NLMS algorithm for Adaptive Filter-----------------------


for i=1:20000
for j=L:-1:2
xin(j)=xin(j-1);
end
xin(1)=x(i); %Insert new sample at beginning of input
y(i)=w'*xin; %Output signal after adaptive filter
error=d(i)-y(i); %ERROR
e(i)=error; %Store estimation error
mu=alfa/(c+xin'*xin); %Calculate Step-size
wtemp = w + 2*mu*error*xin;%Update filter
% -----------NORMALIZED CROSS-CORELATION ALGORITHM DTD--------------
threshold(i)=T; %Threshold for ploting DTD66
if (i<=DTDbegin) %The beginning time of the DTD
w=wtemp; %Update filter coefficients
end

if (i>DTDbegin)

%Cross correlation between error and microphone signal


r_em(i)=lambda_DTD*(r_em(i-1))+(1-lambda_DTD)*e(i)*d(i)';
%Variance of microphone signal
varMIC(i)=sqrt(lambda_DTD*(varMIC(i-1)^2)+(1-lambda_DTD)*d(i)*d(i)');
decision_statistic(i)=1-(r_em(i)/varMIC(i)^2); %Decision statistic

COMMUNICATION STREAM, BHU, FINAL PROJECT 64


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

%Making the double-talk decision


if (decision_statistic(i)>threshold(i))
w=wtemp; %Update filter coefficients
end
end

%-------------ERLE--------------------

powerD(i) = abs(d(i))^2; %Power of Microphone signal

powerE(i)=abs(e(i))^2; %power of Error signal

%--------------MSE--------------------
mse_iteration(i)=error^2; %Square Error
end
for i=1:8000-L

%MSE - Mean Square Error


mse(i)=mean(mse_iteration(i:i+L));
%Echo Return Loss Enhancement
ERLE(i)=10*log10(mean(powerD(i:i+L))/mean(powerE(i:i+L)));
%Plotting Double-talk Detection
if (i>DTDbegin)
ds(i)=mean(decision_statistic(i:i+L));
else
ds(i)=1;
end
end

%----------------------------------------------------------------------
%PlOTTING THE NECESSARY SIGNALS
%----------------------------------------------------------------------
figure(1)

COMMUNICATION STREAM, BHU, FINAL PROJECT 65


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

%-------echo signal------------------------
subplot(4,1,1)
plot(EchoSignal)
xlabel('time (samples)');
ylabel('echo(n)');
title('ECHO SIGNAL: echo(n)')
grid on
axis([0 N -1 1]);

%-------Desired signal--------------------
subplot(4,1,2)

plot(d)

xlabel('time (samples)');
ylabel('d(n)');
title('DESIRED SIGNAL: d(n)')
grid on
axis([0 N -1 1]);

%-------Output signal x(n)----------------


subplot(4,1,3)

plot(y)

xlabel('time (samples)');
ylabel('y(n)');67
title('OUTPUT SIGNAL (AFTER W): y(n)')
grid on
axis([0 N -1 1]);

%-------Error signal x(n)-----------------


subplot(4,1,4)
plot(e,'red')

COMMUNICATION STREAM, BHU, FINAL PROJECT 66


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

xlabel('time (samples)');
ylabel('E(n)');
title('ERROR SIGNAL: e(n)')
axis([0 N -1 1]);
grid on

%-------Estimation system w---------------


figure(2)
subplot(2,1,1)
plot(w,'red')
xlabel('Tap');
ylabel('Magnitude (W)');
title('ESTIMATE SYSTEM: W(N)')
grid on
%-------True system h---------------------
subplot(2,1,2)
plot(h)
xlabel('Sample number (n)');
ylabel('Magnitude (H)');
title('TRUE IMPULSE RESPONSE: h(n)')
grid on
%-------Estimator for DTD-----------------
figure(3)
%-------Decision Statistic----------------
subplot(3,1,1)
plot(ds,'green')
hold all
plot(threshold,'red') hold off
xlabel('Sample number (n)');
ylabel('Decision Statistic');
title('DOUBLE TALK DETECTION')
grid on

COMMUNICATION STREAM, BHU, FINAL PROJECT 67


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

%-------Mean square error-----------------


subplot(3,1,2)
plot(mse)

xlabel('Sample number (n)');


ylabel('Mean(Error^2)');
title('MEAN SQUARE ERROR')
grid on
%-------Echo return loss enhancement------
subplot(3,1,3)
plot(ERLE)

xlabel('Sample number (n)');


ylabel('Desired signal/Error signal (dB)');
title('ECHO RETURN LOSS ENHANCEMENT')
grid on

COMMUNICATION STREAM, BHU, FINAL PROJECT 68


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 69


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 70


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 71


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 72


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 73


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 74


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 75


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 76


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 77


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 78


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 79


ANALYSIS OF ACOUSTIC ECHO CANCELLATION IN 2022
TELECONFERENCE USING ADAPTIVE FILTER

COMMUNICATION STREAM, BHU, FINAL PROJECT 80

You might also like