| Purpose |
| Simulation of an acoustic echo canceler application using a transversal adaptive filter updated according to the Block Frequency Domain Adaptive Filter (BFDAF) algorithm. |
| Syntax |
echo_bfdaf
|
| Description |
The block diagram of the acoustic echo cancellation problem is shown in
Fig. 10.27. 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 BFDAF algorithm. The far-end speech signal
init_bfdaf(),
and the input signals are read from files, then a processing loop is started.
In each iteration of the loop asptbfdaf() 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
|
| Code |
clear all; infile = '.\wavin\aecfes.wav'; % Far-end speech (FES) dfile = '.\wavin\aecnes.wav'; % Near-end speech (NES) rfile = '.\wavout\resbfdaf.wav'; % residual signal M = 512; % adaptive filter length L = M; % block length mu = 0.02/L; % adaptation constant b = 0.99; % autoregressive pole [W,x,dn,e,y,Px,w]=init_bfdaf(L,M); % Init BFDAF [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,y,e,Px,w]=asptbfdaf(M,x,xn,dn,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 |
Running the above script will produce the graph shown in Fig. 10.28.
The top panel in Fig. 10.28 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
|
| Audio Files |
The following files demonstrate the performance of the BFDAF algorithm in the echo canceler application mentioned above.
|
| See Also |
| INIT_ BFDAF, ASPTBFDAF, ECHO_ NLMS, ECHO_ PBFDAF. |
| Reference |
| [3], Chapter 3 for detailed description of BFDAF, [8] for the overlap-save method, and [9] for frequency domain adaptive filters. |