I use OpenSL for recording and playing audio on Android. Could you please advice me how to measure latency, in order to find the optimal audio configuration (buffers, sample rate).
Thank you in advance!
Here's how I used to measure audio output latency:
This way of measuring has the upside that it's very easy to perform. The downside is that your result will include the touch latency as well. With touch events being generated at 60 Hz this would mean that you could get anywhere up to around 16 ms of extra latency in addition to the audio output latency. This makes it pretty much impossible to measure very small latency differences using this method.
Update: In an message board post by Glenn Kasten of Google he linked to a couple of pages that describe more accurate ways of measuring audio latency. I figured I could add them here for reference. Here's the page that describes measuring round-trip latency, and here's another page that describes measuring only the output latency.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With