# How do you define tail length for frequency domain acoustic echo cancellation algorithms?

Started by February 6, 2012
```For an NLMS time-domain algorithm, the tail length is defined as the
number of taps of the NLMS filter, right?

How is the tail-length defined if you are doing your NLMS in the
frequency domain by adjusting the amplitudes of a 128-point FFT?

```
```On Feb 7, 10:17=A0am, Mauritz Jameson <mjames2...@gmail.com> wrote:
> For an NLMS time-domain algorithm, the tail length is defined as the
> number of taps of the NLMS filter, right?
>
> How is the tail-length defined if you are doing your NLMS in the
> frequency domain by adjusting the amplitudes of a 128-point FFT?

Tail length? Do you mean filter order? You won't know what the order
is before hand. You have to suck and see unless you have
specific information available eg certain acoustic information about
delays etc.

Hardy
```
```I created the MATLAB script below to compare filtering in the time-
domain with filtering in the
frequency domain. Seeing how those two operations are related, if you
are calculating the FFT
of a speaker signal and adjusting the magnitude in each frequency bin
to obtain an estimate
of the echo signal, then it seems like you can't really tell what the
length of the
corresponding time-domain filter is? I'm probably missing something
very obvious here..so can
somebody explain to me how you define the max. tail length of a
frequency-domain based acoustic
echo canceller?

numberOfTaps = 128;
numberOfSamples = 64;
b = fir1(numberOfTaps,0.9);
x = randn(1,numberOfSamples);
filterInput = [x zeros(1,numberOfTaps)];
filterOutput = filter(b,1,filterInput);
figure
plot(filterOutput,'ko--')
NFFT = numberOfSamples + numberOfTaps;
MAGx = abs(fft(filterInput,NFFT));
PHAx = angle(fft(filterInput,NFFT));
filterTaps = [b zeros(1,numberOfSamples)];
MAGb = abs(fft(filterTaps,NFFT));
PHAb = angle(fft(filterTaps,NFFT));
filterOutput = real(ifft(MAGx.*MAGb.*exp(j.*(PHAb+PHAx)),NFFT));
hold on
plot(filterOutput,'rx--')
```
```On Feb 7, 8:45=A0am, Mauritz Jameson <mjames2...@gmail.com> wrote:
> I created the MATLAB script below to compare filtering in the time-
> domain with filtering in the
> frequency domain. Seeing how those two operations are related, if you
> are calculating the FFT
> of a speaker signal and adjusting the magnitude in each frequency bin
> to obtain an estimate
> of the echo signal, then it seems like you can't really tell what the
> length of the
> corresponding time-domain filter is? I'm probably missing something
> very obvious here..so can
> somebody explain to me how you define the max. tail length of a
> frequency-domain based acoustic
> echo canceller?
>
> numberOfTaps =3D 128;
> numberOfSamples =3D 64;
> b =3D fir1(numberOfTaps,0.9);
> x =3D randn(1,numberOfSamples);
> filterInput =3D [x zeros(1,numberOfTaps)];
> filterOutput =3D filter(b,1,filterInput);
> figure
> plot(filterOutput,'ko--')
> NFFT =3D numberOfSamples + numberOfTaps;
> MAGx =3D abs(fft(filterInput,NFFT));
> PHAx =3D angle(fft(filterInput,NFFT));
> filterTaps =3D [b zeros(1,numberOfSamples)];
> MAGb =3D abs(fft(filterTaps,NFFT));
> PHAb =3D angle(fft(filterTaps,NFFT));
> filterOutput =3D real(ifft(MAGx.*MAGb.*exp(j.*(PHAb+PHAx)),NFFT));
> hold on
> plot(filterOutput,'rx--')

Mauritz,
filter (FDAF) implementations really are not equivalent. The FDAF
operates on blocks of data, not on lengths of data. The closest
parallel would be the block LMS (BLMS) implementation.

What I think is interesting is that Widrow doesn't address the FDAF in
his Adaptive Signal Processing book (although he did address it in his
early papers), neither does Compton in his Adaptive Antennas book, nor
Haykin in his Adaptive Filter Theory book.

Clarkson does a good job of analysing the FDAF in his Optimal and

I think you will find most information in journal papers written on
the FDAF. You can try
. Dentino,et al, "Adaptive Filtering in the Frequency Domain",
Proc. IEEE vol 66