Audio programming in iOS: comparing the play-through latencies of libPD and The Amazing Audio Engine

Being an audio/music developer for iOS devices and a guitar player, I had a very simple question:

Which programming framework should I use to achieve minimum latency for developing real-time audio effects processor for iOS devices?

Being acquainted with Pure Data (PD) and having developed some apps using libPD, this seemed like my first option. However, when I came across The Amazing Audio Engine (TAAE), I was impressed both by its accuracy and its efficiency in CPU performance – considering also that it is very easy to use.

So, I made a simple comparison that I think worths sharing! This comparison actually involves counting the latency in a simple play-through scenario, where audio signal passes through an iPhone 6 without any effects applied. In other words, the question is: how much does the audio signal get delayed, simply by passing through an iPhone 6, using lidPD and TAAE as audio “managers”?

The process is rather simple and and is illustrated in the graph below:


In a few words: I connected two guitar cables to the two audio inputs of a Presonus Firebox sound card. Input 1 was the “test signal” and input 2 the “ground-truth” signal. For testing the latency introduced by libPD and TAAE, the “test signal” was connected to an iPhone 6 before reaching the sound card. For a sanity-check of the process, I also tested both inputs driven directly (without iPhone intervention) into the sound card – just to make sure that there is no inherent latency between the two inputs of the sound card.

For comparing the difference between input 1 (test signal) and input 2 (ground truth), I recorded the both signal in two separate channels in Ableton Live. At some point during the recording I made both cables touch each other, producing an impulse peak in both channels. Then I extracted both signals in separate wav files, imported them in Matlab to measure the distance between the peaks in both signals. I considered this distance (in samples or seconds) as the value of latency introduced by using the iPhone.

Three scenarios were examined:

1) Sanity-check: no iPhone intervening, just to make sure that there is no inherent latency between the two inputs.

Results: sanity-check latency: 0 samples — 0.0000 seconds.

2) Testing libPD latency: test signal passed through an iPhone 6 running only a simple program using a play-through PD patch. Note that the buffer duration in lipPD has to be set up through the AVAudioSessions  – thanks Michael Tyson for bringing that up.



Results: libPD latency: 2335 samples — 0.0181 seconds

3) Testing TAAE latency: test signal passed through an iPhone 6 running only a TAAE program for simple play-through.


Results: TAAE latency: 742 samples — 0.0168 seconds

Here’s a graph summarising the results:



It seems that TAAE has slightly less latency (not perceptible). In the future I intent to check wether latency changes when starting to load audio effects to the programs (e.g. equalisation, distortion, etc.), or the CPU performance of programs based on TAAE and libPD for applying real-time audio effects.



  1. Miguel Saldaña · June 8, 2016

    have you tried TAAE2 BETA?


    • maximoskalpap · June 8, 2016

      Hi Miguel, not yet and that’s a good idea. I’m planning to implement a more extensive methodology for measuring latency for variable buffer sizes. I’ll use TAAE2 in the comparison as well. Do you have any indication or intuition that TAAE2 might have even less latency than TAAE?


  2. Miguel Saldaña · June 9, 2016

    I just started audio programming since last year with TAAE2 so i’m just starting with pure data and TAAE2. I never used TAAE1, but I see you have great content here. We should connect


    • maximoskalpap · June 9, 2016

      Sure Miguel, I don’t know exactly how wordpress connections work – I think you can follow musicalogic and please let me know if you also have a blog where I can follow you. I’m also interested in learning TAAE2, I hope that I’ll have the chance to do it soon…

      I usually post my musicalogic activity on linkedin and Facebook and I’ll be happy to connect with you! (You can find my profiles if you google my full name: Maximos Kaliakatsos-Papakostas.)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s