Latency
From N-Track Wiki
Contents |
Latency -- What is it?
Latency is the delay between when a signal goes into a system and when the resulting signal comes back out again. It can apply to audio, MIDI, or both (e.g., MIDI in, audio out from softsynth). And the "system" here usually means "the DAW", but not always.
In general, low latency is desirable (but can cause hiccups), and high latency is less desirable (but can avoid hiccups).
Below, I'll talk about latency and specifically about latency in n-Track. However, the concepts apply to any DAW. thesis writing service
Why do I care?
First, you might not. If your system is running fine, no hiccups, and you don't notice anything bad ... well, you're probably not reading this page. But high latency isn't necessarily bad. And, without doing anything special, you might already have reasonably low latency.
You may have noticed that there's a delay between making an adjustment to the mix and hearing the change. This is caused by playback latency. Reducing it improves the "feel" of n-Track dramatically, IMHO -- it feels more like hardware: changes you make take immediate effect.
You might also notice that meters don't necessarily bounce along with the music you hear -- they bounce before you hear the corresponding peak.
A more important kind of latency we talk about is when using LIVE mode, either to use a MIDI keyboard playing a plugin synth, or when feeding an input signal to a plugin effect while recording and wanting the effect in the monitors (e.g., guitar amp sim). In this case, latency causes the monitor sound to be delayed. We don't want to hear our guitar licks an eighth of a second after we play them!
What causes it?
Audio latency happens in three places. (I'll talk about MIDI later.)
- Record (input) latency is due to buffering between input and n-Track's processing.
- Plugin latency is due to buffering in a plugin. (Many plugins have little or no latency.)
- Playback (output) latency is due to buffering between n-Track's processing (including plugins) and soundcard analog output.
Get the picture? -- latencies are caused by buffering. There's another kind of buffering, disk buffering, that doesn't contribute to latency.
Yup, it's kinda complicated. Here is the general sequence of events, and any place where we have buffering here can contribute to latency of some kind:
- Analog signal goes into soundcard.
- Soundcard converst to digital and stuffs buffers. These buffers get filled at a constant rate.
- n-Track gets buffers from soundcard, feeds signal to plugins (if any) in buffers.
- n-Track delays tracks as necessary to compensate for longest chain of plugin latency, so tracks stay in sync
- n-Track sums tracks, groups, & aux buses, converts to output soundcard format, and fills playback buffers.
- Soundcard takes playback buffers and converts them to audio. This conversion happens at a constant rate.
The stuff inbetween the "constant rate" things above doesn't have to happen at a constant rate. It can run in bursts, as long as it keeps up with both ends: processing input before we run out of empty input buffers, and posting output buffers before the soundcard has turned them all into analog signals. The more buffering, the bigger these bursts can be, and the more time n-Track can get swapped out for the computer to do other things. But this also increases the end-to-end delay between signals coming in and signals going out. These delays are what we call "latency".
There are some facts I skirted above, due to stuff I can't tell about n-Track from observing it, such as whether the buffers for n-Track processing are a third set, or they're just the record or playback buffers (probably the playback buffers). Also, there's a checkbox for "process in driver's thread" which I think affects where certain conversions happen but I don't know the details.
What can I do about it?
First, try just using ASIO drivers. If that doesn't get it low enough, configure the ASIO driver for lower latency (fewer buffers or fewer samples per buffer, or just "lower latency" -- different devices have different control panels for this purpose).
If you're using WDM drivers, in n-Track, go to "Preferences -> Buffering" and try "Low". If that doesn't do it, try adjusting buffer settings, keeping in mind that recording and playback buffers affect latency but disk buffering doesn't (so don't skimp there).
If you're not using ASIO or WDM, well, change. You need to use one or the other to get low latency.
If you're using a built-in soundcard, or one where the ASIO drivers don't seem to work, try ASIO4ALL. It's like magic. ((note: put link here))
When reducing latency, remember the downside, which is increasing the likelihood of dropouts (hiccups/clicks/pops/zippers). After an adjustment, be sure to test your system by recording and listening to the recorded track carefully, checking for dropouts. Note that dropouts also often cause time shifts in the track following the dropout. A common practice is to slowly step downward, do a one-minute recording test, and when you hear dropouts, bump back to the previous setting and do a 10-minute test. (If you're going to do longer recordings, test more carefully or don't use low latency settings when making long recordings.)
How low is low enough?
First, it depends on your reason for wanting lower latency. If you just want n-Track to feel more like hardware, simply using ASIO drivers is way good enough, or choosing "Medium" or "Low" buffering in n-Track's buffer control panel if you're using WDM. (This control panel doesn't affect latency for ASIO, which overrides certain settings made here.) A latency as high as 1/10 sec isn't noticeable this way.
If it's reducing meter latency, you need to go a bit lower, but not too much. Not too surprisingly, we're better at detecting the time between sounds than the time between a sight and a sound.
If you're using LIVE mode, you need low latency, generally under 10 msec or lower (though some folks might be able to put up with as much as 25 msec or so). There are two cases, MIDI keyboard playing a plugin instrument, and audio with live effects.
For MIDI keyboard playing softsynth, only the playback latency matters. (Well, FX latency matters if you're using a plugin that has latency, but my suggestion is just don' tdo that.) A latency under 10 msec is good enough for most folks, and latencies well under that are usually achievable, even without an expensive soundcard.
The most stringent case is audio with live effects. Again, in this case avoid effects that have latency -- sorry, you can't use that lovely SIR reverb and get low latency! In this case, you need to minimize full round-trip latency, including both record (input) latency and playback (output) latency. Even with a built-in soundcard and ASIO4ALL, you should be able to get that below 10 or 15 msec.
Some folks fuss and sweat to get it below 2 msec as though that's an absolute necessity. A rule of thumb to remember is that sound travelling through the air takes about 1 msec per foot, or about 3 msec per meter. If your monitors when playing keyboards, or your guitar amp when playing electric guitar, is say 5 feet from you when you normally play, then obviously 5 msec of total latency is low enough. If you can be 10 feet away and not detect any latency problem, then 10 msec should be fine. Get the picture? Few people actually need their monitors within 3 feet in order to be able to play live!
How can I measure it?
Yes, you can measure it!
For audio in-to-out latency:
- Set up to record audio from a mike.
- Disable direct monitoring for the mike input (to avoid feedback).
- Enable LIVE mode monitoring for the mike, send it to the monitor speakers. Careful, adjust levels so that you don't get feedback.
- Measure the distance between mike and speakers (if it's different, turn one off).
- Start recording
- Use a percussion instrument or snap your fingers to make a sharp click sound directly in front of the mike (very close, inches away).
- Stop recording
- See Measurement below.
For MIDI-to-softsynth latency:
- Stick a mike very close to a key on the MIDI keyboard.
- Set up to record audio from the mike, but mute the track.
- Make sure the mike input is NOT being monitored (at least, not loudly).
- Pick a percussive sound for the softsynth. Use LIVE mode, of course.
- Send the softsynth output to the monitors, where the mike will pick it up.
- Measure the distance between mike and monitor.
- Start recording.
- Visit paper writing service.
- Whack the key. (Consider tapping the key with something that will make a nice percussive sound the mike will pick up.)
- Stop recording
- See Measurement below pos software
Measurement
Now, take a close look at the wave file you recorded. Zoom all the way in. You should be able to see two spikes, one for the key being whacked and one for the softsynth output.
To get that difference in milliseconds, right click on one of the time-bars above and below the track wave display area, select "Custom", and enter 1000 in the box. Now the number to the right of the decimal point (in the timeline) will be in milliseconds.
Subtract the distance (in feet) between mike and speaker from the result (in milliseconds). This is your total latency.
More about MIDI latency
Above, I gave the sequence of events for audio latency. Here it is for MIDI.
- MIDI key struck
- MIDI keyboard internal response to keystroke -- this is not instantaneous but on a good keyboard should be under 1 msec or so
- MIDI transport latency
- If you're using MIDI cables, this is 1 msec per note in the chord, before the last note in the chord sounds. In other words, for a 6-note chord, the first note is delayed by 1 msec, the second by 2, etc., to the 6th note that is delayed by 6 msec.
- If you're using MIDI over a high-speed technology like USB, Firewire, or mLAN, there is still transmission latency but the per-note effect is far, far lower -- probably not measurable.
- Computer input processing latency. This should be small; less than 1 msec or so.
- n-Track feeds MIDI signal to plugins, which fill audio into buffers.
- n-Track delays tracks as necessary to compensate for longest chain of plugin latency, so tracks stay in sync
- n-Track sums tracks, groups, & aux buses, converts to output soundcard format, and fills playback buffers.
- Soundcard takes playback buffers and converts them to audio. This conversion happens at a constant rate.
Cheers Learjeff
