News for hackers. Stuff that matters.
Re:An update on Android's audio latency by jefftk on Friday March 05, 2021 @04:53PM (#26362623)
This is way better than it used to be (I measured half a second latency in 2012: https://www.jefftk.com/p/android-sound-synthesis-and-latency) but it is still too high to let you use an Android device as a musical instrument. This is something iPhones have always been able to do, and one of my biggest disappointments with Android.

(Disclosure: I work for Google, speaking only for myself)

Re:An update on Android's audio latency by limeblack on Friday March 05, 2021 @05:44PM (#26363198)
I agree audio at minimum should have been done differently on Android.

The latency(different type I believe) of Spotify applications and even YouTube applications is pretty bad compared to an Apple device. Sometimes the audio just fails to respond for half a second or so. This is not an interface bug from my experience.

Re:An update on Android's audio latency by thomasahle on Friday March 05, 2021 @05:23PM (#26362968)
What are the equivalent numbers for iPhone? Touch to audio and round-trip times?
Re:An update on Android's audio latency by kall on Friday March 05, 2021 @06:07PM (#26363421)
This data [0] doesn't have the latest models, and it's meassuring latency internaly, not "touch-to-sound". The ones they tested average around 7-8ms. I've heard of <10ms as the benchmark for "instant" in audio.

Edit: I've been thinking about this and a touch-to-tone latency below 10ms seems imposible, even with the 120hz digitizer on newer iPhones. I would be very interested in seeing some experimental data as well.

[0] https://juce.com/discover/stories/Mobile%20performance%20ind...

Re:An update on Android's audio latency by thomasahle on Friday March 05, 2021 @06:41PM (#26363723)
The best I could find was https://developer.apple.com/forums/thread/71301 which suggests a 32ms touch latency. I think that might include some processing, but it doesn't seem much better than the 20ms latency in Android mentioned in the article.

The audio processing latency seems to be single digit on both systems.

In any case, I don't think these differences are big enough to argue that "Android can't be used for instruments".

Re:An update on Android's audio latency by kall on Friday March 05, 2021 @07:09PM (#26363938)
Yeah, I think the numbers in the article should be good enough for a bunch of music use cases, but remember it used to be like half a second which is obviously unworkable.

Well financed developers like ROLI already have instruments on android. I think the incredible instruments available on iOS are also there because the App Store promise actually kind of works for them. They write a great application, upload it to server and people buy it for more than 2.99$, upfront. And unlike VSTs, no one even pirates it. The general idea/stereotype is that no one wants that on android. An open source port of VCV Rack would be feasable and wonderful though. That's the only free instrument I have installed on my music iPad.

Edit: nevermind, that was not free either.

Re:An update on Android's audio latency by de6u99er on Friday March 05, 2021 @08:57PM (#26364538)
Totally agree.

We should not forget that our brain is great at adjusting to latency. In the old days, when I was excessively playing Quake 3 Team Arena it took me just a couple of minutes to adjust to network latency depending on the server I was connected to.

Professional musicians do this constantly and are much better at that.

Re:An update on Android's audio latency by lloeki on Saturday March 06, 2021 @04:38AM (#26366302)
What. Our brain is absolutely terrible at adjusting for latency. It can somewhat compensate, but only to an extent, and at severe cost.

There’s this video around that puts people in a VR helmet playing A/V with a delay, even the lowest setting completely destroys any form of efficiency.

Anything below 60Hz in VR has a significantly increased chance of giving motion sickness due to latency.

Playing Super Mario Bros in an emulator is strangely subtly harder than on the real NES hardware, just because of a slight lag added (can’t recal on NES but on SNES buttons literally bit-flip the RAM, hard to beat that). You can train all you want on an emulator, when you get back to the real thing it’s obvious it was just so crippling.

Try Guitar Hero / Rock Band with various audio / video latency settings. 10ms is obviously impactful, anything higher borderlines on unplayable, and even 5ms has a subtle impact increasing missing notes.

As for pro musicians, they absolutely loathe latency. This is why bassists (tempo) / drummers (rhythm) / conductors (tempo) exist: they serve as a single source of truth to sync on. In fact, we’re so sensitive to latency that the slightest deviation is unbearable, hence why following them put you back in sync. Same for effect pedals, amps, feedbacks... any latency is destroying.

Try playing on Zoom, it’s absolutely impossible (unless you assume latency is fixed, which it is not, and play in a tempo matching latency exactly, and follow the lead but time-warp your play by one beat, which I imagine is possible as a sort of canon but absolutely horrendous) unless you completely ignore the other part and find a common time source to sync upon.

Now you mention Quake 3, and it might just be you were severely misled by several critical innovations that game introduced, like network prediction and frame interpolation, negating most of the practical effects of latency.

https://www.jfedor.org/quake3/

Re:An update on Android's audio latency by bumbada on Saturday March 06, 2021 @05:26AM (#26366507)
Input in NES is not lag's source. Input is only read once per frame. Today it is very simple and cheap to improve over old controllers.

Lag comes from video. If you do not use FPGA emulators like Mister the video delay is enormous.

I don't understand what you are calling 10ms lag. Have you measured the delay between your computer and your screen? It is way bigger than that, in any computer or NES console(console-TV).

Are you maybe referring to 10ms NETWORK packet delay? All TVs or projectors use buffers, and it takes time for information to travel around serial cables.

Network delay is inconsistent, but electronic delay is not.

Re:An update on Android's audio latency by lloeki on Saturday March 06, 2021 @06:15AM (#26366661)
> Input in NES is not lag's source. Input is only read once per frame.

That’s exactly what I said ;) By virtue of being a different platform, emulation introduces a lag that is just not present on the real hardware (and can’t be lower by virtue of literally being a wire to memory). USB alone often introduces an astoundingly high minimal floor on latency.

