The Study and Simulation of Adaptive Algorithms in Echo Cancellation of an Acoustic Signal

Echo signal is the delayed form of an electrical or acoustic signal and it occurs when it returns to its source, in other words when acoustic signal finds its way from sending route through receiving one. One of the important parameters in discussing echo is delay time. In practical applications, if round trip time exceeds 30 milliseconds and echo power also exceeds 30 decibels, echo cancellation should be done. Today given the developments in utilizing communication system and transmitting acoustic information, echo cancellation becomes very important. There are different algorithms for cancelling echo of acoustic signals and each of them has both advantages and disadvantages. Adaptive filters are appropriate for echo cancellation. In such filters, minimization of the computational complexity and quick convergence of adapting is done within frequency domain owing to long impact response. In this study, different adaptive algorithms such as LMS, NLMS, VSLMS, VSNLMS and RLS have been suggested which can be used for echo cancellation and finally, a combination of them as an optimal algorithm was simulated for echo cancellation. In this paper, the stages of determining filter coefficients and the level of computational work in terms of convergence behavior, simulation results and other methods’ results were compared and it was found that using NLMS and MAX-E algorithms would offer best results in different situations. Innovative aspects of this paper include using adaptive algorithms in their real time and we can minimize the computational work of these algorithms and maximize the convergence speed by selecting accurate filter coefficients and the window used in computations. Also, we can use it in current applications and even in sound conversations on some communication networks like internet. Other aspects include using adaptive algorithms in implementing echo cancellation that have better function and convergence compared to blind methods of echo cancellation and they contribute to quality improvement of sent signals in conversations.


Introduction
Echo signal is the delayed form of an electrical or acoustic signal and it occurs when it returns to its source, in other words when acoustic signal finds its way from sending route through receiving one. For example, in communication systems such as telephone, when acoustic signal echo reflects from barriers like door, wall, ceiling, etc. it reflects back to our ears through a microphone embedded in the second acoustic source. If reflected wave reaches our ear after a very short time with respect to sending original signal, it may be considered as a fault spectrum or echo. One of the important parameters in echo discussion is end to end delay which is so called delay time. This time is the time between producing sound on one side and receiving it on the other side. In addition to this parameter, there is another parameter called round trip delay which is the same signal round trip time. Round trip delay is two times the delay time. If round trip delay exceeds 30 milliseconds, echo may be problematic [4]. Moreover, echo must have enough power to be audible, if echo power is less than 30 decibels, it can be inaudible, thus in practical applications if round trip time exceeds 30 milliseconds and echo power also exceeds 30 decibels, we should inevitably cancel echo.
In the late 1950s, the first simple device for echo cancellation was developed and echo controllers were produced in communication networks industry. These systems were initially used to control produced echo in satellite circuits. These were activated acoustic switches which transmitted acoustic waves and they were able to prevent echo reflection slightly. Echo cancellation theory was developed by Bell Labs in the late 1960s and it extended by developing the first system of echo cancellation in the late 1960s by Comsat Tele Systems [7]. Comsat Tele systems designed the first systems of analog echo cancellation for implementing satellite networks. This new system was applied only in satellite networks covering the wide range and it was not applied commercially due to its big dimensions and high price. In the late 1970s, the system designed by Comsat Tele Systems found many applications and for the first time it sold commercial analog echo canceller. Profound developments in making semiconductors in the late 1980s caused converting analog system to digital communication system. From 1990s up to now, communication systems faced significant advances regarding echo cancellation so that designers are now able to cancel acoustic echo after designing echo cancellation filters and implementing it using DSP technology (Digital Signal Processing). [11] To cancel acoustic echo, various techniques such as using a key, blind equalizers and using adaptive algorithms can be applied. The simplest idea for cancelling acoustic echo is using one-way key. In this state, the key is able to pass on information just in one way and we can use instruction sequences to correct this fault. If we use instruction sequences to cancel acoustic echo, we will have to know transmitted symbols sequence in the receiver and this is a big problem. Blind equalizers are not used for cancelling acoustic echo. Thus, the best way to cancel echo is using adaptive algorithms. An adaptive algorithm can calculate the difference between the underlying signal and its output which is error signal. This error signal is reflected towards adaptive filter and filter coefficients are changed to minimize this error function. In acoustic echo cancellation, the output of adaptive filter is the same unwanted echo signal. [3] When the output of an adaptive filter changes into signal, error signal becomes zero and in this way echo is completely cancelled so that acoustic source does not receive its own transmitted signal reflection. Nowadays, different algorithms such as LMS, NLMS, VSLMS, VSNLMS, RLS and so on are used for echo cancellation. [9]

LMS Algorithm
LMS algorithm (Least Mean Square Algorithm) is an adaptive algorithm which is widely used because of low computational complexity it has. Fig. 1 shows the function of this algorithm. Here x is the signal of the first acoustic source, d is the signal of the second acoustic source, ŷ is echo signal and e is error signal. The conversion function of a route which deviates x signal is called w and at first, it is unknown. LMS adaptive filter has conversion function w ∆ and it seeks to make its own conversion function equal to the conversion function of transmittance route. If Δ , echo is cancelled and the first acoustic source will not receive its own transmitted signal reflection.

