next up previous contents
Next: 18 echo_ rcpbfdaf Up: 10 Applications and Examples Previous: 16 echo_ nlms   Contents


17 echo_ pbfdaf

Purpose
Simulation of an acoustic echo canceler application using a transversal adaptive filter updated according to the Partitioned Block Frequency Domain Adaptive Filter (PBFDAF).

Syntax
echo_pbfdaf



Description
Figure 10.33: Block diagram of an acoustic echo canceler implemented using the Partitioned Block Frequency Domain Adaptive Filter (PBFDAF).
The block diagram of the acoustic echo cancellation problem is shown in Fig. 10.33. The simulation considered here uses a transversal FIR filter for the adjustable filter and the coefficients of the filter are updated in the frequency domain using the PBFDAF algorithm. The filter is divided into $P$ partitions, each of $M$ coefficients, which results in a filter of length $PM$ coefficients in total. The block length is chosen to be $L = M$ so that the processing delay is $P$ times shorter than that introduced by a BFDAF filter of the same length. The far-end speech signal $x(n)$ (the speech from the remote speaker) is stored in the file infile. The local speaker is assumed to be silent (listening to the remote speaker and not interrupting). The echo picked by the microphone when playing $x(n)$ through the local loudspeaker is stored in the file dfile. First the variables for the echo canceler $W(f)$ are created and initialized using init_pbfdaf(), and the input signals are read from files, then a processing loop is started. In each iteration of the loop asptpbfdaf() is called with a new block of samples from the FES and a new block of samples from the NES signals to calculate the filter output block (estimated echo) and update the filter coefficients. The residual signal $e(n)$ is saved in each iteration for later examination. This simulation script uses the standard ASPT iteration progress window (IPWIN). The IPWIN has four buttons which allow you to stop and continue the simulation, show or hide the simulation graph window, break out of the processing loop, and quit the simulation. After processing all the samples, or on pressing the break or stop buttons, the sensor signal $e(n)$ is written to a wave audio file and a graph presenting the echo canceler performance is generated.


\epsfig{file=/home/john/winD/docs/aspt/aspt/figs/aecpbfdaf.eps,width=\textwidth}

Code

clear all;
infile = '.\wavin\aecfes.wav';           % Far-end speech (FES)
dfile  = '.\wavin\aecnes.wav';           % Near-end speech (NES)
rfile  = '.\wavout\respbfdaf.wav';       % residual signal
P      = 4;                              % number of partitions
M      = 128;                            % adaptive filter length 
L      = M;                              % block length
mu     = 0.01/L;                         % adaptation constant
b      = 0.99;                           % autoregressive pole 

[W,x,d,e,y,Px,X,w] = init_pbfdaf(L,M,P); % Init PBFDAF				
[xt,inFs,inBits]   = wavread(infile);    % read FES
[dt,inFs,dBits]    = wavread(dfile);     % read NES
inSize     = max(length(xt),length(dt)); % Samples to process
res                = dt;                 % Residual array
E                  = init_ipwin(inSize); % Initialize IPWIN

%% Processing Loop
for (m=1:L:inSize-L)
   % Read and scale a block from FES 
   xn = 2^(inBits-1) * xt(m+1:m+L,:);

   % Read and scale a block from NES
   dn = 2^(dBits-1) * dt(m+1:m+L,:); 

   % Update the adaptive filter
   [W,X,x,y,e,Px,w]=asptpbfdaf(M,x,xn,dn,X,W,mu,1,1,b,Px);
		 
   % Scale and store the error (residual)  
   res(m+1:m+L) = 2^-(dBits-1)* e;

   % update the iteration progress window									  
   [E, stop,brk]	= update_ipwin(E,e,dn,'e',w,dt,res);

   % handle the Stop button
   while (stop  ~= 0), stop 	= getStop; end;

   % handle the Break button				
   if (brk), plot_echo(w,dt,res); break; end;			
end;

wavwrite(res,inFs,inBits,rfile);    % Save the residual
plot_echo(w, dfile, rfile);         % Show results 



Results
Figure 10.34: Performance of an Acoustic Echo Canceler implemented using the PBFDAF algorithm.
Running the above script will produce the graph shown in Fig. 10.34. The top panel in Fig. 10.34 shows the values taken by the filter coefficients by the end of the simulation (end of input files). The middle panel show the waveforms of the near-end speech signal $d(n)$ and the residual signal $e(n)$ for visual comparison between the echo before and after applying the echo canceler. The bottom panel shows the echo energy decrease in dB achieved by the echo canceler versus time, usually known as the Echo Return Loss Enhancement (ERLE). Note that the ERLE is meaningful only in the time periods where there is echo to be canceled.


\epsfig{file=/home/john/winD/docs/aspt/aspt/figs/echopbfdaf.eps,width=\textwidth}


Audio Files
The following files demonstrate the performance of the PBFDAF algorithm in the echo canceler application mentioned above.
wavin.wav far-end speech (input) signal.
wavin.wav near-end speech (microphone) signal.
wavout.wav residual signal (echo canceler output).

See Also
INIT_ PBFDAF, ASPTPBFDAF, ASPTRCPBFDAF, ECHO_ NLMS, ECHO_ BFDAF.

Reference
[1] and [9] for detailed description of frequency domain adaptive filters.


next up previous contents
Next: 18 echo_ rcpbfdaf Up: 10 Applications and Examples Previous: 16 echo_ nlms   Contents