Audio latency again


Hey everyone,
I know this is a hot topic with android, and I know that the audio latency on some devices is through the roof so I deliberately got one with low latency based on this list. Other audio apps I’ve downloaded have low latency. The problem is my app for sure, not the device.

Basically there’s like 150-200 ms of delay between tapping the screen and hearing the sound, which is unacceptable. There is no problem on iOS. Where is the delay coming from! First I thought it was the interaction (the delay from tapping the screen to triggering the voice to play) because it has to pass from JS to Java to C++ in my app. But I timed that and it takes about 1ms which is negligible.

Next I timed the touch event to the first non-zero sample in the final output audio callback. 6ms. On the edge but still not a problem.

Something, somewhere is adding another ~150ms to the latency.

The buffer size is 1152. What am I doing wrong? Do I need to set anything up with the AudioDeviceManager? The app is using OpenSL for sure because I see it in the stack trace.
The Juce demo seems to run pretty fast - albeit just playing a sine wave - but my timing shows that the audio processing isn’t what’s causing the delay. It’s defs not the device, because other apps have a maybe 20ms - 50ms delay, which is just about acceptable.

Any ideas?


I remember that we saw this bug in one of our ROLI apps as well. It had definitely something to do with the touch latency and but I can’t remember how we fixed it. I’ll ask around tomorrow. Do you see the same sort of latency in the JUCE demo app? There is a latency detector there.