> I don't understand what you are calling 10ms lag. Have you measured the delay between your computer and your screen? It is way bigger than that, in any computer or NES console(console-TV).

Yes I have measured it (on all my devices, accurately so) in order to minimise it as much as possible (I can work with but can’t stand latency, even in a terminal).

Rock Band, which I used to be an avid player of, allows you to adjust a relative delay (audio and video separately), timewarping A/V so that all three are perfectly in sync relative to real-world input.

> Network delay is inconsistent, but electronic delay is not.

I agree (and agree to buffers as well), but by and large any modern device is far removed from being just electronic, from USB (USB 2.0 has a 125us polling loop for multiplexing, USB 3 is point to point so can fare much better at 30us, but even then there’s kernel context switch to read and process that data) to HDMI (packet based with loads of multiplexing), many things end up being surprisingly subject to soft-real-time firmware/software before it hits the display itself. Hard real time stuff probably exists because the specs now allow for it but good luck finding that in consumer space where it’s much easier (read: cheaper) to push a best effort implementation.

But my point isn’t about the minutiae of lag source, it’s that the human brain is severely impacted by lag, can adjust to some extent but the cost is paid heavily at multiple levels and with various efficacy crippling consequences; and that Q3 and subsequent games have increasing numbers of facilities to create the illusion that everything happens in sync so that we’re not so impacted by it.

Re:An update on Android's audio latency by donturner on Monday March 08, 2021 @11:52AM (#26387945)
> the human brain is severely impacted by lag

The brain can compensate for lag/latency up to a point. Church organ players often have to deal with >100ms of delay between pressing a key and hearing the note produced through those big pipes.

If you have an app which produces a sound when you tap on the screen, and there's a delay of say 70ms between tapping and sound being produced, it's easily possible to play in time with an external clock source, like a metronome, as long as the delay is fixed.

In the 1968 paper "Response time in man-computer conversational transactions" actions which occurred within 100ms the human input were perceived as instantaneous. In my experience this holds true with musical instrument apps, although one must first learn how much latency is present in order to compensate for it when synchronising with other clock sources.

Re:An update on Android's audio latency by indymike on Saturday March 06, 2021 @05:18AM (#26366480)
Can confirm that many musicians have to play with latency. Pipe organs, heavily processed guitars (delay is an effect that is very commonly used) all are laggy and you have to play ahead of your accompaniment.
Re:An update on Android's audio latency by lloeki on Saturday March 06, 2021 @07:35AM (#26366973)
True for organists (for which I don’t know much about, but read on, as I believe the following applies to them as well)

The fact that the effects are laggy doesn’t mean you need to sync on them, you’re mostly listening whether the sound envelope is correct (e.g adjust for overshoot/undershoot a bend). Checking the output of effects only matters at timescales of whole beats/measures in terms of how you have to react, definitely not like keeping up with tempo, which has to be precise across the band.

You don’t get delay on drums, and exceedingly rarely so on bass, which is what you have to react agains efficiently, plus the instrument you’re playing provides its own subtle and not-so-subtle haptic feedback. On a guitar, this means the moment you pluck the chord is based on your internal clock synced by listening to the tempo giver (usually bass).

Source: amateur musician myself, wife is pro.

Re:An update on Android's audio latency by smallerfish on Saturday March 06, 2021 @06:50AM (#26366807)
Do you find it impossible to talk to a person 10 feet away? Because their audio has a roughly 10ms latency.
Re:An update on Android's audio latency by lloeki on Saturday March 06, 2021 @07:38AM (#26366984)
No, because I don’t have to react on their output on a millisecond timescale.
Re:An update on Android's audio latency by jefftk on Saturday March 06, 2021 @03:14PM (#26370178)
> Try playing on Zoom, it’s absolutely impossible (unless you assume latency is fixed, which it is not, and play in a tempo matching latency exactly, and follow the lead but time-warp your play by one beat, which I imagine is possible as a sort of canon but absolutely horrendous) unless you completely ignore the other part and find a common time source to sync upon.