NLM Algorithm (Normalized Least Mean Square Algorithm)
One of the disadvantages of LMS algorithm is having a constant pitch for each repeat. This requires knowing statistical data from input signal and it is hardly achievable. Now if the system is echo canceller and its input signal is sound, many factors such as input signal power and its amplitude have effect on the systems' function. [2] NLMS is the generalized form of LMS algorithm which corrects former fault by choosing different pitches for each repeat. These coefficients are an approximation of the inverse of total expected energy from instantaneous values of input vector coefficients x (n). So, matrix R is defined as follows: ) 1 ( + n w is estimated from the equation below: In a communication system when we have a two-way conversation, this causes the function of NLMS algorithm to become weak. In this situation, NLMS adaptive filter coefficients become unstable and this causes the divergence of this algorithm.

VSLMS Algorithm (Variable Step Size LMS Algorithm)
We noted that LMS has a constant pitch in every repeat and we have discussed about the disadvantages of NLMS algorithm. In this new algorithm, i.e. VSLMS, the values of pitches in every repeat are expressed in a vector known as and each element is different from another element in terms of impact responses . [10] This algorithm is expressed as follows: Given the application of the algorithm, either Eq. formula 5 or 6 are used for calculating . If user is going to utilize this algorithm for processing digital signals, Eq. formula 6 is used and if the purpose is to design an IC, Eq formula 5 is suggested (In Matlab software and in real time applications, using Eq. formula 5 is more practical). In such equations, ρ is a positive constant value which is used for controlling the effect of gradient term in updating theses equations and it was considered equal to 1 in the previous algorithms. If the algorithm's function is slow with respect to impact response variations, the pitch value will be small and if the algorithm is unstable, the pitch value will be large. To ensure that pitch value will not become small or large, we consider a boundary value with upper and lower limits, [8] while in LMS algorithm, knowing statistical data of a signal was necessary to ensure the function of adaptive filter.

VSNLMS Algorithm (Variable Step Size Normalized LMS Algorithm)
Like LMS algorithm, VSLMS has some weak points and the most important of them is uncertainty about convergence in some applications and as we have noted, knowing statistical data of input signal was essential in this algorithm. We also have noted that since NLMS algorithm had appropriate pitches, the possibility for divergence was very low. To improve the stability of filter coefficients without statistical data of input signal, we need to convert the calculation of pitches into the calculation of variable pitches and calculate the maximum value of the pitch for each repeat. In VSNLMS algorithm, upper limit of each element is estimated for each repeat. In addition, in NLMS, pitches are the inverse scale of instantaneous energy of input signal. In VSNLMS the maximum value of a pitch is calculated for each repeat. [5] RLS Algorithm (Recursive Least Squares Adaptive Filter) RLS is another kind of adaptive filters which can be used for echo cancellation .This algorithm reduces the following equation.
In the above equation, λ is a positive constant value less than 1. Unlike LMS, RSL is directly related to the former values of error estimation. RLS is known as an appropriate algorithm in applications which are variable in terms of time and it results from increasing computational complexity and its stability value. [15] The above equation shows that in time n, all estimated values of error is required even at the beginning. In such circumstances it is obvious that as time passes, the amount of information which is needed for processing is added. In practice, only a limited set of estimated values of the former errors is used depending on n.
One of the algorithms used for echo cancellation is NLMS and its equations are presented: In the above equation, N is filter coefficient and / 0represents the estimated echo. There are several algorithms with different computational complexities derived from the subset of NLMS algorithm. One of these algorithms is NLMS Partial which can implement the above equations by dividing N (Filter coefficient) by B (Number of windows) and updating M blocks in each sample. In this method, blocks are selected and updated sequentially and randomly or by factors having the largest energy (If B=N, the number of blocks is considered as unity). Another method is periodic NLMS and in this method, all N coefficients or factors are updated in regular interval. The suggested algorithm in this paper has a function similar to periodic NLMS algorithm; the only difference is that it updates itself with the largest possible errors rather than constant coefficients. This is implemented by buffer technique in which a group of L samples are collected and used for calculation. If L 10 < , a slight compaction is made in the whole system whose effect is very negligible on filter convergence. Given the function of this algorithm, we can call it MAX-E (Maximum Error). The number of samples (L) and error value can be calculated based on the following equations: 56 + . 56 + 56 + 2 ℎ 5 0,1,2, … , 6 1 -56 + 5 1,2,3, … , 6 1 The objective is to minimize the computational complexity without lowering convergence speed of the algorithm.

Specifications Number of coefficients Algorithm
It is the simplest and most applicable adaptive algorithm and it is stable against µ variations. This algorithm requires knowing statistical data of input signal and it is not possible for an echo cancellation system.

