iOS: occasional latency in MIDI out


some users reported a noticeable latency when using our application in MIDI thru mode.
It only happens on iOS. Mac and Windows are not affected.

The setup is the following: a synth is used in “Local Off” mode, its MIDI output is connected to our app, which feeds the MIDI back into the synth. At some point, and for a period up to 30 seconds, the synth receives the notes back with a significant latency.

Users affected by this issue report that it is easier to replicate especially right after the iPad has booted (but also happens less frequently during the use) playing many and fast notes, like with a grand piano rock and roll style.

It’s easy to replicate the problem with the AudioPluginHost and an external synth set up in “Local OFF”:

  • reboot the iPad
  • open AudioPluginHost
  • connect the MIDI input node directly to the MIDI output node
  • in the MIDI settings, enable the synth in the MIDI inputs
  • select the synth in the MIDI output

For the first minute or so, the synth receives the notes with a significant delay. Other apps that don’t use JUCE are not affected (AUM, Cubasis, etc).

Here’s a video demonstrating the problem: - Google Drive .
It starts with only AudioPluginHost, you can hear the gap between the key being pressed and the sound of the piano. Then I replicate the setup on AUM, so the notes on the piano are triggered twice, with the gap due to the latency in AudioPluginHost. At 0:40 I try to edit the settings, but nothing is actually changed. After another 10 seconds the latency is almost gone, at 1:00 it’s completely gone.

Any idea what it could be?