How to reduce the audio latency in iOS

Everything you need to know about the audio latency on iOS and how to reduce it

What is audio latency?

When you use a software processor, like TH-U, to process an instrument with your phone or tablet in realtime, there is a delay between the tone entering into the device and the processed tone at the audio interface output. This delay is called Audio Latency, or Roundtrip latency, which typically is between 3 to 40 milliseconds.
 
ios latency

Why there is audio latency?

In order to connect your instrument (or the microphone) to the iOS device, you need an audio interface with A/D and D/A converters.
  1. The input signal is converted from analog to digital and this conversion typically introduces 0.5 millisecond of latency.
  2. Then the digital tone enters into the iOS device through a USB/lightning connection. The usb transmission introduces some millisecond of latency, depending on the device and its firmware
  3. Then the samples are packed into buffers, whose size is decided by the software. When the software is processing one buffer, it is outputting the previous one and receiving the new one. This process introduces a latency whose length is double of the buffer size divied by the sample rate. The smaller the buffer size is, the smaller the latency is. The higher the sample rate is, the smaller the latency is. This is the only part of the latency that can be controlled by the software.
  4. The digital signal is transmitted from the device to the audio interface through the USB/lightning and it introduces a latency equal to the point 2
  5. The output signal is converted from digital to analog and this conversion typically introduces another 0.5 milliseconds of latency.
The Roundtrip Latency is the sum of the latencies of these 5 stages.
 

Does the latency depend on the audio interface?

Yes. The latency mainly depends on the audio interface.
In the previous 5 stages, only the 3 depends on the software, while all the others are related to the audio interface and its firmware.
 
Lets see how long is the latency of different audio interfaces, for a fixed configuration with a sample rate of 48KHz and 64 samples buffers:
 
Audio Interface Latency (mSec)
IK Multimedia iRig HD (Lightning connection): 14.6
PreSonus AudioBox iTwo: 11.9
IK Multimedia Axe I/O (usb + camera kit): 9.2
Focusrite Scarlett 2i2: 8.9
 

Does the latency depend on the software?

Yes, but that’s not the main part of the latency, unless you use very large buffer sizes.
For a typical configuration of 48KHz and a buffer size of 64 samples, the latency introduced by the software is
2 x 64 / 48000 = 2.67 milliseconds
while the overall latency ranges from 6 to 15 millieconds, depending on the audio interface.
 

Why some apps declare very small latency values, like 0.5 or 1 mSec?

Because they are only taking into consideration the delay introduced by the software. That's not the Roundtrip latency i.e. the one perceived by the musician. The overall latency is the sum of the delay introduced by the software and the delay introduced by the audio interface.
Does the latency depend on the iOS version and on the device?
No. By using the same audio interface and the same buffer settings, we compared the latency of an older device (iPhone 6 and 8) to the last generation iPad Pro and obtained the same delay.
 

How can I measure the latency?

By using specific apps, like the "Audio Latency Meter for iOS”.
 

How can I get rid of the latency?

You cannot get rig of the latency: you can reduce it.
You should choose a low latency audio interface, because the latency mainly depends on the interface.
Than, make sure to choose a small buffer size in your software.
 
TH-U iOS audio settings
 
Our suggested settings for TH-U iOS is 48KHz, 64 sample buffer size.
 
We do not suggest to use 96KHz: the benefit on the latency is negligible and you’ll keep the CPU under pressure. Let’s compare how we can improve the latency by switching from 48KHz to 96KHz with a 64 samples buffer:
 
Audio Interface Latency 48KHz Latency 96KHz
IK Multimedia iRig HD (Lightning connection): 14.6 13.3
PreSonus AudioBox iTwo: 11.9 10.6
IK Multimedia Axe I/O (usb + camera kit): 9.2 7.9
Focusrite Scarlett 2i2: 8.9 7.6

 

As you can see, the benefit is negligible, because the largest part of the latency depends on the audio interface.