echo cancellation paper
DESCRIPTION
echo types, how to cancel echo in each type, which is more complex, echo cancellation implementation in matlab prepared by : OLA MASHAQI ,, SUHAD MALAYSHETRANSCRIPT
Abstract
Today, people are more interested in hands-
free communication. In such a situation, the
use a regular loudspeaker and a high-gain
microphone, in place of a telephone
receiver, might seem more appropriate. The
presence of a large acoustic coupling
between the loudspeaker and microphone
would produce a loud echo that would make
conversation difficult. Furthermore, the
acoustic system could become instable,
which would produce a loud howling noise
to occur. The solution to these problems is
the elimination of echo with an echo
cancellation algorithm. The echo cancellers
have main disadvantage since it supports
only a half-duplex communication . An
important aspect of echo cancellers is that
full-duplex communication can be
maintained, which allows both speakers to
talk at the same time.
Introduction
Echo is the repetition of a waveform due to
reflection from points where the
characteristics of the medium through which
the wave propagates changes. Echo is
usefully employed in sonar and radar for
detection and exploration purposes. In
telecommunication, echo can degrade the
quality of service, and echo cancellation is
an important part of communication
systems. The development of echo reduction
began in the late 1950s. There are two types
of echo in communication systems: acoustic
echo and telephone line hybrid echo.
Acoustic echo results from a feedback path
set up between the speaker and the
microphone in a mobile phone or hands-free
phone. Telephone line echoes result from an
impedance mismatch at telephone exchange
hybrids where the subscriber's 2-wire line is
connected to a 4-wire line. The perceptual
effects of an echo depend on the time delay
between the incident and reflected waves,
the strength of the reflected waves, and the
number of paths through which the waves
are reflected. Telephone line echoes, and
acoustic feedback echoes are undesirable
and annoying and can be disruptive.
What is echo ?
Echo is a phenomenon where a delayed and
distorted version of an original sound or
electrical signal is reflected back to the
source. 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
1
heard as a distinct echo. Fig 1 illustrate
simple diagram explained echo .
Fig 1 Here B is the reflected wave arrives after a very short time of direct sound
How echo generated
A significant problem in communications is
the generation of echoes. The echoes arise
for a number of reasons, with the primary
reason being an impedance mismatch. The
impedance mismatch occurs when the two-
wire network meets the four-wire network,
this interface is known as the hybrid. This
impedance mismatch causes some of the
signal energy to be returned to the source as
an echo .
The delays between primary and echo
signals are directly related to the
transmission distance. For example, if a
signal was sent to a satellite that redirected
the signal back to another location on earth,
that signal would have a very large time
delay compared to a signal sent to a local
switching station and back. Short delays
(less than 50 ms) will not affect the quality
of the signal as much as longer delays.
Delays of this length are not noticed by the
receiver and therefore are not considered an
annoyance. However, these echoes may
have an effect on data being transmitted
through transmission lines [1]
Echo Types
There are two types of echo in communication systems :
One) Acoustic echo : Acoustic echo
results from a feedback path set up between
the speaker and the microphone in a mobile
phone, hands-free phone, teleconference or
hearing aid system. Acoustic echo is usually
reflected from a multitude of different
surfaces, such as walls, ceilings and floors,
and travels through different paths .
Fig 2 Acoustic echo .
Gain of an acoustic feedback loop depends
on the frequency responses of the electrical
and the acoustic signal paths. The
undesirable effects of the electrical sections
2
on the acoustic feedback can be reduced by
designing systems that have a flat frequency
response . [1]
Two) Telephone line Hybrid echo
[Hybrid] : Hybrid echo is the main source
of echo generated from the public-switched
telephone network (PSTN). Echoes on a
telephone line are due to the reflection of
signals at the points of impedance mismatch
on the connecting circuits. Conventionally,
telephones in a given geographical area are
connected to an exchange by a 2-wire
twisted line, called the subscriber's line ,
which serves to receive and transmit signals.
In a conventional system a local call is set
up by establishing a direct connection, at the
telephone exchange, between two
subscribers’ loops. For a local call, there is
usually no noticeable echo either because
there is not a significant impedance
mismatch on the connecting 2-wire local
lines or because the distances are relatively
small and the resulting low-delay echoes are
perceived as a slight amplification and
“livening” effect. For long communication
between two exchanges, it is necessary to
use repeaters to amplify the speech signals;
therefore a separate 2-wire telephone line is
required for each direction of transmission.
Fig 3: Illustration of a telephone call set up by connection of 2-
wire subscriber's via hybrids to 4-wire lines at the exchange
Figure 4: A 2-wire to 4-wire hybrid circuit.
To establish a long-distance call, at each
end, a 2-wire subscriber's line must be
connected to a 4-wire line at the exchange
fig 4 , as illustrated in Figure 5 . The device
that connects the 2-wire subscriber's loop to
the 4-wire line is called a hybrid as shown in
figure 4 . the hybrid is basically a three-port
bridge circuit. If the hybrid bridge were
3
perfectly balanced then there would be no
reflection or echo. However, each hybrid
circuit serves a number of subscribers’ lines.
The subscribers' lines do not all have the
same length and impedance characteristics;
therefore it is not possible to achieve perfect
balance for all subscribers at the hybrids.
When the bridge is not perfectly balanced,
some of the signal energy on the receiving
4-wire lines becomes coupled back onto
itself and produces an echo.
Echo is often measured in terms of the echo
return loss (ERL); the higher the echo
return loss the lower will be the echo.
Telephone line echoes are undesirable, and
become annoying when the echo amplitude
is relatively high and the echo delay is long.
For example when a long distance call is
made via a satellite the round-trip echo
delay can be as long as 600 ms, and echoes
can become disruptive. Also, as already
mentioned, there are appreciable delays of
up to 200 ms inherent in digital mobile
phones, which make any echo quite
noticeable. For this reason the employment
of echo cancellers in mobile switching
centers is mandatory. [2]
How to reduce acoustic echo ?
When the telephone connection is between
hands-free telephones or between two
conference rooms, then an acoustic echo
problem emerges that is due to the reflection
of the loudspeaker’s sound waves from the
boundary surfaces and other objects back to
the microphone. There are a number of
methods for removing acoustic feedback.
One method for alleviating the effects of
acoustic feedback and the room
reverberations is to place a frequency shifter
(or a phase shifter) in the electrical path of
the feedback loop. Each time a signal travels
round the feedback loop it is shifted by a
few hertz before being re-transmitted by the
loudspeaker. This method has some effect in
reducing the howling but it is not effective
for removal of the overall echo of the
acoustic feedback. Another approach is to
reduce the feedback loop-gain at those
frequencies where the acoustic feedback
energy is concentrated. This may be
achieved by using adaptive notch filters to
reduce the system gain at frequencies where
acoustic oscillations occur. The drawback of
this method is that in addition to reducing
the feedback the notch filters also result in
distortion of the desired signal frequencies.
The most effective method of acoustic
feedback removal is the use of an adaptive
feedback cancellation system as in fig 5 [3]
4
fig 5 the use of an adaptive feedback cancellation system
x(n): far-end signal,, y(n): echo signal ,v(n)
near-end signal, d(n): microphone signal,
u(n): background noise, yhat(n): filter
input, e(n): error signal, d[n]=y[n]+u[n],
e[n] = d[n]- yhat(n)
Hybrid echo cancellation
We will define the speech of speaker A as
the near end signal for hybrid A and the
speech of speaker B as the far-end signal for
hybrid A. For hybrid B, the near-end and
far-end signals are the signals of speaker B
and of speaker A, respectively. The speaker
at the far-end hears not only what the
speaker at the near-end says ,but also an
echo of his own voice .fig 6 , The signal
from the near end signal will be denoted by
v(t). The signal from the far-end speaker is
x(t). The echo of the far-end speaker is y(t).
The echo can be modeled as the result of the
signal x(t) passing through a linear filter h(t)
y(t) = h(t) * x (t) Where *
denotes convolution.
The signal which is sent back to the far-end
speaker is: z(t) = v(t) + y (t)
Another possibility is to identify the impulse
response h(t) of the hybrid or the acoustic
coupling between the loudspeaker and the
microphone, then estimate the echo signal
y(t) and subtract it from z(t). Let the
estimated echo and impulse response be
ˆy(t) and ˆh(t), respectively . The signal sent
back to the far end is:
e(t) = z(t) - ˆy (t) = v(t) + y (t) - ˆy (t)
The estimated echo ˆy(t) is:
ˆy (t)= ˆh (t) * x(t) If ˆ h(t) =h(t), then the
cancellation is complete, i.e. e(t) ≡ v(t) [4]
5
Fig 6: hybrid echo cancellation
The echo canceller coefficients wk(m) are
adapted to minimize the energy of the echo
signal on a telephone line, say from speaker
B to speaker A. Assuming that the speech
signals xA(m) and xB(m) are uncorrelated,
the energy on the telephone line from B to A
is minimized when the echo canceller output
x^echoA
(m ) echo xA m is equal to the echo
xAecho (m ) echo xA m on the line. The echo
canceller coefficients may be adapted using
one of the variants of the recursive least
square error (RLS) or the least mean squared
error (LMS) adaptation methods. One of the
most widely used algorithms for adaptation
of the coefficients of an echo canceller is the
normalized least mean square error (NLMS)
method. The time-update equation
describing the adaptation of the filter
coefficient vector is
w(m)= w(m-1)+ µ [e(m) / ( x(m)TA x(m) A )]
x(m) A
where xA(m)=[xA(m), ..., xA(m–P)] and
w(m)=[w0(m), ..., wP–1(m)] are the input
signal vector and the coefficient vector of
the echo canceller, and e(m) is the difference
between the signal on the echo line and the
output of the echo synthesizer. Note that the
normalizing quantity x(m)TA x(m) A is the
energy of the input speech to the adaptive
filter. The scalar µ is the adaptation step
size, and controls the speed of convergence,
the steady-state error and the stability of the
adaptation process.
acoustic echo cancellation is more
complex than line echo cancellation
The problem of acoustic echo cancellation is
more complex than line echo cancellation
for a number of reasons. First, acoustic echo
is usually much longer (up to a second) than
terrestrial telephone line echoes. In fact, the
delay of an acoustic echo is similar to or
more than a line echo routed via a
geostationary satellite system. The large
delay of an acoustic echo path implies that
impractically large filters on the order of a
few thousand coefficients may be required.
6
The stable and speedy adaptation of filters
of such length presents a difficult problem.
Secondly, the characteristics of an acoustic
echo path is more non stationary compared
with that of the telephone line echo.
Thirdly, acoustic echoes are due to signals
reflected back from a multitude of different
paths, off the walls, the floor, the ceiling, the
windows etc. Finally, the propagation and
diffusion characteristics of the acoustic
space of a room is a non-linear process, and
is not well approximated by a lumped FIR
(or IIR) linear filter. In comparison, it is
more reasonable to model the characteristics
of a telephone line echo with a linear filter.
In any case, for acoustic echo cancellation,
the filter must have a large impulse response
and should be able to quickly track fast
changes in echo path characteristics. [3]
Matlab Implementation of Echo Cancellation in Telephone Line
The RLS methods provides a faster convergence rate and better overall performance at the cost of higher computational complexity
The information bearing signal is a sine wave of 0.055 cycles/sample. It is considered in this case to be assumed voice signal , When the voice is passing through the telephone line fig-7 the echo is added with the signal fig-8 so that at the far end we would not able to receive the signal of actual voice but we get the signal shown in fig 9. Now our aim is to cancel the echo path. Here the Running the RLS adaptive filter for 1000 iterations. The plot shows the convergence of the adaptive filter response to the response of the FIR filter in fig 10. By computing we get the error e signal shown in fig 11
fig 7 : Assumed voice signal
7
fig 8 : Echo path
fig 9 : Voice signal + Echo signal
Fig:10 filter response
Fig: 11 error signal
matlab implementation of Acoustic Echo Cancellation (AEC)
In acoustic echo cancellation, a measured microphone signal d(n) contains two signals: - the near-end speech signal v(n) - the far-end echoed speech signal dhat(n) The goal is to remove the far-end echoed speech signal from the microphone signal so that only the near-end speech signal is transmitted The Room Impulse Response we describe the acoustics of the loudspeaker-to-microphone signal path where the speakerphone is located. We can use a long finite impulse response filter to describe these characteristics
P.S. far end and near end signals are uploaded from matlab
8
Summary
Telephone line echo and acoustic feedback echo affect the functioning of telecommunication and teleconferencing systems. In general, line echo cancellation, is a relatively less complex problem than acoustic echo cancellation because acoustic cancellers need to model the more complex environment of the space of a room. We discussed telephone line echoes arising from the mismatch at the 2/4-wire hybrid bridge. And implement RLS filter using matlab simulink to remove it .we considered the acoustic coupling between a loudspeaker and a microphone system. Acoustic feedback echo can result in howling, and can disrupt the performance of teleconference, hands-free telephones, and hearing aid systems. The main problems in implementation of acoustic echo cancellation systems are the requirement for a large filter to model the relatively long echo.
References [1] echo cancellation using adaptive filtering By Thani
Tridhavee And Steve Vuco
[2] Soria, E.; Calpe, J.; Chambers, J.; Martinez, M.; Camps, G.; Guerrero, J.D.M.; “A novel approach to introducing adaptive filters based on the LMS algorithm and its variants”, IEEE Transactions, vol. 47, pp. 127-133, Feb 2008.
[3] Implementation of Acoustic Echo Cancellation For PC
Applications Using MATLAB,Master of Science Thesis In
System on Chip Design, by Lu Lu Stockholm, 05/2007
[4] International Journal of Emerging Technology and Advanced
Engineering Website: www.ijetae.com (ISSN 2250-2459, Volume
2, Issue 10, October 2012) 411 Matlab Implementation of Echo
Cancellation in Telephone Line
9
Appendix
M = 4001;fs = 8000;
[B,A] = cheby2(4,20,[0.1 0.7]);
Hd = dfilt.df2t([zeros(1,6) B],A); % Discrete-time, direct-form II transposed filter numerator coefficients B and denominator coefficients A.hFVT = fvtool(Hd); % Analyze the filter using Open Filter Visualization Tool set(hFVT, 'Color', [1 1 1])%he Room Impulse ResponseH = filter(Hd,log(0.99*rand(1,M)+0.01).* ... sign(randn(1,M)).*exp(-0.002*(1:M)));H = H/norm(H)*4; % Room Impulse Responseplot(0:1/fs:0.5,H)xlabel('Time [sec]')ylabel('Amplitude')title('Room Impulse Response')set(gcf, 'Color', [1 1 1])%The Near-End Speech Signalload nearspeechn = 1:length(v);t = n/fs;plot(t,v);axis([0 33.5 -1 1]);xlabel('Time [sec]');ylabel('Amplitude');title('Near-End Speech Signal');set(gcf, 'Color', [1 1 1])x=wavrecord(16000,8000); p8 = audioplayer(v,fs);playblocking(p8);%he Far-End Speech Signalload farspeechx = x(1:length(x));dhat = filter(H,1,x);plot(t,dhat); axis([0 33.5 -1 1]);xlabel('Time [sec]');ylabel('Amplitude');title('Far-End Echoed Speech Signal');set(gcf, 'Color', [1 1 1])p8 = audioplayer(dhat,fs);playblocking(p8);
%The Microphone Signald = dhat + v+0.001*randn(length(v),1);plot(t,d) axis([0 33.5 -1 1]);xlabel('Time [sec]');ylabel('Amplitude');title('Microphone Signal');set(gcf, 'Color', [1 1 1])p8 = audioplayer(d,fs);playblocking(p8);%the Frequency-Domain Adaptive Filter (FDAF)mu = 0.025;W0 = zeros(1,2048);del = 0.01;lam = 0.98;x = x(1:length(W0)*floor(length(x)/length(W0)));d = d(1:length(W0)*floor(length(d)/length(W0)));% Construct the Frequency-Domain Adaptive FilterhFDAF = adaptfilt.fdaf(2048,mu,1,del,lam);[y,e] = filter(hFDAF,x,d);n = 1:length(e);t = n/fs;pos = get(gcf,'Position');set(gcf,'Position',[pos(1), pos(2)-100,pos(3),(pos(4)+85)])subplot(3,1,1);plot(t,v(n),'g') axis([0 33.5 -1 1]);ylabel('Amplitude');title('Near-End Speech Signal');subplot(3,1,2);plot(t,d(n),'b');axis([0 33.5 -1 1]);ylabel('Amplitude');title('Microphone Signal');subplot(3,1,3);plot(t,e(n),'r') axis([0 33.5 -1 1]);xlabel('Time [sec]');ylabel('Amplitude');title('Output of Acoustic Echo Canceller');set(gcf, 'Color', [1 1 1])p8 = audioplayer(e/max(abs(e)),fs);playblocking(p8);
10
11