Live data from Hacker News

Sub-10ms roundtrip audio latency on Android

superpowered.com

31–40 of 50 posts

Re: Sub-10ms roundtrip audio latency on Android

#31
post #24

Does this mean we can finally have an app that'd invert the input from the microphone and play it back on the loudspeaker effectively performing surrounding ambient noise cancellation?

Ambient noise cancellation is more complicated than that. Consider that as you changed your distance from the speaker you would be going into and out of phase with the signal, you would effectively be doubling the ambient noise at some locations, and cancelling it at others. Also 10ms response time would definitely be too slow for such an application. If that worked, you could just use an opamp with a sub-microsecond…

What about for application in a headphone? You wouldn't have issues with changes in distance, as your ears would always be a set distance away from the drivers.

For example, what is the latency on Bose's QuietComfort 25?

Re: Sub-10ms roundtrip audio latency on Android

#32
post #18

Earlier quoted context omitted.

"We updated our findings with the recent improvements in Android M (Marshmallow), and recently released a solution for Android’s USB audio and MIDI challenges, opening a market of 1.1 billion devices for pro audio application creators." Those are two separate things: 1. Updated analysis on the latency with regards to Marshmallow. 2. Superpowered USB Audio and MIDI SDK opens a market of 1.1 billion devices.

A brief skim of the article they link regarding Marshmallow [1] provides this quote: > As readers may recall, 10ms round-trip audio latency is the threshold that must be met by Android to be considered truly 'pro audio'. This wasn't possible before Marshmallow (per aforementioned article), and therefore pro-quality audio apps are still only truly possible on 10% of Android devices. So the market is opened up for 100…

I'm one of the authors of the article, and the CTO of Superpowered. I apologize if the article was confusing.

Marshmallow improves audio latency here and there on some devices, but even Android N has the fundamental audio stack problems we mention in the articles.

There is no Android version delivering Audio can be handled by built-in hardware or external (USB) hardware.

External: Android is not able to deliver glitch-free low latency audio on USB devices. We introduced a solution for this last month, that's one of the links on the top of the article. It opens up a market of 1.1 billion devices (meaning, Android 4.4.4 and up) for USB audio on Android.

Built-in: The current article introduces a demo solution for the built-in audio hardware.

Re: Sub-10ms roundtrip audio latency on Android

#33

Earlier quoted context omitted.

Ambient noise cancellation is more complicated than that. Consider that as you changed your distance from the speaker you would be going into and out of phase with the signal, you would effectively be doubling the ambient noise at some locations, and cancelling it at others. Also 10ms response time would definitely be too slow for such an application. If that worked, you could just use an opamp with a sub-microsecond…

What about for application in a headphone? You wouldn't have issues with changes in distance, as your ears would always be a set distance away from the drivers. For example, what is the latency on Bose's QuietComfort 25?

You would need a latency of something like 0.01ms or even less.

If I remember right such a low latency is basically impossible, so sound canceling headphones have to try to predict the sound before it happens.

There are large problems with simply the speed of sound - you don't really have time to emit the new sound, and if you move the mic farther from the speaker you don't accurately match the sound, and can make things worse.

That's why the headphones use fancy algorithms to try to guess what the sound will be, and that's why good ones cost so much, instead them being a simple analog circuit.

Re: Sub-10ms roundtrip audio latency on Android

#35
post #34

So why is this so hard for Android but seemingly easy for every other OS out there?

Short answer: abstraction layers.

Because Android has to be able to run on so many devices there are a bunch of abstraction layers between the app and the hardware, all adding delay.

iOs does not have this issue.

Re: Sub-10ms roundtrip audio latency on Android

#37
post #34

So why is this so hard for Android but seemingly easy for every other OS out there?

Short answer: abstraction layers. Because Android has to be able to run on so many devices there are a bunch of abstraction layers between the app and the hardware, all adding delay. iOs does not have this issue.

I bet your iOS also has some abstraction layer, I doubt you get to poke DAC chip registers directly from userspace. Superpowered Media Server is an abstraction layer too and so are desktop OS audio APIs.

And yet, they don't suck as badly.

Re: Sub-10ms roundtrip audio latency on Android

#38
post #34

So why is this so hard for Android but seemingly easy for every other OS out there?

The article kind of touches that:

"Ultimately, the Android audio tack has fundamental architectural problems stemming from engineering decisions made at Android’s genesis, well before Google’s acquisition of Android."

Much of Android was designed for simple apps written in Java and running on resource-constrained devices. This is quite far from the reality of today. Perhaps it allowed Android to get to the market early and get a thriving app ecosystem, but billions of dollars have been poured to fixing those "mistakes" from the early days.

Audio apps are pretty much the polar opposite from what Android was originally designed for. Audio processing needs to run on native code or at least without ever invoking the garbage collector or any other unpredictable source of latency.

iOS and OSX audio stack is completely different and achieves a very low latency. Many musicians prefer Apple products because the audio works well out of the box. You might be able to achieve similar performance with Windows or Linux, but it's not as easy.

While the Superpowered has a neat improvement on Android's latency figures, 8...24 ms is not good enough for professional music use (and they don't mention any confidence intervals). For music apps, audio latency must be consistently less than 10 ms, preferably less than 5 ms.

It's an improvement but I don't think it inspires enough confidence that you'd see musicians performing in front of an audience using Android devices any time soon.

Re: Sub-10ms roundtrip audio latency on Android

#39
post #11

It often takes over 500ms to get voice through the cellular network. Worrying about 10ms in applications seems excessive.

About 10 ms is the maximum latency that can be tolerated in music applications. Preferably it should be around 5 ms.

If you're a musician, you can easily notice when the sound doesn't come out when you press your finger on the keyboard or sing to a microphone. 5 ms is not noticeable at all, 10 ms feels a bit off but is tolerable, above 25 ms is clearly noticeable and very annoying (ie. it's no longer a musical instrument).

Re: Sub-10ms roundtrip audio latency on Android

#40

"It can be installed on any Android userdebug build or rooted production build." "Installing on Samsung Galaxy devices is not recommended" So, not for apps on devices today.

You're correct. It doesn't seem to be for consumer oriented products today. But it's a start...

I guess they're targetting some professional audio gear that have an Android-based component in it. Or hope to get this sold to phone/tablet vendors who would like to build a music-oriented product. Or get acquired by Google and get integrated into Android proper. Or just make Android a viable backend for their cross-platform audio sdk.

Can anyone from Superpowered chime in and shed some light on who or what you're targetting?

Post reply on HN