Zoom's latency isn't fixed, so that won't work. On the other hand, it is possible to do something like this over the internet by measuring latency and then adjusting for it: www.jefftk.com/p/bucket-brigade-singing

Re:An update on Android's audio latency by mrwoggle on Saturday March 06, 2021 @06:01AM (#26366618)
> Anything below 60Hz in VR has a significantly increased chance of giving motion sickness due to latency.

I think there is a subtle difference between fps (avg) and latency. I would say that a 'stable' latency is always better than a high fps.

> Try Guitar Hero / Rock Band with various audio / video latency settings. 10ms is obviously impactful, anything higher borderlines on unplayable, and even 5ms has a subtle impact increasing missing notes.

Do you mean that you set an additional latency for both video and audio? Or you delay only the audio by 10ms?

Re:An update on Android's audio latency by lloeki on Saturday March 06, 2021 @07:01AM (#26366850)
> I think there is a subtle difference between fps (avg) and latency

Yup, I only mentioned 60Hz, because 16.667 ms is more obvious WRT latency but less known.

> Do you mean that you set an additional latency for both video and audio? Or you delay only the audio by 10ms?

No, RB allows you to set up the audio and video latencies, and since the track is fully known, it’s able to apply negative latency to everything but the input (which, being physical user input, is the only thing that can’t be altered).

So you set up input->audio latency and input->video latency values and the game will internally play them ahead, so that they appear exactly in sync in the physical world.

Re:An update on Android's audio latency by tekstar on Friday March 05, 2021 @11:43PM (#26365284)
I released free AUv3 ports of mutable instruments modules, turned into instruments. Look up Spectrum Synthesizer Bundle on App Store.
Re:An update on Android's audio latency by kall on Monday March 08, 2021 @09:34AM (#26386170)
These are excellent! And you also made synthmodes which I use all the time. Thank you!
Re:An update on Android's audio latency by tekstar on Monday March 08, 2021 @12:35PM (#26388676)
Awesome! You are welcome!
Re:An update on Android's audio latency by cma on Friday March 19, 2021 @01:41AM (#26510427)
There are 120hz ipads, so wouldn't that drop to 16ms?

A physical piano with a 1.2" hammer blow distance played at soft velocity (~2.2mph), assuming distance of closest resonating surface to ear is half meter, would have around 35ms latency.

Re:An update on Android's audio latency by bentpins on Saturday March 06, 2021 @04:42AM (#26366313)
Xiaomi has hit 480hz touch sampling with the Mi 11. It looks possible in hardware and in software, someone just has to manage to perfect both in the same phone
Re:An update on Android's audio latency by jefftk on Friday March 05, 2021 @05:36PM (#26363122)
https://superpowered.com/latency has messy data, but it looks like typically single-digit latency.
Re:An update on Android's audio latency by S_A_P on Friday March 05, 2021 @05:55PM (#26363303)
I think typical newish (2014+) devices have between 5-9ms latency. Having core audio from the start was a huge leg up for iOS for sure. I am mostly platform agnostic unless I am working with audio where I pretty much only use Apple products.
Re:An update on Android's audio latency by breakfastduck on Friday March 05, 2021 @06:32PM (#26363656)
Core Audio is the most under appreciated part of the apple ecosystem. It is lightyears ahead of windows / linux audio drivers.
Re:An update on Android's audio latency by philsnow on Friday March 05, 2021 @07:25PM (#26364039)
The article and all the responses here express "latency" as a simple scalar number. Is it actually more like a histogram of values than a scalar, and the marketing number is the 90th %ile of that histogram?

My impression is that Android has more latency variance than iOS. If that's true then it's important to be clear what the reported numbers represent.

Re:An update on Android's audio latency by jefftk on Friday March 05, 2021 @09:13PM (#26364618)
If you open the audio context you should see consistent latency as long as you keep it open, but each time you open a new audio context you might end up with different latency. You should not see jitter within a single context.
Re:An update on Android's audio latency by Godel_unicode on Friday March 05, 2021 @07:47PM (#26364181)
Latency variance is known as jitter. What gives you the impression that it would be high on Android?
Re:An update on Android's audio latency by philsnow on Sunday March 07, 2021 @02:45PM (#26379067)
Having used nearly every flagship android device from the HTC Dream up through the Nexus 6p, and then switching to an iphone 6 and never looking back, except watching acquaintances use their android phones.

Also from talking to an engineer who worked on earlier generations of iphones, who said that every team had a latency budget that they could not exceed.

Re:An update on Android's audio latency by pjmlp on Saturday March 06, 2021 @02:40AM (#26365853)
On the 3D side it is similarly disappointing, as Google never put the effort of proper frameworks similar to Apple's kits, and SceneForm on Google's tradition is now deprecated after VR on Android lost its marketing drive.