LMS Adaptive Filter

15 downloads 94 Views 380KB Size Report
classing and video-conferencing require the use of an acoustic echo canceller ... Transform (HOT) based adaptive filter for elimination of echo from audio signals. ..... Behavioral Model and HDL Code Generation Model. Audio playback in ...
VHDL Implementation of Hirschman Optimal Transform (HOT) based LMS Adaptive Filter for Acoustic Echo Cancellation E. Hari Krishna1,M. Raghu Ram2, K. Venu Madhav3 and K. Ashoka Reddy4 1, 4

2, 3

Dept. of ECE, KU CE&T, Kakatiya University, Warangal, Andhra Pradesh, India Dept. of E&I Engg., Kakatiya Institute of Technology & Science, Warangal, Andhra Pradesh, India

Email:

1

[email protected], 2 [email protected], [email protected], 4 [email protected]

Abstract- Applications such as hands-free telephony, teleclassing and video-conferencing require the use of an acoustic echo canceller (AEC) to eliminate acoustic feedback from the loudspeaker to the microphone. Room acoustic echo cancellation typically requires adaptive filters with thousands of coefficients. Transform domain adaptive filter finds best solution for echo cancellation as it results in a significant reduction in the computational burden. Literature finds different orthogonal transform based adaptive filters for echo cancellation. In this paper, we present Hirschman Optimal Transform (HOT) based adaptive filter for elimination of echo from audio signals. Simulations and analysis show that HOT based LMS adaptive filter is computationally efficient and has fast convergence compared to LMS, NLMS and DFT-LMS. The computed Echo Return Loss Enhancement (ERLE), the general evaluation measure of echo cancellation, established the efficacy of proposed HOT based adaptive algorithm. In addition, the spectral flatness measure showed a significant improvement in canceling the acoustic echo. To achieve the

goal of hardware implementation, which provides high performance, low power and reliability, we propose a VHDL model for a HOT Adaptive filter. Keywords: Echo Cancellation, LMS, HOT I. INTRODUCTION Echo phenomenon is interesting and entertaining, but its presence in communication networks is undesirable and represents a serious problem. There are two types of echo: acoustic echo and hybrid echo. Acoustic echo occurs when an audio source and sink operate in full duplex mode; an example of this is a hands-free loudspeaker telephone [1][3]. In situation shown in Fig. 1, the received signal is output through the telephone loudspeaker (audio source) and this audio signal is then reverberated in a real environment and picked up by the systems microphone (audio sink) resulting in the original intended signal plus attenuated, time-delayed images of the original speech signal. The signal interference caused by acoustic echo is distracting to both users and causes a reduction in the quality of the communication. Popular methods for echo cancellation in hands-free telephony are based on adaptive filtering techniques. Room acoustic echo cancellation typically requires adaptive filters of the order 100 or even 1000. When considering VLSI implementation, such long filters would result in large resource and high power consumption. Transform domain adaptive filter finds best solution for echo cancellation as it results in a significant reduction in the computational burden. In this paper, Hirshman Optimal Transform (HOT) based frequency domain adaptive filtering method is

Speaker

Microphone

Figure 1. Origin of Acoustic echo

presented for cancellation of echo from audio signals and its performance is compared with LMS, NLMS and DFT based adaptive filtering methods. The rest of the paper is organized as follows. In section II, we briefly review timedomain LMS, NLMS and transform domain LMS algorithms. Section III presents basics of HOT and HOT based LMS update equation. Section IV presents simulations and experimental results of the proposed HOT based adaptive filter. Finally, conclusions are made in section V with a possible scope for future work. II.

ADAPTIVE FILTERING

Adaptive filters are typically used when noise occurs in the same band as the signal or when the noise band is unknown or varies over time. The basic form of timedomain adaptive filtering application as echo cancellation is shown in fig. 2. Different algorithms can be used to adapt the weights w of the filter, with a attempt to minimize the mean square error (MSE) performance function. A. LMS algorithm The LMS algorithm makes use of instantaneous estimate of the gradient to search the minimum of the error surface [4]. The complete LMS algorithm is written as three equations. y(n) wT (n)u(n) : filter output e(n) d (n) y(n) : error formation

(1) (2) w(n 1) w(n) e(n)u(n) : weight vector update (3) where u(n) is the filter input at instant n, e(n) is the error incurred by the adaptive filter, d(n) being the desired output of the filter and is the step size used in the weight vector

W0

