Remove lagged second recording of same audio

Help for Audacity on macOS.
Forum rules
ImageThis forum is for Audacity on macOS 10.4 and later.
Please state which version of macOS you are using,
and the exact three-section version number of Audacity from "Audacity menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Post Reply
NewtonEuler
Posts: 2
Joined: Sat Feb 13, 2021 8:13 pm
Operating System: macOS 10.14 Mojave

Remove lagged second recording of same audio

Post by NewtonEuler » Sat Feb 13, 2021 8:27 pm

I have an audio file (one track I’m afraid) which has the same audio recorded twice with a short lag between them. This second source was recorded in error (and is identical to the first) and I’d like to strip it out. Is it possibly to programmatically (or even better automatically) duplicate the initial clean part before the second source starts, invert it, time-shift by the lag, then combine creating a new clean segment, and repeat until the end?

I know this is a long-shot and even if it is possible may be rather tedious... but I live in hope!

Many thanks in advance!

MacOS 10.4
Audacity 2.4.2

billw58
Forum Staff
Posts: 5600
Joined: Wed Aug 12, 2009 2:10 am
Operating System: macOS 10.15 Catalina or later

Re: Remove lagged second recording of same audio

Post by billw58 » Sun Feb 14, 2021 5:41 pm

NewtonEuler wrote:
Sat Feb 13, 2021 8:27 pm
Is it possibly to programmatically (or even better automatically) duplicate the initial clean part before the second source starts, invert it, time-shift by the lag, then combine creating a new clean segment, and repeat until the end?
Theoretically, yes. Do you know the exact offset (in samples) between the two recordings?

-- Bill

NewtonEuler
Posts: 2
Joined: Sat Feb 13, 2021 8:13 pm
Operating System: macOS 10.14 Mojave

Re: Remove lagged second recording of same audio

Post by NewtonEuler » Mon Feb 15, 2021 6:08 pm

Many thanks for your reply, Bill.

Yeah, I was hoping to infer this from the recording, but the difficulty is getting this exactly, which will be necessary to do the cancellation, right?

Do you think without this information it's a lost cause?

billw58
Forum Staff
Posts: 5600
Joined: Wed Aug 12, 2009 2:10 am
Operating System: macOS 10.15 Catalina or later

Re: Remove lagged second recording of same audio

Post by billw58 » Mon Feb 15, 2021 8:04 pm

You need to be accurate to the sample to get a perfect cancellation. I tried it. I knew that the second recording was offset exactly 1 minute, so it was easy to go through the steps you proposed. The result was successful. The second recording must also be exactly the same volume as the first recording.

You want to find the offset between the recordings, so finding any easily-identifiable sound that repeats is the goal.

In the first portion of the recording (without the overlap), find a loud percussive event. Zoom in and mark it with a label. Now try to find that event in the first overlap section. Mark it with a label. Select between the labels and note the length of the selection. Set the Selection toolbar to display "Start plus Length of selection" and to show hr:mm:ss + samples. Try using a selection of that length and see if it works. If you hear comb filtering then you're close - adjust the selection length 1 sample at a time until you get it perfect. If you get almost-perfect cancellation (no comb filtering and no audible delay) you may need to adjust the volume of the inverted track.

Good luck.

-- Bill
Last edited by billw58 on Mon Feb 15, 2021 11:39 pm, edited 1 time in total.
Reason: offset by 1 minute, not 1 second

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Remove lagged second recording of same audio

Post by steve » Mon Feb 15, 2021 11:25 pm

billw58 wrote:
Mon Feb 15, 2021 8:04 pm
I knew that the second recording was offset exactly 1 second, so it was easy to go through the steps you proposed.
Doesn't that require that you have a "clean" recording to subtract from the mix?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

billw58
Forum Staff
Posts: 5600
Joined: Wed Aug 12, 2009 2:10 am
Operating System: macOS 10.15 Catalina or later

Re: Remove lagged second recording of same audio

Post by billw58 » Mon Feb 15, 2021 11:38 pm

steve wrote:
Mon Feb 15, 2021 11:25 pm
billw58 wrote:
Mon Feb 15, 2021 8:04 pm
I knew that the second recording was offset exactly 1 second, so it was easy to go through the steps you proposed.
Doesn't that require that you have a "clean" recording to subtract from the mix?
Sorry, I meant 1 minute. I'll go back and edit my post,

The OP seems to have a recording that has a second, identical recording mixed into it starting some time after the start. As he pointed out (and I tried to replicate), you can clean up the recording in segments. Say you have 1 minute of clear recording at the start. Select that 1 minute, duplicate it to a new track, invert it and time shift it 1 minute. Mix and render. Now you have 2 minutes of clean recording. Select the newly-clean 1-minute portion starting at the 1 minute mark and repeat.

So I tried this by importing a song, duplicating it, time shifting the copy by exactly 1 minute then mixing the two tracks. With the above method I was able to recover the original recording.

-- Bill

Post Reply