the truth about digital audio latency.pdf

14
3/11/13 9:28 PM PreSonus | Learn - The Truth About Digital Audio Latency Page 1 of 14 http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency The Truth About Digital Audio Latency LEARN By Wesley Elianna Smith In the audio world, “latency” is another word for “delay.” It’s the time it takes for the sound from the front-of-house speakers at an out- door festival to reach you on your picnic blan- ket. Or the time it takes for your finger to strike a piano key, for the key to move the hammer, for the hammer to strike the string, and for the sound to reach your ear. Your brain is wired so that it doesn’t notice if sounds are delayed 3 to 10 milliseconds (ms). Studies have shown that sound reflections in an acoustic space must be delayed by 20 to 30 ms before your brain will perceive them as separate. However, by around 12 to 15 ms (depend- ing on the listener), you will start to “feel” the effects of a delayed sig- nal. It is this amount of delay that we must battle constantly when recording and monitoring digitally. When Good Latency Goes Bad Roundtrip latency in digital-audio applications is the amount of time it takes for a signal (such as a singing voice or a face-melting guitar solo) to get from an analog input on an audio interface, through the analog- to-digital converters, into a DAW, back to the interface, and through the digital-to-analog converters to the analog outputs. Any significant amount of latency can negatively impact the performer’s ability to

Upload: nives-kurjak

Post on 18-Jul-2016

19 views

Category:

Documents


4 download

DESCRIPTION

digital audio and latency

TRANSCRIPT

Page 1: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 1 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

The Truth About Digital Audio Latency

LEARN

By Wesley Elianna Smith

In the audio world, “latency” is another wordfor “delay.” It’s the time it takes for the soundfrom the front-of-house speakers at an out-door festival to reach you on your picnic blan-ket. Or the time it takes for your finger tostrike a piano key, for the key to move thehammer, for the hammer to strike the string,and for the sound to reach your ear.

Your brain is wired so that it doesn’t notice if sounds are delayed 3 to10 milliseconds (ms). Studies have shown that sound reflections in anacoustic space must be delayed by 20 to 30 ms before your brain willperceive them as separate. However, by around 12 to 15 ms (depend-ing on the listener), you will start to “feel” the effects of a delayed sig-nal. It is this amount of delay that we must battle constantly whenrecording and monitoring digitally.

When Good Latency Goes Bad

Roundtrip latency in digital-audio applications is the amount of time ittakes for a signal (such as a singing voice or a face-melting guitar solo)to get from an analog input on an audio interface, through the analog-to-digital converters, into a DAW, back to the interface, and throughthe digital-to-analog converters to the analog outputs. Any significantamount of latency can negatively impact the performer’s ability to

Page 2: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 2 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

play along to a click track or beat — making it sound like they’re per-forming in an echoing tunnel (unless they have a way to monitorthemselves outside of the DAW application, such as a digital mixer orone of our AudioBox™ VSL-series interfaces).

What’s Producing the Delay: a Rogue’s Gallery

In practical terms, the amount of roundtrip latency you experience isdetermined by your audio interface’s A/D and D/A converters, its in-ternal device buffer, its driver buffer, and the buffer setting you haveselected in your digital audio workstation software (Mac®) or ControlPanel (Windows®).

Converters. Analog-to-digital converters in your interface transforman analog signal from a microphone or instrument into digital bitsand bytes. This is a ferociously complex process and takes a little morethan half a millisecond on average. On the other end of a long chainwe’re about to describe are the digital-to-analog converters thatchange the digital stream back into electrical impulses you can hearthrough a monitor speaker or headphones. Add another half-millisec-ond or so.

Page 3: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 3 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

Buffers. A buffer is a region of memory storage used to temporarilyhold data while it is being moved from one place to another. There arefour of these in the digital signal chain.

USB Bus Clock Front BufferASIO (Driver) Input BufferASIO (Driver) Output BufferUSB Clock Back Buffer

Each buffer contributes to the total delay present between the timeyou play that hot guitar solo and the time you hear it back in yourheadphones.

Fast Drivers and Slow Drivers

The biggest variable that contributes to how long this process willtake is driver performance.

Page 4: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 4 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

Studio One buffer setting.

