DE

← manuelwelsch.de

Low-latency, low-jitter MIDI/OSC transmission from Ableton Live to an iPad app

Bachelor thesis, B.Sc. Media Informatics, Hochschule Düsseldorf, August 2023

Original title: Entwicklung und Anwendung einer Testapplikation zur Untersuchung der latenz- und jitterarmen Übertragung von Steuersignalen (MIDI / OSC) von Ableton Live zu einer iPad App

Abstract

An iPad controller for Ableton Live only works on stage if the connection is fast and steady. More than 10 ms between a touch and the sound is already noticeable, and visual feedback on the iPad should arrive within 30 ms. There were no dedicated tools to measure this, so I built a test system and used it to optimise the connection step by step.

The system had three parts: an iPad app with test scenarios, such as 8 knobs turned at once with multitouch; a Mac app that relayed every message between the iPad and Ableton Live and showed the latency and jitter of each connection in a live dashboard; and a Python MIDI Remote Script inside Ableton Live.

With every change measured, the median input latency from the iPad to Ableton Live dropped from 27.8 ms to 4.98 ms. Together with a typical audio interface latency of 4 ms, that is 8.98 ms from touch to sound, within the 10 ms target. The visual round trip measured 9.97 ms, well within 30 ms.

The reusable parts (networking, latency measurement and controls) went into a Swift package for future controller apps.

Results

Median input latency, iPad to Ableton Live
27.8 → 4.98 ms
Touch to sound, with 4 ms audio latency
8.98 ms
Target: under 10 ms
Visual round trip
9.97 ms
Target: under 30 ms
Median input latency after each step
  1. Run loop pulse. Ableton’s Remote Scripts only handled incoming OSC messages in a run loop that ticked about every 100 ms. That caused most of the delay and the sawtooth below. A listener on the song position still only got down to 80 ms. Remote Scripts prioritise MIDI, so the Mac app sent a MIDI CC message every 0.1 ms as a pulse, and every pulse made the script work through its OSC queue. The run loop went from about 100 ms to under 1 ms.
  2. OSC bundles. Fast knob turns sent bursts of messages that seemed to hit a limit of packets per second and showed up as waves in the latency. Packing several OSC messages into one bundle cut the number of packets and removed the waves.
  3. 128 steps per turn. The iPad’s touchscreen produced far more values than anyone can hear. Quantising each knob to 128 steps per turn, the resolution of a MIDI CC, meant fewer messages to send.
Every packet, before and after
  • Mac to Ableton Live
  • iPad to Mac

Before: no optimisation, median 27.8 ms

50 ms 25 0

After: all three steps, median 4.98 ms

50 ms 25 0

Input latency of 50 consecutive packets while turning 8 knobs at once. Both panels use the same scale.

Show the data
PacketBefore (ms)After (ms)
Mac to AbletoniPad to MacMac to AbletoniPad to Mac
13.532.276.042.86
20.412.032.261.41
30.481.941.531.82
40.571.861.561.51
540.111.363.211.75
640.372.484.550.80
740.792.110.621.08
837.701.691.8512.16
938.424.630.991.98
1034.304.681.451.82
1134.374.593.211.81
1231.583.292.342.44
1331.872.990.951.31
1428.212.633.801.07
1528.412.420.981.48
1623.543.154.361.52
1723.852.830.912.15
1823.882.815.283.12
1920.831.773.731.15
2020.982.244.651.17
2116.992.111.121.36
2217.252.257.112.48
2313.411.948.563.55
249.511.586.051.36
259.932.673.121.61
265.712.783.831.73
272.302.334.261.80
2839.212.588.992.96
2936.554.469.442.53
3032.614.562.211.00
3128.744.274.971.04
3229.193.815.291.56
3325.573.281.980.91
3421.693.960.951.07
3522.233.442.642.36
3618.283.019.901.49
3710.413.3510.071.34
3810.383.396.412.00
398.041.663.511.35
401.933.633.401.32
4143.934.824.891.53
4245.504.191.371.43
4342.443.502.391.01
4438.613.349.990.92
4534.643.183.701.00
4630.932.765.731.36
4731.092.499.211.00
4827.072.511.791.46
4922.822.974.133.19
5018.882.400.961.20

Choosing the transport

Before optimising anything, I compared ways to connect the iPad to the Mac inside the test system: