May 19, 2006

Repairing Gaps in Audio Recordings  [ Edit ] 

>> Update 10/19/06 - After trying out the beta version of Amadeus Pro, the upcoming replacement for Amadeus II, I was pointed to the Interpolate feature which makes pretty much this entire article moot. This feature exists in Amadeus II as well, in the Effects menu. Just select your messed up bit of audio, select Interpolate (or Interpolate Selection), and you’re done. I’ll leave this “hard way” explanation for now, but really you should be using Interpolate instead.

Recording isn’t a perfect process. Sometimes there will be glitches in your recordings, who knows why. I was recently working on my first album mixing project, and the sax player in the group caught a section where his solo had a funny stutter. I thought maybe I had messed up the audio, but looking at it, there were four tracks with a little digital gap in them, less than a tenth of a second, but certainly audible.

The following is the process I used to fix the gaps. There probably are better ways, but this was good enough for our purposes. I had to fix a saxophone track, two guitar tracks, and one bass track, all with a gap in the same place in time. The bass and the guitar were pretty easy to fix (this example uses one of the guitar tracks), but the saxophone was pretty difficult. This technique relies on finding a similar section of audio to the one that’s missing. With clean electric guitar and acoustic bass, where the range of timbres is not too large, finding a similar section isn’t hard. With a saxophone, the timbre changes pretty dramatically with different volumes and articulations, so finding a section that matches not only in pitch, but in timbre, was challenging.

The gaps in our recording occured in the middle of a note for each instrument, thankfully. If I had lost the attack of a note, it would have been much more difficult to fix.

Before we begin, here’s an audio example of the guitar track before repair, and after repair. The gap makes the guitar sound like its doubling the note, or stuttering.

Right, now the steps to follow. You’ll need an audio editor of some sort. I use Logic Express for my recording projects, but its internal audio editor is not very powerful for edits like this, so I use the excellent Amadeus II from Martin Hairer.

  1. Always work on a copy. You don’t want to accidentally make your original recording worse, so make a copy of the track of interest and mess with that.
  2. Zoom in on the problem area. You’ll see an area that “flatlines” in the middle of an otherwise normal looking section of audio. Here’s what mine looked like: The problem area
  3. Select an area slightly larger than the problem area, snapping your selection to the zero crossings. In Amadeus, you can’t just snap a selection to the zero crossings, but after you make a selection, Amadeus can extend your selection to the nearest crossings on either side. The following images show how it looks — move your cursor over the image to see the selection snapped to the zero crossings. If that doesn’t work, click the image to see the two selections side-by-side. The selected area
  4. Now that you have your selection, note its length in time (Amadeus II displays this below the window’s title bar on the right side) and set markers on it. You’re going to have to select a new section of audio, so you need to know how much audio to select, and you’ll need to be able to re-select the same problem area. In Amadeus II, the command is Selection > Mark Selection…
  5. Select and copy a similar section of audio that’s exactly the same length as the area you marked. Use the shape of the waveform to guide your selection, and again snap to the zero crossings. This image illustrates what I mean (click to see it larger): The original area marked, and the new selection The beginning and end of the selected area meet the waveform in very similar looking spots to the original area with the gap. This is important to make sure the repair will sound okay. The missing area wouldn’t have been identical to this selection, but it’s close enough for a short section of audio in a larger mix.
  6. Return to your original marked area and reselect it. In Amadeus II, just click somewhere between your markers, and choose Selection > Extend to Previous Marker and Extend to Next Marker.
  7. Before you paste the new section over the problem area, remove all sound from the selection. In Amadeus, do this with the Effects > Generate Silence command. If you don’t remove the silence, your pasted audio might be added to the original instead of replacing it. Different editors work differently, so this is just a precaution, but it’s worth taking.
  8. In Amadeus II, choose Edit > Paste Over. This pastes the audio over the selected area without changing the length of the overall audio file. If you don’t do this and use the regular paste command, you stand a chance of making your audio file shorter or longer if you new selection is at all different in length from your original. Unless the track you’re working on is the only one in a mix, this is essential to make sure all your tracks will line up in the mix easily.
  9. Listen to the results, see if they work. I didn’t always get this on the first try, but it didn’t take too terribly long to get it sounding good enough. The most common problem I’d anticipate is the sections of audio being of different lengths, causing a bit of buzz either at the beginning or end of the selection, or both. As I mentioned before, the timbres of the sections might also be different, causing a slightly jarring change for that brief moment.

Here’s what the audio looks like in the window before and after repair. Click to see the before and after versions side-by-side, or just move your mouse over the image.

The problem area

One final note: I don’t know how to swap one audio region, in place, for another one in Logic Express. So I just deleted the old region and imported the new one into the same place in time. Here’s how I did it:

  1. Zoom way in on the beginning of the audio region. Logic snaps regions to time divisions based on how far in you’re zoomed — to be precise, zoom in good and tight.
  2. Click and hold the region you’re going to delete, bringing up the Help Tag that shows you where the region is currently positioned. Note that time, then delete the region. In my case, it was easy to do this before all my audio regions started at exactly the same time. If I forgot it, I could just check one of the other ones.
  3. Drag the audio file from the Finder into the track. Drag it into position using the Help Tag to assist you.

If there’s a better way to do any of this using the tools I have available, I’d like to know what it is. This process isn’t something I hope to go through often, but it’s useful to know how to do when you do encounter little problems like this.

Posted by Joe
Post a comment

Remember personal info?