In computing, a driver is acomputer program allowinghigher-level computer pro-grams to interact with ahardware device. For exam-ple, a printer requires a dri-ver to interact with yourcomputer. A driver typicallycommunicates with the de-vice through the computerbus or communications subsystem to which the hardware connects.Drivers are hardware-dependent and operating-system-specific.

One of the primary goals for engineers who design audio-interfacedrivers is to provide the best latency performance without sacrificingsystem stability.

Imagine that you’re playing an old, run-down piano and that there isa catch in the hammer action—so great a catch, in fact, that when youstrike a key, it takes three times longer than normal for the hammer tostrike the string. While you may still be able to play your favoriteChopin etude or Professor Longhair solo, the “feel” will be wrong be-cause you’ll have to compensate for the delayed hammer-strikes.

You will have a similar problem if the buffer-size setting is too largewhen you overdub a part while monitoring through your DAW.

Take a Couple Buffers and Call Us in the Morning

A buffer is designed to buy time for the processor; with the slack the

Page 5: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 5 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

buffer provides, the processor can handle more tasks. When the buffersize is too large, it’s delaying the data—adding latency—more than isnecessary for good computer performance.

But if the buffer size is too small, the processor has to work faster tokeep up, making it more vulnerable to overload, so your computer-recording environment becomes less stable.

Consider this scenario: You’re playing your favorite virtual instru-ment, trying to add one more pad part to a nearly finished song. All42 tracks are playing back, and all of them use plug-ins. And then ithappens: Your audio starts to distort, or you start hearing pops andclicks, or, worse, your DAW crashes because your CPU is overloaded.The 64-sample buffer size you have set, in conjunction with theamount of processing that your song requires, overtaxes your comput-er.

If you increase the buffer size, you can get the software crashing toprobably go away. But it’s not that simple.

The more that you increase the buffer size — for example, up to 128samples — the more you notice the latency when trying to play thatlast part. Singing or playing an instrument with the feel you want be-comes extremely difficult because you have essentially the same prob-lem as with that rickety piano’s delayed hammer-strikes. What youplay and what you hear back in your headphones or monitor speakersget further and further apart in time. Latency is in the way. Andyou’re in that echo-y tunnel again.

Let’s look at our piano example again, this time with a fully function-ing baby grand and not that antique piano in desperate need of repair.For simplicity’s sake, let’s pretend that there is no mechanical delay

Page 6: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 6 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

between the time your finger strikes the key and the hammer strikesthe string. Sound travels 340 meters/second. This means that if you’resitting one meter from the hammer, the sound will not reach your earsfor a little more than 3 ms. So why does 3 ms not bother you a bitwhen you’re playing your grand piano, but a buffer setting of 2.9 ms(128 samples at 44.1 kHz) in your DAW make it virtually impossiblefor you to monitor your guitar through your favorite guitar amp mod-eling plug-in?

Decoding Latency

As mentioned earlier, roundtrip latency is the amount of time it takesfor a signal (such as a guitar solo) to get from the analog input on anaudio interface, through the A/D converters, into a DAW, back to theinterface, and through the D/A converters to the analog outputs. Butyou can only control one of part of this chain: the input latency—thatis, the time it takes for an input signal such as your guitar solo tomake it to your DAW.

This is where driver performance enters the picture. There aretwo layers to any isochronous driver (used for both FireWireand USB interfaces). The second layer provides the buffer toCore Audio and ASIO applications like PreSonus StudioOneTM and other DAWs. This is the layer over which youhave control.

To make matters worse, you usually are not given this buffer-size setting as a time-based number (e.g., 2.9 ms); rather, youget a list of sample-based numbers from which to choose (say,

128 samples). This makes delay conversion more complicated. Andmost musicians would rather memorize the lyrics to every Rush song

Page 7: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 7 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

than remember that 512 samples equates to approximately 11 to 12 msat 44.1 kHz! (To calculate milliseconds from samples, simply dividethe amount of samples by the sample rate. For example, 512 sam-ples/44.1 kHz = 11.7 ms.)

The buffer size that you set in your DAW (Mac) or in your device’sControl Panel (Windows) determines both the input and the outputbuffer. If you set the buffer size to 128 samples, the input buffer andthe output buffer will each be 128 samples. At best, then, the latency istwice the amount you set. However, the best case isn’t always possibledue to the way audio data is transferred by the driver.

