Go Back   Cockos Incorporated Forums > REAPER Forums > newbieland

Reply
 
Thread Tools Display Modes
Old 12-22-2009, 05:20 PM   #1
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default How to deal with interface latency (delay/lag)

I just did a bit of experimenting to get my system set up, all nice and perfect, and I figured the information might benefit someone else.

What is latency? In the realm of digital recording, 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 ("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 you want to do is mess with your interface's settings, particularly the buffer size, in order to minimize the latency you have to deal with. Buffer size refers to the size of each bundle of information that gets sent to Reaper. 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 low as possible without causing any hiccups, glitches, or stutters in the audio signal. Trust me, if it's too low, 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. (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.

I think it's time for an illustration:

https://stash.reaper.fm/oldsb/745259/...sation%201.png

Edit: Big image, so I've changed it to a link.

I can hear people asking "What the hell am I looking at?" Simply put, this is how you deal with interface latency.

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:



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:



On the Transport bar, the third Selection box tells us how long our selection is. In my 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. Manual compensation has clearly done the trick, which means any further timing issues are now entirely my own fault as a musician.

I think it's time for a drink.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate

Last edited by Lokasenna; 12-29-2009 at 12:17 PM.
Lokasenna is offline   Reply With Quote
Old 12-22-2009, 06:23 PM   #2
d.bop
Human being with feelings
 
d.bop's Avatar
 
Join Date: Apr 2009
Location: Duluth, MN
Posts: 1,712
Default

Thank you so much for posting this! I'll be checking things out tonight for sure
__________________
Sleepy-Time DSP - @sleepytimedsp
d.bop is offline   Reply With Quote
Old 12-22-2009, 11:28 PM   #3
d.bop
Human being with feelings
 
d.bop's Avatar
 
Join Date: Apr 2009
Location: Duluth, MN
Posts: 1,712
Default

Well, I'm all fixed up now. My Firepod's reported latency was was still ahead by 96 samples. With manual compensation I had to adjust it by 900 samples.

I did things a little differently, though. Instead of recording an instrument to a click, I just inserted a click source then connected a main output to a line input on my interface and hit record. Also when measuring, I zoomed all the way in (until you see the individual samples) and made my selection.


After that, I realized I could have just used ReaInsert's Auto-Detect feature. Though, every time I clicked Auto-Detect, it would give me a different sample offset. It seems to bounce around 895 and 900 (900 was the offset that I measured manually.)



Now that I feel all nerdy () it's time to record!


Thanks again for posting about this. I've been meaning to adjust my latency, I just never got around to it until now.
__________________
Sleepy-Time DSP - @sleepytimedsp
d.bop is offline   Reply With Quote
Old 12-23-2009, 07:40 AM   #4
arbogast
Human being with feelings
 
arbogast's Avatar
 
Join Date: Jul 2007
Location: Norway
Posts: 1,164
Default

Yes thanks for posting. I'll do a similar test with my home setup when time permits. This could be really useful.
__________________
Needin' upgrades
arbogast is offline   Reply With Quote
Old 12-23-2009, 07:51 AM   #5
Ollie
Super Moderator (no feelings)
 
Ollie's Avatar
 
Join Date: Dec 2007
Location: On or near a dike
Posts: 9,834
Default

Great post! Bookmarked for linking when appropriate (and that's quite often!). Thank you!
Ollie is offline   Reply With Quote
Old 12-23-2009, 11:07 AM   #6
wallace
Human being with feelings
 
Join Date: Jan 2009
Location: UK
Posts: 594
Default

Awesome. Thank you for posting this. I just asked a latency related question in the Q&A Tips Tricks and howto Forum.
This covers what I asked and more!
Thanks again.
wallace is offline   Reply With Quote
Old 12-30-2009, 11:23 AM   #7
StepOne
Human being with feelings
 
StepOne's Avatar
 
Join Date: Jan 2008
Location: CA
Posts: 991
Default

Quote:
Originally Posted by Lokasenna View Post
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.
Shouldn't your audio interface automatically know and adjust the roundtrip latency? AFAIK, most do.

With the few interfaces I've used (EMU0404 USB, M-Audio Audiophile Firewire, Echo3G PCI), the latency is compensated for and the recorded "click" plays back perfectly in sync with the source click, no manual adjustments required.

Somewhat related: I tested a "prototype" audio interface for a company, and they apparently didn't know how to write audio drivers, the interface would not compensate for buffer latency after recording. So the recorded click would be off by a certain amount at 64 samples, and even more at 128 samples, quite ridiculous! They soonafter sent the interface through production, without fixing this issue (good thing it is an esoteric interface that isn't very popular). It makes a decent paperweight tho.
__________________
Damn it feels good to be a gangsta.
StepOne is offline   Reply With Quote
Old 12-30-2009, 12:28 PM   #8
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

In theory, yes, they should all adjust themselves. A lot of interfaces don't, though - my Tascam US-122, for instance. I think my 0404 PCI needed a bit of help there too, though not anywhere near as much.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 01-21-2010, 01:16 PM   #9
bString
Human being with feelings
 
Join Date: Jan 2010
Posts: 3
Default Awesome Latency Response from Lokasenna

Hey LokaSenna!! Now, THAT was a thread reply!!! Awesome info, insightful images and very easy to interpret!! Actually, last night - I installed ASIO4ALL - not installing it initially was my problem in the 1st place...

I now can record a 2nd, 3rd, 4th track, etc after recording my 1st (Drum Mach) Trk... Just now getting a bit familiar with REAPER and the effects, plug ins, etc.

Will post any other questions - but in the meantime - I'm excited to get home 2nite and get some sh*& done!!

Thx Again!
bString is offline   Reply With Quote
Old 04-16-2010, 07:10 AM   #10
tvpiano
Human being with feelings
 
Join Date: Apr 2010
Posts: 1
Default

LokaSenna,

Thank you for a valuable method to fix recording latency, I am using us-144 and having this problem for years, now it is all fixed.
tvpiano is offline   Reply With Quote
Old 04-16-2010, 10:24 AM   #11
brainwreck
Human being with feelings
 
Join Date: Jul 2006
Posts: 20,859
Default

in case you guys don't know, centrance ltu is accurate to half a millisecond. just something to keep in mind when testing, especially if your interface's latency seems to be inconsistent. doing a loopback test in reaper is more accurate, and it's not hard to set up.
__________________
It's time to take a stand against the synthesizer.
brainwreck is offline   Reply With Quote
Old 04-16-2010, 11:22 AM   #12
imMute
Human being with feelings
 
Join Date: May 2009
Location: Duluth, MN
Posts: 97
Default

One more note about "loopback testing". What you are testing there is BOTH the input and output latencies. To see why, we must first understand where this latency comes from: your first post was exactly right that it depends on the buffer size. That is the biggest and most easily changed source of latency.
You must remember that the same system is used on both the input and output sides of the ADDA conversion. Thus, if a loopback test shows 400 samples of latency, then the input latency is 200 samples and the output latency is 200 samples (assuming a perfectly symmetrical system, which rarely happens).
imMute is offline   Reply With Quote
Old 04-16-2010, 11:29 AM   #13
brainwreck
Human being with feelings
 
Join Date: Jul 2006
Posts: 20,859
Default

i might add that using the click source doesn't seem as accurate to me as recording the output of a tone generator and using that as the source. i was coming up 4 samples off when using the click source for loopback testing / setting manual offsets - i know that's not much, but we might as well do it right.
__________________
It's time to take a stand against the synthesizer.
brainwreck is offline   Reply With Quote
Old 05-14-2016, 03:19 PM   #14
animal other
Human being with feelings
 
Join Date: May 2016
Posts: 1
Default Help!

When I try to playback a recording, it sounds very heavily delayed. I might play some 1/8th notes and it plays back as an ocean of notes... Help! I'm going to bash my machine with a bat!
animal other is offline   Reply With Quote
Old 05-15-2016, 09:48 AM   #15
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Originally Posted by animal other View Post
When I try to playback a recording, it sounds very heavily delayed. I might play some 1/8th notes and it plays back as an ocean of notes... Help! I'm going to bash my machine with a bat!
Which audio interface are you using?
And what are your settings in Preferences -> Audio -> Device?
solger is offline   Reply With Quote
Old 06-11-2017, 10:05 AM   #16
Opcode 7
Human being with feelings
 
Join Date: Mar 2017
Posts: 79
Default

Quick question ya'll. From the click test, I determined my interfaces latency to be 767 samples.

I set this number in the Recording Settings -> "Output Manual Offset".

Do I need to put anything for "Input Manual Offset"? If so, how do I determine it?

It is my understanding that when this thread was made, there was only 1 setting which controlled both, now we have two! Yay!
Opcode 7 is offline   Reply With Quote
Old 06-19-2017, 03:38 PM   #17
Opcode 7
Human being with feelings
 
Join Date: Mar 2017
Posts: 79
Default

Bumpity! Does anyone know?
Opcode 7 is offline   Reply With Quote
Old 10-19-2017, 03:35 PM   #18
Tim Rideout
Human being with feelings
 
Tim Rideout's Avatar
 
Join Date: Jan 2013
Location: Montreal, Canada
Posts: 258
Default

Thanks so mush for this amazing post!

Here's another interesting question: this is all fine for audio - but what about when we introduce a MIDI situation? I have found when compensation for audio latency, it's a different situation for MIDI latency.

Is this maybe where the "input latency" adjustment comes in?

Does anyone have any thoughts on this?
__________________
---
www.TimRideout.com
Tim Rideout is offline   Reply With Quote
Old 01-09-2018, 04:31 PM   #19
Cosmic
Human being with feelings
 
Cosmic's Avatar
 
Join Date: Jul 2010
Location: Online
Posts: 4,896
Default

Aw man this thread needs to be bumped.

I just did this and to my shock and horror discovered I've been recording wonky the whole time

Respect to the OP
__________________
it aint worth a bop,if it dont got that pop
Cosmic is offline   Reply With Quote
Old 03-20-2019, 10:39 PM   #20
mrthnmn
Human being with feelings
 
Join Date: Mar 2019
Posts: 8
Default

The problem I seem to be having, compensating for latency, in tutu, is that I measure and adjust for the total latency as measured live against a click track, and every time I record, the latency has changed. Readjust and it changes again.

Reaper 5.971 on Ubuntu 16.04

- Bruce
mrthnmn is offline   Reply With Quote
Old 03-21-2019, 06:32 AM   #21
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Could be a weird interface, or even something weird on Linux (I can barely manage to get all of the ins and outs of my interface working on Ubuntu Studio, haven't even tried to deal with latency).
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 04-01-2019, 06:34 AM   #22
mrthnmn
Human being with feelings
 
Join Date: Mar 2019
Posts: 8
Default

It appears all my problems have been that I started with a new ("2nd gen") Focusrite interface and computers with no USB 3 ports. Buying a new Windows computer solved the problems there. I haven't tried a new Linux laptop but I'm sure it's the lack of USB 3 that's causing latency problems, no matter the OS.
mrthnmn is offline   Reply With Quote
Old 04-01-2019, 06:49 PM   #23
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,618
Default

Beautiful job on this Loka.... thankfully I don't need to change mine but someday... who knows... %^)
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva
hopi is offline   Reply With Quote
Old 08-05-2019, 05:42 AM   #24
nightoul
Human being with feelings
 
Join Date: May 2019
Posts: 2
Default

Hi there, this will perhaps be a silly question but why does the settings read 8 x 128 samples in here?

https://ibb.co/jzkN5Tj

I'm normally using ASIO driver but in this WaveOut window, the buffer size settings is different. Does it mean just 128 samples? What does the "8x" mean in this context? Thank you!
nightoul is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:14 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.