# Echo removal from a chunk of PCM signal

I have implemented a paper regarding echo detection in real-time using MFCC coefficients. Now, I want to remove the echo from the mixed signal. Let me explain it as:

1. There are two signals, NearEnd signal (Signal Containing Echo) $$N$$ and Farend Signal (Original signal which causes echo when played) $$F$$
2. Echo is being detected in NearEnd Signal $$N$$. This signal also contains my voice.
3. Now if we want to remove the $$F$$ from $$N$$, is it simple like the addition of two PCM signals?

For example, If I want to mix two PCM signals, research papers show it can be done in multiple ways but the easiest way is :

$$M=A+B$$

Now, if I want to remove F from N, and we get a new echo-free signal $$S_{new}$$, then will it be like

$$S_{new} = N -F$$

• Hi! Before someone tries to write an answer: Have you had a course on "Signals and Systems" before, i.e. do you know what an "LTI system" is? Nov 11 '20 at 10:31
• Yeah, I have studied courses such as signal and systems and also Digitial Signal Processing and Image processing. I just need an opinion of an expert acoustic engineer to verify if it works in a simpler way as acoustic signals in real-time causes many issues and the main concern is to avoid FFT and over CPU computation. Nov 11 '20 at 10:36

Your $$S_{new}=N-F$$ requires that you know both $$N$$ and $$F$$.

But since $$N=F*R$$, with $$*$$ being convolution, and $$R$$ being the Room Impulse Response (RIR), you're solving the equivalent problem $$S_{new} = F*R-F = F*(R-\delta)$$, with $$\delta$$ being the delta dirac impulse or its discrete equivalent.

The hard part here is estimating $$R$$, which aligns nicely with your initial statement that you want to do echo detection in itself, not signal reconstruction. So, you're building a RIR estimator for itself, not for usage as part in an equalizer. That makes a lot of sense: Maybe a heuristic based on observing the MFCCs as they are, then "cleaning them up" in MFCC domain (simply nullifying things that shouldn't be there), then estimating a time-domain signal that would have these corrected MFCC signals, then using that as estimate $$\hat F(t)$$ for $$F(t)$$ and the received time-domain signal $$N$$ in a classical IR estimation algorithm, giving you a RIR estimate and thus an echo description.

Since convolution with the RIR is an LTI system, trying to do the estimation itself in MFCC domain feels like a bad idea – what is easy in time domain and linear frequency domain suddenly becomes hard: MFCC's are great if your system is not linear, but make working with linear systems harder!

If you insist on integrating MFCCs into your detection process, you could try to use them as measure of speech quality, and feed that knowledge back into an adaptive time domain filter.

Generally, if I only had MFCCs, I'd try to reconstruct a time-domain signal from that, and then apply the mature theory of impulse response estimation on that – there's plenty of results that achieve optimum performance under some given conditions, and if you have one of these, whatever else you could do can only be worse.

• Hi @Marcus thank you so much for taking out time to answer my question. I have implemented this paper: Echo Detection and Delay Estimation using a Pattern Recogntion Approach and Cepstral Correlation which is actually based on features correlation and pattern recognition. It's working amazingly in my scenario. Now in my case I have only 2 signals as N and F which are known to me. In that case knowing both signals and knowing that echo is present what should be the technique of removing echo i.e farend signal from near end signal. Nov 11 '20 at 10:59
• yes, and I proposed a method to do so. Nov 11 '20 at 11:44
• I have a chunk of real-time near-end audio of (21ms) say an array of shorts of length1024 and through mfcc technique, I have found the chunk of 21ms of the far-end signal of same. Now even knowing the exact chunks, should I have to estimate R (RIR) in my case? Also, I tried to reconstruct the time domain signal through mfcc but it wasn't the audio I was expecting and it's too complex. Nov 30 '20 at 9:55