For example, if you set your ASIO buffer size to 128 samples, the out-put latency could be as high as 256 samples. In that case, the twobuffers combine to make the roundtrip latency 384 samples. Thismeans that the 2.9 ms of latency you set for your 44.1 kHz recordinghas become 8.7 ms.

The analog-to-digital and digital-to-analog converters in an audio in-terface also have latency, as do their buffers. This latency can rangefrom 0.2 to 1.5 ms, depending on the quality of the converters. An in-crease of 1 ms of latency isn’t going to affect the quality of anyone’sperformance. However, it does add to the total roundtrip latency. Forour 128-sample example setting, adding 0.5 ms for each converterbrings the roundtrip latency to 9.7 ms. But 9.7 ms is still below therealm of human perception, and it shouldn’t affect your performance.

So Where Does the Extra Delay Really Come From?

The culprit is that first mysterious audio-driver layer that no one everdiscusses. This lowest layer has no relationship to audio samples or

Page 8: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 8 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

sample rate. In the case of USB, it is a timer called the USB Bus clock.(There is a similar clock for FireWire processes but we will only dis-cuss the USB Bus clock here.)

The USB Bus clock is based on a one-millisecond timer. Atan interval of this timer, an interrupt occurs, triggering theaudio processing. The problem that most audio manufac-turers face is that without providing control over the low-

er-layer buffer, users cannot tune the driver to the computer as tightlyas they would like. The reason for not exposing this layer is simple:The user could set this buffer too low and crash the driver—a lot.

To get around this, most manufacturers fix this buffer at approximate-ly 6 milliseconds. Depending on the audio driver, this could be 6 msinput latency and 6 ms output latency. But like the ASIO buffer dis-cussed earlier, even if these buffer sizes are set to the same value, theresulting output latency can differ from the input latency.

For our example, let’s keep things simple and say that latency is 6 msin both directions. Our mystery is solved: With most audio interfaces,there is at least 12 ms of roundtrip latency built into the driver beforethe signal ever reaches your DAW, in addition to the 9.7 ms latencywe calculated earlier.

Thus, you set 2.9 ms of delay in your DAW and end up with 21.7 msof roundtrip latency. (All of the numbers in our examples are basedon averages. However, some manufacturers are able to optimize dri-ver performance to minimize these technical limitations.)

Overcoming the Problem

Many audio-interface manufacturers have solved the problem of mon-

Page 9: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 9 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

itoring latency through a DAW by providing zero-latency monitoringsolutions onboard their interfaces.

One of the earliest solutions was the simple analog Mixer knob on thefront panel of the PreSonus FirePod. This allowed users to blend theFirePod’s analog (pre-converter) input signal with the stereo playbackstream from the computer. This basic monitoring solution is still avail-able on such interfaces as the PreSonus AudioBox USB, AudioBox22VSL, and AudioBox 44VSL. Another solution, used in the PreSonusFireStudio™ family and many others, is to include an onboard DSPmixer that is managed using a software control panel.

While both of these solutions resolve the problem of latency whilemonitoring, they provide a flat user experience by giving control onlyover basic mix functions like volume, panning, solo, and mute.

Page 10: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 10 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

Old-skool solution: Just grab some of the analog signalbefore it goes into the A/D converters and send it back toyour headphones. It works but you can’t hear any effects orreverb.

Anyone who has ever record-ed using one of our Studio-Live™ mixers (anyone whohas ever tracked with anymixer, for that matter) knowshow important it is to be ableto record a track while hear-ing effects (as well as com-pression and equalization).For example, if reverb on a vocal is going to be part of the final mix,it’s almost impossible to record the vocal “dry” — phrasing and tim-ing are totally different when you can’t hear the duration and decay ofthe reverb.

The developers at PreSonus were intrigued by the idea that they couldconceivably provide the user with some level of control over the USBBus clock buffer and perhaps offer another way of monitoring outsidethe DAW (while adding effects and reverb). After much experimenta-tion, they discovered that most modern computers can easily and sta-bly perform at a much lower USB Bus clock buffer than previouslythought. On average, a 2 to 4 ms USB Bus clock buffer offers both ex-cellent performance and stability. On a powerful computer like a fullyloaded Mac Pro, they’ve been able to lower this buffer to the lowestUSB Bus clock setting possible: 1 ms.

