How to use the audio buffer latency calculator
- Enter the buffer size in samples, as your audio driver or interface shows it.
- Choose the sample rate. Common values are 44.1 kHz and 48 kHz.
- Read the length of one buffer in milliseconds, the one-way delay from the buffers and the round trip with any extra delay.
- Open the advanced options to set how many buffers sit in the path each way, add a fixed extra delay from the interface maker, or enter a round trip you want to find the largest power-of-two buffer within it.
Formula
one buffer in ms = samples / sample rate x 1000
one way = one buffer x buffers each way
round trip = 2 x one way + fixed extra delay
time for one sample = 1 / sample rate
The buffer part of the delay is exact. Converters, drivers and the operating system add more delay that this tool can only include if you enter it.
Common buffer sizes
A buffer of 256 samples at 48 kHz lasts 256 / 48,000 = 5.333 ms. With one buffer each way, the round trip from the buffers is 10.667 ms. At 64 samples the buffer is 1.333 ms and the round trip 2.667 ms. At 512 samples and 44.1 kHz one buffer is 11.61 ms.
With two buffers each way and 3 ms of fixed extra delay, a 256 sample buffer at 48 kHz gives a round trip of 2 x 2 x 5.333 + 3 = 24.33 ms. To stay within a round trip of 12 ms at 48 kHz with one buffer each way, the largest power-of-two size is 256 samples.
Trading delay against stability
A small buffer gives low delay but gives the computer less time to fill it, so a slow or busy machine can drop out with clicks. A larger buffer is safer but adds delay you can hear when you play a virtual instrument or monitor a live input. Many people use a small buffer while recording and a large one while mixing, when delay no longer matters.
What is not included
The analog to digital and digital to analog converters, safety buffers in the driver and processing inside plugins all add delay. Some interfaces report their own figure for it. A loopback test, where you play a click out of the interface and record it back, measures the true total. If you are setting echo times for a track, the BPM to Delay Time Calculator turns a tempo into milliseconds.
More electronics and audio tools
For related electronics and audio work, try the BPM to Delay Time Calculator, Fret Position Calculator and ADC Resolution Calculator.
Assumptions and limits
- The buffer size and the sample rate match the settings in your audio driver.
- The number of buffers each way is the same for input and output.
- The fixed extra delay is a figure you enter, because it depends on the hardware.
- The power-of-two search covers sizes from 16 to 8,192 samples.
- The buffer, sample rate and extra delay in the form are examples to replace with your own.
Frequently asked questions
Why is round trip latency twice the one-way figure?
Sound has to be captured through the input buffer and then played out through the output buffer. Both take time, so for one buffer in each direction the round trip is two buffer lengths.
What delay can people hear?
It varies by person and by what they play. Some players notice a few milliseconds on an instrument they play live and others do not, so judge it by ear and keep the setting that feels natural to you.
Does a higher sample rate lower latency?
For the same number of samples in the buffer, yes, because each sample is shorter. A 256 sample buffer lasts 2.667 ms at 96 kHz and 5.333 ms at 48 kHz, though the higher rate puts more load on the computer.
Why are buffer sizes powers of two?
Audio software and hardware work in blocks that suit binary arithmetic, so interfaces usually offer 32, 64, 128, 256, 512 and so on. Some systems also allow other sizes.