Input Signal x (n)

Adaptive Filter w (n)

u (n) u (n-1)

v0

u (n-2)

NxN v Linear 2 Transform

y (n) WN - 1

y(n) - Output +

Figure 3. Block Diagram of Transform Domain Adaptive Filter

Echoed Signal d (n)

Figure 2. Block Diagram of Adaptive Echo Cancellation

updation, which governs the rate of convergence of the algorithm, with the following bounds. 0 2 / max 0 2 / tr[ R] 0 2 / Smax where is the largest eigen value of input max autocorrelation matrix R E[uuT ] and S max maximum value of the input signal power spectrum. In practice, the exact statistics of u(n) and d(n) are unknown or vary with time. A time-varying step size, (n) , if properly computed, can provide stable, robust, and accurate convergence behaviour for the LMS adaptive filter in these situations. B. NLMS Algorithm From the weight update equation (3) it is clear that the adjustment is directly proportional to the tap input vector u (n). Therefore, when u (n) is large, then the LMS filter suffers from a gradient noise amplification problem. To overcome this difficulty; we may use the normalized LMS filter. In particular, the adjustment applied to the tap weight vector at iteration (n+1) is “normalized” with respect to the squared Euclidean norm tap input vector u(n) at iteration n So the weight vector update equation for each iteration given as

The selforthogonalizing adaptive filtering algorithm for a wide sense stationary environment is described by the following weight vector update equation (5) w(n 1) w(n) R 1 u(n) e(n) The constant lies in the range: 0 < < 1 and is given by (6) 1/(2M ) where M is the filter length. An important property of the selforthogonalizing filtering algorithm of eq (5) is that it guarantees a constant rate of convergence, irrespective of input statistics. The transformed outputs form a vector v(n) which is given as (7) v(n) T [x(n)] [v0 (n), v1 (n),........... vM 1 (n)]T Here T can be any orthogonal transform Output is given by y ( n) w T ( n ) v ( n ) (8) The instantaneous output error is e(n) d (n) y(n) Now, replacing u(n) and R

u ( n)

2

u(n) e(n)

(4)

With the proper choice of , the NLMS adaptive filter can often converge faster than the LMS adaptive filter [5], [6]. C. Transform Domain Adaptive Filters (TDAF) The concept of adaptive filtering in frequency domain was published in 1978 by Dentino et al, in which in addition to the DFT, other orthogonal transforms such as the DCT and the Walsh-Hadamard Transform (WHT), are also used effectively as a means to improve the LMS algorithm without adding too much computational complexity [7][11]. The TDAF structure is shown in fig.3. The input signal is pre processed by decomposing the input vector into the orthogonal components, which are in turn used as inputs to a parallel bank of simpler adaptive filters. With an orthogonal transformation, the adaptation takes place in transform domain, as it possible to show that the adjustable parameters are indeed related to an equivalent set of time domain filter co-efficients by means of the same transformation that is used for real time processing.

1

with the transformed vector 1

v(n) and its inverse correlation matrix respectively, eq. (5) becomes 1 w(n 1) w(n) v(n) e(n) (9) where E [ v(n) vT (n)] diag [ 0 , 1 ,............, M 1 ] (10) and the inverse of is diagonal matrix. 1

w (n 1) w(n)

W2

vN -1

u (n-N+1)

Error Signal e (n) = d (n) - y (n)

W1

v1

Acoustic Impulse Response

d (n)

diag [

1 0

,

1 1

,............,

1 M 1

]

(11)

III. HOT ADAPTIVE FILTER The HOT is a recently developed discrete unitary transform that uses the orthonormal minimizers of the entropy-based Hirschman uncertainty measure [12]. This measure uses entropy to quantify the spread of discrete-time signals in time and frequency and is different from the energy-based Heisenberg uncertainty measure that is only suited for continuous time signals. A. HOT basis functions The basis functions that define the HOT are derived using the K-dimensional DFT as the originator signals for N = K2dimensional HOT basis and K must be an integer. Each of these basis functions must then be shifted and interpolated to produce the sufficient number of orthogonal basis functions that define the HOT. In general, we have the (unitary) transform relationship [13],

H ( Kr l )

1

K 1

K n0 and it’s inverse x ( Kn l )

1 K

x[ Kn l ] e

K 1

x[ Kr l ] e

j

j

2 nr K

2 nr K

, 0 r, l

, 0 n, l

K

K 1

1

(12)

(13)