Given these discoveries, not giving the user control over the USB Busclock buffer and telling them that the only latency controls available

Page 11: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 11 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

are the ASIO and Core Audio buffer sizes seems at best duplicitous,and at worst a failure to provide customers with the best latency per-formance a modern computer can provide.

This is where AudioBox VSL-series interfaces enter the picture. Thisnew series of interfaces takes advantage of these technological discov-eries and provides users with the ultimate monitor-mixing experience,without including expensive onboard DSP and the proportional costincrease to customers.

Tracking with Reverb and Effects... without Being in a Tun-nel

The Virtual StudioLive software that comes with our AudioBox22VSL, 44VSL and 1818VSL interfaces looks like — and performs like— the Fat Channel on our StudioLive 16.0.2 mixer.

You get compression, limiting, 3-band semi-parametric EQ, noisegate, and high-pass filter. We’ve even included 50 channel presetsfrom the 16.0.2 just to get you started. Plus you get an assortment of32-bit reverbs and delay, each with customizable parameters.

Optimizing AudioBox VSL Software

AudioBox VSL monitoring software runs between the USB Bus clockbuffer and the ASIO/ Core Audio buffer on your computer, so it is

Page 12: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 12 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

AudioBox 44VSL Virtual StudioLive mixer and Fat Channel

only subject to the latencyfrom the USB Bus clockbuffer.

Unlike many manufacturers,PreSonus did not fix thisbuffer at 6 ms; rather, Au-dioBox VSL offers a choice ofthree buffer sizes. To reducethe confusion of presentingthe user with two types of buffer settings, these USB Bus clock buffersettings are labeled “Performance Mode.”

This setting is available from the Setup tab in AudioBox VSL, and itdirectly affects the amount of latency you will hear in monitor mixesfrom AudioBox VSL software.

At the Fast setting, AudioBox VSL runs at a USB Bus clock buffer set-ting of 2 ms, while Normal sets the buffer to 4 ms, and Safe sets it to 8ms. So when you set your AudioBox VSL to run at the Fast USB Busclock buffer setting, roundtrip latency will be approximately 3.5 ms,including the time it takes for the A/D – D/A converters to change analog audio to 1s and0s and back to analog again.

To optimize these buffer settings for your particular computer:

Begin by creating a monitor mix in AudioBox VSL and setting thePerformance mode to Fast.Listen carefully for pops and clicks and other audio artifacts at avariety of sample rates.Now load the AudioBox VSL with compressors, EQs, reverbs, and

Page 13: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 13 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

CPU Performance Meter in Studio One 2 Artist DAW (comesfree with AudioBox VSL interfaces).

delays.If you hear audio arti-facts, raise the Perfor-mance mode to Normal.On most machines, Nor-mal will provide the bestperformance with themost stability. If youhave an older machinewith a slower processorand a modest amount of RAM, you may need to raise this settingto Safe. Keep in mind, however, that even at 9 ms, AudioBox VSLis running at a lower latency than monitoring through mostDAWs at the best ASIO/ Core Audio buffer setting—and the bestbuffer setting will not work on a slower computer anyway.

Once you have Performance mode tuned, the next latency compo-nent of the driver to tune is the ASIO buffer size (Windows) orCore Audio buffer size (Mac). This time, load a large session intoyour DAW and experiment with the buffer settings. Again, youare listening for pops and clicks and other audio artifacts.

If your DAW includes a CPU-performance meter (as Studio Onedoes), you can use this to help you find the best buffer setting for yourcomputer.

No matter how you set your ASIO/Core Audio buffer size, the moni-toring latency in VSL is not affected. So you can set this buffer fairlyhigh and lower it only when you are playing virtual instruments.Keep in mind that it’s still important to determine the lowest thresh-

Page 14: The Truth About Digital Audio Latency.pdf

3/11/13 9:28 PMPreSonus | Learn - The Truth About Digital Audio Latency

Page 14 of 14http://www.presonus.com/community/Learn/The-Truth-About-Digital-Audio-Latency

old at which your DAW can still perform stably.