5
$\begingroup$

I have an audio recording where something went wrong and a copy of the audio was added with a few milliseconds delay. What technique can I use to remove that echo?

Here's a short snippet to explain: https://voca.ro/1fshI5WOr6oe

The echo occurred because the recording software (Jitsi) recorded both the browser tab's audio and the Jitsi audio stream.

$\endgroup$
2
  • 2
    $\begingroup$ Can you add as many details as possible how exactly that echo happened? Is it a software issue, is it something that happened acoustically or in the hardware ? $\endgroup$
    – Hilmar
    Sep 18, 2022 at 13:26
  • $\begingroup$ @Hilmar thanks for the suggestion, updated the question. $\endgroup$ Sep 18, 2022 at 18:03

2 Answers 2

7
$\begingroup$

That's a difficult problem. This appears to be a single delay of $N=5325$ samples. The transfer function of this filter would be

$$H(z) = 1+z^{-N}$$

The inverse is simply

$$G(z) = \frac{1}{1+z^{-N}}$$

That's a pretty horrible filter that's only marginally stable with N poles on the unit circle. We can tame it down a by putting a gain $g < 1$ in the feedback path.

$$G(z) = \frac{1}{1+gz^{-N}}$$

and play around with the gain. Below is an example with $g = 0.9$. It does get rid of most of the echo but induces a whole other slew of horrible artifacts. The transfer function of the inverse is an "inverse comb filter" with A LOT of narrow high Q peaks with large amplitudes.

You are probably better off by manually subtracting out a delayed version of the audio signal at spots where the echo and the new speech don't overlap too much.

enter image description here

$\endgroup$
3
$\begingroup$

If the signal of interest and the echo (n samples after) are identical, then you could subtract out an inverted copy of the entire signal, delayed by n samples, giving a new audio file which has the signal of interest + an inverted echo 2n samples after. Then you can subtract out a copy of the original audio delayed by 2n samples, resulting in the signal of interest + an echo 3n samples after. Repeat this enough times (not manually, I hope!) and you will have moved the delayed signal entirely past the signal of interest, where it can be cut off entirely.

One way to automate this would be to use a "delay" or "echo" plugin in a conventional audio editor. Use this plugin to create an echo with no volume decay (infinite echo) and time 2n samples. This is half of all the delays you need. To get the other half, duplicate this signal, invert it, and delay it by n samples. Sum these 2 channels together and you're golden.

Now, If your signal of interest and echo aren't identical (e.g. because you recorded to an mp3 file), then you will only get partial cancellation, and this method will leave a noisy signal.

$\endgroup$
4
  • $\begingroup$ That's a nice suggestion, but wouldn't it be just easier to subtract the original signal and be left with only the delayed sound, which subsequently could subtract from the problematic audio file and be left with the original one? $\endgroup$
    – ZaellixA
    Sep 18, 2022 at 21:36
  • 4
    $\begingroup$ @ZaellixA I'm using "original audio" to mean the file we have now: the signal of interest with an echo. We don't have just the signal of interest, right? How would you subtract just the signal of interest, without also subtracting the echo, if you don't have it yet? $\endgroup$
    – Edward
    Sep 18, 2022 at 22:24
  • $\begingroup$ This seems like it should work well for uncompressed data if no resampling or other distortion has occurred in the echo. When I tried it on the mp3 sample provided, the small inaccuracies start accumulating and increasing very quickly towards the end of the audio. For longer samples it would be necessary to cut it in parts at points of silence. $\endgroup$
    – jpa
    Sep 19, 2022 at 11:41
  • 1
    $\begingroup$ @Edward I thought the OP has access to the original file (no echo), but then I never thought that if this was the case having the echo added wouldn't be an issue, since the original (no echo) file wouldn't had been lost. Now, in that case I don't think there's another ("straight forward") way to do it. Apologies for my stupid thought, it only helped confuse people. $\endgroup$
    – ZaellixA
    Sep 19, 2022 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.