Droid audio latency

19 posts / 0 new
Last post
hugh
Offline
Last seen: 8 months 5 days ago
Joined: 25 Apr 2010 - 20:04
Droid audio latency

i'm playing short button click sounds on my device using the midi synth interface. this works well on iOS and Windows, but i'm getting a noticeable latency under Android. Subjectively, it seems like over 1/4s. This is on a real device.

i'm using API 10, so maybe i'm getting the SLES interface, i haven't verified that yet, although building against API 8 subjectively gets the same result. will SLES make any difference when using the midi synth or do i have to play streaming audio for this.

is there anything else i should be doing here, or might have missed.

Thanks for any help,

-- hugh.

jules
Offline
Last seen: 5 hours 28 min ago
Joined: 29 Apr 2013 - 18:37
Re: Droid audio latency

Oh yeah, some (most?) Android devices have shockingly bad audio latencies.

My Kindle Fire has a latency of about 1/2 second at best - and it's not that my code is wrong, even apps like the BBC iPlayer play their video completely out-of-sync.

And even SLES doesn't provide any way to find out what the latencies are, it's really bizarre how terrible the sound APIs are!

hugh
Offline
Last seen: 8 months 5 days ago
Joined: 25 Apr 2010 - 20:04
Re: Droid audio latency

ok thanks. i'll have a play about and see if i can improve it in any way. right now, the delay woudnt really be a problem for playing music, but short event sounds are too slow.

if anyone else has anything, please post.

thanks,

Wolfen
Offline
Last seen: 8 hours 59 min ago
Joined: 13 Jan 2005 - 18:05
Re: Droid audio latency
hugh
Offline
Last seen: 8 months 5 days ago
Joined: 25 Apr 2010 - 20:04
Re: Droid audio latency

Thanks.

it looks like this is what we have to put up with until new versions come through.

i downloaded several Android apps to examine their audio to discover almost all do not use any click sound for the UI. most instead ping the buzzer briefly. The ones that do have click sound as an option turned off by default, presumably for the few devices that might be ok with this.

looks like i will have to do the same idea, at least, for now....

siedschl
Offline
Last seen: 6 days 10 hours ago
Joined: 7 Nov 2007 - 09:56
Re: Droid audio latency

I'm just testing a few things on a Samsung Galaxy Note (which runs Android 2.3), and apps like "All in One Drum Pad" or "Electric Guitar" clearly have a much lower latency than the Juce Demo (an estimated 100 ms against about 400 ms). So there must be some way to improve it, it seems...

hugh
Offline
Last seen: 8 months 5 days ago
Joined: 25 Apr 2010 - 20:04
Re: Droid audio latency

a lot of web articles on audio latency have been with situations of a fairly complicated audio nature. for example audio processing and mixing, effects etc.

i have been wondering, if all i want to do is pump out unmodified audio samples, what is the lowest pipeline level i can use to minimise latency. moreover, does Juce already do it like this. i need to read the code and do some research.

i do feel there's probably a solution to this, providing the requirements remain simple. even if the latest devices out there have fixed the problem, there's a lot of them that have not, and getting basic sounds working are quite important to an app.

?

hugh
Offline
Last seen: 8 months 5 days ago
Joined: 25 Apr 2010 - 20:04
Re: Droid audio latency

ok, today, ive been hacking around and wound up doing the following...

i hacked my button click sound into 8KHz mono 16 bit and copied it into the NDK sample "native audio". the native audio sample is an example of OpenSL and operates a queuing buffer similar to the way Juce works. i also hacked the sample to play each sample just once and got rid of any effects being applied (just in case). i built the sample against API 10 and loaded it onto my phone.

the result,

the exact same delay im seeing in Juce. or at least not to make a worthwhile difference.

so, unfortunately, this doesnt lead me to any answers. its possible there's some other devious way to do things that's faster. but this certainly explains why the observed latency is the same in Juce.

to be clear, for many purposes this latency may be ok. but i can move my finger to another button before i hear the click sound of the first button. clearly, this isnt fast enough to have a click sound on a button.

poo.

-- hugh.

debragon
Offline
Last seen: 2 years 5 months ago
Joined: 5 Jun 2012 - 12:36
Re: Droid audio latency

So still no way to improve?

hugh
Offline
Last seen: 8 months 5 days ago
Joined: 25 Apr 2010 - 20:04
Re: Droid audio latency

no progress yet, im afraid. :-(

cosmo
Offline
Last seen: 2 years 4 months ago
Joined: 21 Jul 2008 - 14:53
Re: Droid audio latency

Magic Piano seems to have very low latency on my galaxy s3, or is this another situation because it's just playing static audio vs synthesized audio?

Edit: aha:
"Smule has come up with a work-around for Android’s latency problem that will be deployed in Magic Piano."
source: http://gigaom.com/2012/05/15/music-app-maker-smule-finally-gives-android-some-love/

Pages