2N+1 LMS
Applying it is easy and calculating its coefficients is possible. It has good damping and having the variable is possible. It has good damping and having the variable µ allows it to have a stable function in facing statistic signals. Thus, it can be used in real time applications.
It has a very low function. It can no longer be used for unstable acoustic signals. Its damping is half that of LMS and it is not used in real time applications.
Increasing its coefficients causes a slight improvement in its function compared to VSLMS algorithm.
The damping of it is higher than the above algorithms and convergence speed is also higher than that of LMS algorithm. It is better not to use it in real time applications. 4N 2 RLS L < 10 L << N,

Methodology
Each of the above algorithms have been simulated by a software and in every simulation, echo signal has been obtained by specifying impact response and its convolution with input acoustic signal. [7] To simulate the investigated algorithms, Matlab software was used. This software is a multi-objective one and has a high graphical power and it is able to analyze an extraordinary matrix. [13] The most important feature it has is creating computational tool boxes and graphical functions. In addition, m. .file written in this software is callable in other software such as c, FORTRAN java and C++ are callable and there is a possibility that it accepts data from other files or tools. Most of the functions defined in Matlab are matrix and this allows having control on each arrays. This software also has a separate tool box for processing a signal For the reasons we mentioned below, Matlab was used in this paper: a) In this study input signals are sounds which will be saved as wav and are readily converted into a code. b) Combined signals (Like echo and error signal) are also in the form of wav which are audible by running Matlab commands. [14] c) Its signal processing tool box can be readily used. d) Diagrams are easily displayed due to the robust graphics this software has. To choose an adaptive algorithm, parameters like convergence speed, algorithm structure, computational complexity and variations in diagrams of MSE and ERLE must be taken into account [6]. To measure the function of algorithms for echo cancellation, there are two main methods: a) Subjective test methods: it involves the extent of damping, studying MSE function and ERLE function. b) Objective test methods: it includes audio test.  To simulate such algorithm, the above equations have been coded in Matlab. The figures below indicate input signal, echo signal, output signal, estimated error and MSE function. In such simulations, filter length is often selected as 1024 or 1000. By making a loop FOR we obtain the best pitch for NLMS regarding its input signal 0.2218.   As it is seen in Fig. 4, maximum amplitude of error signal is approximately 0.02 while maximum amplitude of input signal in. Fig. 2 is 0.2. Thus, error signal ratio to input acoustic signal is 10% which is minimized to 15% compared to LMS algorithm. As in Fig. 4 and as the number of computation windows increases, error is minimized, error square is also minimized in Figs. 5 and 6 such minimizations in error and amplitude of MSE function in NLMS are due to having more additional N multiplication operators compared to LMS. As it is observed in Figs. 6, convergence in NLMS is more than that of LMS. Like in LMS, convergence speed is enhanced as pitch increases and on the other hand, computation time is also increased. Fig. 7 depicts the convergence of NLMS for three different pitches.   Fig. 8 shows the damping level of the algorithm in decibel. The damping mean is obtained decibels for simulating such algorithm. From the obtained results, we found that damping level in NLMS is improved about 10 decibels compared to LMS. In such simulation, the number of repeats is considered as 30000 and impact responses are recorded as output.  The more the impact response of the system (Fig. 10) and estimated impact response of the adaptive algorithm (Fig. 11) converge( ) h h = , the more optimal function of the algorithm will be. As we see Figs.11, we see that amplitude of estimated impact response in NLMS is approximately two times the amplitude of impact response in LMS and this represents better convergence of NLMS compared to LMS. It should be noted that as step coefficients and filter size vary, damping variations and estimated impact response of these algorithms are very negligible. The results obtained from simulating this algorithm are summarized in table below:  After simulating the suggested algorithm and comparing this with NLMS, we obtained the following results. The number of repeats is considered 30000 and input signal is regarded as follows. It is worth noting that the amplitude of this signal is depicted in terms of time and signal length is 12 sec. Deviation is obtained for NLMS and MAX-E using Eq. as follows:   As it is seen in Fig.15, MAX-E is damped quicker than NLMS [3]. The figure below shows comparison between MAX-E and some other algorithms of NLMS category in terms of damping [3]. With regard to damping results, the number of coefficients and so on for any algorithm, it is obvious that MAX-E is more suitable than the other algorithms for acoustic echo cancellers. According to the figure below, MAX-E has less computational complexity and simulation time. Thus, an optimal MAX-E is suggested for echo cancellation.

Conclusion
The aim of this paper is to present an optimal adaptive algorithm for echo cancellation. In the second chapter, different techniques for echo cancellation were studied and adaptive algorithms were selected among them for echo cancellation. Then, various kinds of adaptive algorithms were studied and the acquired results were compared and finally they were simulated. According to the suggested materials, MAX-E and NLMS were primarily suggested for echo cancellation. NLMS is often utilized in real time applications for echo cancellation. Given computational complexity, the number of required operators for each algorithm and time needed for performing computations by computer, MAX-E is suggested for acoustic echo cancellation.