r 0

In general, the N-point HOT is computationally more efficient than the N-point DFT and increasingly more efficient as N . A HOT basis sequence of length K 2 is the most compact bases in the time-frequency plane. For a 32 - point HOT matrix, we need to start with 3-point DFT and the 9-point HOT matrix H can be derived as follows. I I I j2 /3 j4 /3 (14) H I e I e I j4 /3

Figure 4. Original Recorded waveform

j8 / 3

I e I e I where, I is 3x3 identity matrix. Like the DFT, the HOT is unitary and so the inverse transform can be achieved by simply taking the conjugate transpose and scaling by K .

B. HOT adaptive algorithm Let u(n) be the input vector to the filter, u H (n) is the HOT transform of u(n), and the filter output is given by (15) y(n) wTH (n) u H (n) The update weight vector equation, for each iteration, is 1 w H ( n 1) w H ( n ) n e n u*H ( n ) (16) The diagonal matrix (n) contains the estimated power of the HOT co-efficients and can be updated using recursion 1 * (17) (n) n 1 [u H ( n 1) u H ( n 1 ) n 1 ] n 1/(2 K 2 ) and K 2 is the filter length where

Figure 5. Original audio (top trace) and its echoed version (bottom trace)

IV. SIMULATIONS AND E XPERIMENTAL RESULTS First an audio signal was recorded with a sampling frequency of 44.1 KHz, which is shown in fig. 4. Then, the recorded audio signal is down-sampled to 8 KHz. Echo audio signal is generated using Matlab® script file which uses the recorded audio signal as input. The original audio and its echoed version are shown in fig. 5. In order to test the efficacy of the proposed method, adaptive algorithms based on LMS, NLMS, DFT-LMS and HOT-LMS were developed and used in this echo cancellation application. The computational complexity of these algorithms was tested in terms of number of multiplications required. Table I indicates the very fact that transform domain algorithms reduce the computational burden and that too HOT-LMS still performs better than that of DFT-LMS. The performance of the algorithms in echo cancellation was evaluated using the echo return loss enhancement (ERLE) measure. This ratio is a measure of the level of echo suppression and is defined as follows, E [d 2 (n)] ERLE 10log 10 dB (18) E [(d (n) - y(n)) 2 ] where d(n) and y(n) are as shown in fig. 2. The ERLE comparison made for the tested algorithms, shown in fig. 6, clearly indicates that the HOT-LMS is having superior ERLE compared to other algorithms. The computed mean ERLE, given in table I, also confirms the same.

Figure 6. ERLE plots for LMS, NLMS, DFT-LMS and HOT-LMS

Table I. Computational complexity and mean-ERLE

Algorithm LMS NLMS

No. of multiplications 2097152 3145728

Mean-ERLE (dB) 14.54 14.57

DFT-LMS

129024

22.25

HOT- LMS

118784

23.28

The spectra of the signals, shown in fig. 7, revealed very little information. Further, to examine the spectral content of the echo cancelled signal, the spectral flatness measure

(SFM), a measure to characterize the audio spectrum, was computed for each of the signals. SFM is calculated by dividing the geometric mean (GM) with the arithmetic mean (AM) of the power spectrum. N 1

SFM

x(n) N

(19)

3

recoverd Audio (LMS)

2.5

n 0

n 0

recoverd recoverd Audio Audio (DFT-LMS)(HOT-LMS)

Echoed Audio

Original Audio

3.5

N 1

x (n)

N

4

recoverd Audio (NLMS)

2

The calculated GM, AM and SFM, indicated in table II, shows a remarkable improvement in SFM for the case of HOT-LMS, indicating that the echo cancelled signal is

1.5 1 0.5

0 0

Magnitude in dB

-20

1

2

3

4

5

6

Figure 9. Bar plot of Geometric Mean for different algorithms

-40 0 0

500

1000

1500

2000

2500

3000

3500

4000

0.45 0.4

Original Audio

-20 0.35

-40 0 0

500

1000

1500

2000

2500

3000

3500

4000

Echoed Audio

recovered recovered recovered recovered Audio Audio Audio Audio (NLMS) (DFT-LMS) (HOT-LMS) (LMS)

0.3 0.25

-20

0.2

-40 0

500

1000

1500

2000

2500

3000

3500

4000

0.15

Frequency in Hz 0.1

Figure 7. Spectrum of original audio (top trace) , echoed version (middle trace) and recovered signal (bottom trace).

