How to Compensate for Interface Latency

From CockosWiki

Jump to: navigation, search

Main Page > REAPER Documentation > Tips & Tricks

(Taken from an excellent forum post by Lokasenna and incorporating ideas from the subsequent discussion)

Latency is the time it takes for a signal to open the door, come in, take of its jacket and boots, and sit down in REAPER's living room for a chat. Most equipment in your recording chain, especially analog (non-digital) stuff, won't add a noticeable amount of delay. However, digital things often will, and your computer's audio interface will typically add a fair bit.

Depending on how powerful your PC is, "a fair bit" can mean anything from 5ms (well below what most people can distinguish, but still enough to drive hardcore studio nerds insane) to 500ms (1/2 a second -- "Jesus, this drummer is horrible"). You may have noticed this if you've ever used guitar software like Amplitube, Guitar Rig, Revalver, or any of the sexy free plugins floating around the internet. That weird half-second between hitting a chord and hearing it through the speakers? That's latency, and that's what we're about to fix.

Well, sort of.

The first thing to do is minimize the latency you have to deal with by adjusting your interface's (your soundcard's) settings, particularly the buffer size. Buffer size refers to the size of each bundle of information that gets sent to REAPER by your soundcard. A smaller buffer means REAPER will receive incoming audio faster, but it will also put more of a strain on your computer. Conversely, a larger buffer is easier on the PC, but will make REAPER wait around longer until each bundle is full.

The rule of thumb here is that you want the buffer size as small as possible without causing any hiccups, glitches, or stutters in the audio signal. Trust me, if it's too small, you'll hear it.

We should now have a reasonably quick signal path going into REAPER. If you plug in a guitar, whatever you play should be coming right back out of the speakers with a minimum of fuss. When you play a chord you should hear it out of the speakers without too much delay. (If the delay is still horrible, if your system simply can't handle a low latency, your best bet is to monitor through a real guitar amp while recording a direct signal into the computer, and then put it through Guitar Rig afterward).

Go ahead and record something simple, a basic rock beat, the riff to "Smoke On The Water", whatever - something easy. Record it to a click, as tight as you can. Now have a look at what you've recorded. Chances are it's not as tight as you thought it was. In fact, if you haven't already spent some time dealing with latency, I'd bet good money that the signal is significantly off from the click.

The second step to do is tell REAPER what size the fixed latency delay is, on your system. REAPER can then make automatic corrections by time shifting each new recorded item so recordings are in exact sync with previously recorded tracks. The "Use reported latency" option (see below) will use a value reported by the driver software. Or, and more accurately, you can enter a manual correction. Both options do the same thing. The newly recorded material is shifted backwards by this time interval after recording; this exactly corrects for the delay that was present when the recording was being captured. More on this later though.

Time for a picture.

Click Track Recordings: Track 1 direct, 2 through interface, 3 interface and speaker, 4 interface, speaker and distance to chair. Then compensated using: 5 latency reported by interface, 6 measured latency (Track 2), 7 measured latency + latency added by distance to chair from speaker

I can hear people asking: "What the hell am I looking at?" The tracks on this project are all recordings of a standard click track, the first is a direct recording the second is goes through the interface first - etc, read on.

Simply put, this is how you deal with interface latency.

First -- When doing performing the tests described below, set the track's Record Monitoring to OFF, or you could quite easily mess up your speakers with feedback. I take no responsibility for any inadvertent damage.

The first track, labelled "Source", is a simple click (In Reaper, Insert | Click Source). This is the most accurate signal to use for examining your latency, since it's all tidy and perfect.

Track two, "Interface", demonstrates the latency my interface is adding. To measure this, I simply ran a patch cable from the interface's output to the input, played back the click source, and recorded it coming back in. As you can see, the signal is significantly late. Exactly how much is a question we'll get to in a moment, but I'm not quite done here.

Just for fun, I wanted to see if there was a notable delay being added by the speakers and/or the two feet of space between my ear and the speaker. "Speaker" was recorded with a microphone against one of my monitors, and as you can see it did add a tiny amount of latency. However, the difference is so small that it might as well not exist. "Chair", recorded through a microphone placed beside my head, shows a bit more added time - but anyone with some basic physics already knew that.

The speed of sound, in air, is 1100ft/s. As my head is in the ballpark of two feet from the speaker, the signal should take an extra 1.8ms to get to me. Guess what? It does. Now, in the grand scheme of things 1.8ms doesn't make a bit of difference. Nobody, anywhere, ever, is capable of noticing 1.8ms of delay. At least, not by itself. But, as a guitarist, 1.8ms is enough to annoy me. Why? Simple: Doubling.

Pretty much anyone playing hard rock or metal these days will double (or quadruple) their guitar tracks. That's just how you get that big huge guitar sound we hear everywhere. In most cases, guitarists want their doubled tracks to be as tight (played in sync) as possible. The farther apart the two tracks are, the sloppier the sound. A little sloppiness might be fine for AC/DC and the Stones, but with today's ultra-perfect, ridiculously fast technical metal, the bottom line is all about inhuman precision. Given how simple it is to fix, I'd just as soon not have an extra 1.8ms lurking in the shadows of my mixes, tempting me to poke around and clean it up.

That's all just my opinion, however, and in most cases fixing the interface latency alone will be enough to keep you happy.

So, having discovered this evil delay in our signal, how do we fix it? Thankfully, the companies who manufacture interfaces are one step ahead of us. Most interfaces can make an educated guess as to how much latency they're adding and pass it along for Reaper to work with.

Here's where you want to look:

Setting latency compensation in Preferences

Checking off "Use audio driver reported latency" will have Reaper move all of your recordings back by whatever amount the interface says. But does it work? Have a look at the fifth track, "Interface, Reported Latency". In this case the interface is clearly trying to do the right thing, but is nowhere near the right number.

Every interface is different. Some might be spot-on with their guess, others might be worse than mine. If this option works for you, that's awesome.

It looks like we'll have to solve this problem ourselves. In order to get a measurement of our latency, as accurate as possible, here's what we'll do:

1. On Reaper's toolbar, turn off Snap To Grid (the magnet icon). 2. Right-click the Transport bar and tell Reaper to give use Samples as a time base. (A sample is one digital "tick" of audio information, and is the most precise unit of measurement you can use) 3. Zoom in nice and close, so the original and delayed clicks cover most of the screen. 4. Very carefully, drag a time selection from the start of the original to the start of the delayed signal.

Your screen should resemble this:

Measuring recorded latency in samples using the REAPER transport

On the Transport bar, the third Selection box tells us how long our selection is. In this case, with "Chair" as our target, the delay is 2160 samples.

Back in the Preferences menu, next to the option to use our reported latency, are a few boxes that let us do the same thing manually. Unchecking "Use reported latency" and entering your own measurement under Input | Samples will tell Reaper to ignore the interface, and just move everything back by whatever you tell it to.

Looking back at our first image, the final two tracks show the same tests as above, but now compensated for their respective delays.

Main Page > REAPER Documentation > Tips & Tricks

Personal tools