0.05 0

1

similar to that of original audio signal used in this experimentation.

2

3

4

5

6

Figure 10. Bar plot of SFM for different algorithms 4.5

Table II Spectral measures of the signals

1.2

Original Audio

GM 1.1358 1.1538

AM 3.5261 3.4409

SFM 0.3221 0.3237

0.6741

2.0006

0.3370

0.6953

2.0650

0.3367

1.1074

3.0749

0.3268

1.1207

3.3886

0.3257

Arithmetic Mean

2

Spectral Flatness Measure

1.5 1 0.5 0

1

2

3

Figure 11. Bar plot of AM, GM and SFM for different algorithms

recovered recovered Audio Audio (DFT-LMS) (HOT-LMS)

1 recovered recovered Audio Audio (NLMS) (LMS)

0.6

0.4

0.2

0

3 2.5

Echoed Audio

0.8

3.5

Ensemble averaged MSE (dB)

Signal Original Echoed signal LMS recovered NLMS recovered DFT-LMS recovered HOT- LMS recovered

original echoed LMS NLMS DFT-LMS HOT-LMS

Geometric Mean

4

0 LMS -100

NLMS DFT-LMS

-200 HOT-LMS -300 0

500

1000 1500 2000 2500 no. of iterations Figure 12. Convergence analysis of different algorithms

V. VHDL IMPLEMENTATION 1

2

3

4

5

6

Figure 8. Bar plot of Arithmetic Mean for different algorithms

To achieve the goal of hardware implementation, which provides high performance, low power and reliability, we propose a VHDL model for HOT adaptive filter

Acoustic Echo Canceler (Fixed -Point Version ) Behavioral Model and HDL Code Generation Model Noise Only y_noiseonly Acoustic Environment Exterior Mic

0

Noisy Signal y_noisy

1/z

Input

1/z

Desired

Output

Filter Pilot's Mic

1

LMS

Filter Select

Error

1/z

Step -size

Normal Adapt 0.002

Waterfall Scope

Wts

Reset LMS Filter Behavioral Model

0.0005

Waterfall Filtered Signal

Slower Adapt

y_filtered 0 LMS Filter Error - Behavioral Implementation

Input

1 Reset

Desired

LMS Filter Error - Hardware Implementation

Error_Out Step_Size Reset_Weights

y_hwfiltered

Difference

Hardware Filtered Signal

lms

Scope Diff y_diff

Audio playback in MATLAB: Original Signal

Noisy Signal

Filtered Signal

Hardware Filtered Signal

Figure 13. Simulink model for LMS Acoustic echo canceller

VHDL is the VHSIC Hardware Description Language. VHSIC is an abbreviation for Very High Speed Integrated Circuit. It can describe the behavior and structure of electronic systems, but is particularly suited as a language to describe the structure and behavior of digital electronic hardware designs, such as ASICs and FPGAs as well as conventional digital circuits. VHDL is a notation, and is precisely and completely defined by the Language Reference Manual (LRM). This sets VHDL apart from other hardware description languages, which are to some extent defined in an ad hoc way by the behavior of tools that use them. VHDL is an international standard, regulated by the IEEE. The definition of the language is non-proprietary. Simulation and synthesis are the two main kinds of tools, which operate on the VHDL language. The Language Reference Manual does not define a simulator, but unambiguously defines what each simulator must do with each part of the language. VHDL does not constrain the user to one style of description. VHDL allows designs to be described using any methodology - top down, bottom up or middle out! VHDL can be used to describe hardware at the gate level or in a more abstract way. Successful high-level design requires a language, a tool set and a suitable methodology. Filter Design HDL Coder accelerates the development of application-specific integrated circuit (ASIC) and field programmable gate array (FPGA) designs and bridges the gap between system-level design and hardware development by generating hardware description language (HDL) code based on filters developed in MATLAB®. Currently, system designers and hardware developers use HDLs, such as VHDL and Verilog, to develop hardware designs. Although HDLs provide a proven method for hardware design, the task of coding filter designs, and hardware designs in general, is labor intensive and the use

of these languages for algorithm and system-level design is not optimal. Using Filter Design HDL Coder, system architects and designers can spend more time on fine-tuning algorithms and models through rapid prototyping and experimentation and less time on HDL coding. Architects and designers can efficiently design, analyze, simulate, and transfer system designs to hardware developers. In a typical use scenario, an architect or designer uses Filter Design Toolbox, its Filter Design and Analysis Tool (FDA Tool) or filter builder function, and Filter Design HDL Coder to design a filter. Then, with the click of a button, Filter Design HDL Coder generates a VHDL or Verilog implementation of the design and a corresponding test bench. The generated code adheres to a clean HDL coding style that enables architects and designers to quickly address customizations, as needed. The test bench feature increases confidence in the correctness of the generated code and saves potential time spent on test bench implementation. A simulink model is developed for LMS Adaptive filter as shown in fig 13. By using filter design HDL coder VHDL code is developed. Simulation result of adaptive filter shown in fig. 14.

Figure 14. VHDL simulation result of adaptive filter

Figure 14. Xilinx synthesis result of adaptive filter

After simulation, synthesis RTL model is generated using Xilinx Integrated Development Environment (IDE) tools. Typical synthesis result of adaptive filter is shown in fig. 14. VI. CONCLUSION Acoustic echo cancellation is an essential signal enhancement tool for applications such as hands-free telephony, tele-classing and video-conferencing. In this paper, HOT based LMS adaptive filtering for acoustic echo cancellation from audio signals has been presented. The Convergence & Computational complexity analysis of different adaptive algorithms shows that HOT – LMS is efficient. The computed ERLE measure and SFM indicated

that HOT – LMS is superior in cancelling echo in audio signals. The algorithms are implemented in VHDL using filter design HDL coder package available in MATLAB®. As demonstrations in this paper showed that HOT-LMS significantly reduced the computational burden, the authors are presently working on VLSI implementation issues of the presented algorithm using FPGA by exploiting pipelining architecture. VII. REVERENCES [1]

E. Hänsler, “The hands-free telephone problem - An annotated bibliography," Signal Processing, vol. 27, pp. 259-271, June 1992.

[2] [3]

[4]

[5]

[6]

[7]

[8]

[9] [10]

[11]

[12] [13]

D. Mapes-Riordan and J. H. Zhao, ”Echo control in teleconferencing using adaptive filters,” 95th Convention os Audio Engineering Society, October 7, 1993. J. Salz, “On the Start-Up Problem in Digital Echo Cancellers,” Bell System Technical Journal, Vol. 60, no. 10, pp. 2345-2358, July-Aug, 1983. B. Widrow, J. McCool, M. Larimore, and C. Johnson, Jr., “Stationary and Non-Stationary Learning Characteristics of the LMS Adaptive Filter,” Proc. IEEE, Vol. 64, no. 8, pp. 1151-1162, Aug. 1976. D. T. M. Slock, “On the convergance behavior of the LMS and the normalized LMS algorithms,” IEEE Trans. Signal Processing, vol. 41, no. 9, pp. 2811-2825, September 1993. Y. Wei, S. B. Gelfand and J. V. Krogmeier, “Noise constranied LMS algorithm,” Proc. IEEE International Conference on Acoustics, Speech, and Signal Processing, pp. 2353-2356, April 1997. K. Eneman, M. Moonen and I. Proudler, “Frequency domain adaptive echo cancellation as a special case of subband echo suppression," in Proceedings of the RISC/IEEE Benelux workshop on Circuits, Systems and Signal Processing, (Mierlo, The Netherlands), pp. 131{136, November 1996. T. Gaensler, “A robust frequency-domain echo canceller,” Proc. 1997 IEEE International Conference on Acoustics, Speech, and Signal Processing, pp. 2353-2356, April 1997. J. J. Shynk, ”Frequency-domain and multirate adaptive filtering,” IEEE SignalProc. Mag, vol. 9, no. 1, pp. 14-37, January 1992. D. F. Marshall, W. K. Jenkins, and J. J. Murphy, “The use of orthogonal transforms for improving performance of adaptive filters,” IEEE Trans. on Circuits and Systems, 36, no. 4, pp. 474484, 1989. G. Panda, B. Mulgrew, C.F.N. Cowan, P.M. Grant, “A selforthogonalizing efficient block adaptive filter”, IEEE Trans. ASSP, VOL, ASSP-34, NO.6, pp. 1573-1582, Dec 1986. I.I. Hirschman, “A note on entropy,” Amer. J. Math., Vol 79, pp152-156, 1957. T. Prezebinda, V. DeBrunner, and M. Ozaydin, “The optimal transform for the discrete Hirschman uncertainty principle,” IEEE Trans. Infor. Theory, pp 2086-2090,July 2001.