New Feature: support for Google Oboe (developer preview)

audio
android

#1

In commit c859b4a we introduced support for Google’s Oboe. Oboe is a C++ library for building low latency high-performance audio apps on Android. It supports API 16 onwards (99% devices). Under the hood, Oboe uses OpenSL ES on API 16-26 and AAudio from API 27 (Android 8.1) onwards. AAudio introduces further audio performance improvements such as exclusive audio mode. When using Oboe, developers don’t have to code separately for OpenSL ES and AAudio, since Oboe intelligently picks the correct audio implementation at runtime.

Oboe is currently in developer preview and is expected to be released in near future. This preview allows for early access and evaluation for developers targeting Android platform. To enable Oboe in JUCE, simply download Oboe repository from https://github.com/google/oboe, then in Projucer set JUCE_USE_ANDROID_OBOE to Enabled and set the path to the repository in Android exporter:

We are super curious to hear about your experience with using Oboe in JUCE. Since it is in developer preview, any feedback & bug reports will allow us to make it better for you.


#2

So this basically works on any C++ layer things in the past.

What about something that uses AudioTrack (Java) right now but is actually using C++ level audio DSP, I am calling down to C++ to fill the AudioTrack’s buffer, how could I change that to use this framework?

I know not quite related to JUCE but almost is since I was thinking about using JUCE for the GUI(in future apps) and bridge the audio layer with C++.

EDIT : For some reason when I wrote this I thought this was from a Google engineer, thus my post is slanted that way. If you don’t want to answer that is fine. :slight_smile:


#3

This feature is targeted to people using JUCE’s audio APIs, rather than directly talking to OS APIs. I.e. at the end of the day JUCE’s AudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages) will be called for your audio processing class, same as for any other platform and underlying audio device type. In other words, existing JUCE devs don’t have to do anything special to use Oboe (besides small Projucer project settings but even these will go away in final release of Oboe).

The main rationale behind using Oboe is that we are expecting improvements to audio performance on Android (which has been lacking compared to iOS) 8.1 or above, because Google is actively working on underlying AAudio implementation. In other words, we would expect anyone using JUCE for writing audio apps and considering supporting Android to be interested in checking JUCE’s Oboe support out.


#4

Yeah I get that.

I use Caustic’s sound engine which basically generates a buffer that I need to feed into the OS somewhere.

Right now I use AudioTrack in Java. But the fact remains that getting a buffer is getting a buffer(from a sequencer/synthesizer DSP framework) and if I can plugin into JUCE to send that buffer using Oboe, then I do not have to worry about all the things Oboe abstracts.

So I guess I really just answered my own question backwards. :slight_smile:


#5

Yeah, you fill your buffer in JUCE and JUCE will send it to Oboe.


#6

Hi,

I’m trying to understand what are the implications of the “developer preview” qualifier here. I guess this has at least two potential implications:

  • the API can be unstable
  • developers can’t ship apps using this library while it’s in preview mode

I’m very new to Android development, and I have an iOS app to port to Android, with a shipping deadline this summer. Although I can deal with API changes, I can’t risk to start development with Oboe if I can’t ship the product in time. Are there such shipping limitations? And if so, is there some firm timeline for how long such limitations would hold?

Thanks


#7

Hi.

Yes, Oboe API may change requiring us to modify JUCE implementation, but it would very likely affect only internals, keeping the existing public JUCE API the same. In the worst case JUCE API changes will be minimal.

There may be also bugs in Oboe that will have to be fixed before final release. The version we tried on Android 8.1 preview seemed rather stable though. We would not recommend using Oboe in app releases yet, because even though it may work well, subsequent Oboe API changes may be incompatible with your app. Once Oboe is released, we’d expect the API to be stable. No firm release deadlines are known to us, it should be sooner than later, given that we have a preview available for a few months already.

You can always switch between Oboe and OpenSL ES (the latter is the default, until Oboe is explicitly enabled) in JUCE. Depending on your situation later on, you can decide whether you want to run with Oboe, if it gets released before your app release, or with OpenSL ES. All it takes is one switch in Projucer. Until then, if time permits, you could compare the two and assess which one works better for you.


#8

@adamski What do you think :slight_smile:


#9

What are the latency tests so far with a normal device? By normal device, I don’t mean a Nexus 9 or Pixel 2. What are your round-trip test numbers?


#10

This is good news for JUCE audio apps on Android, although I suspect it’s only with newer devices (running Android 8.1 or higher) that the advantages will be heard, and even so, those devices that have been designed with audio performance in mind.


#11

Android is far far from iOS. But… it will catch up.
JUCE power is audio oriented and cross-platform.

So JUCE should make you worry less about this meaning your code should pretty much be written once.
If you need low latency you can set your manifest to or Play store listing to be limited to some devices.

The less nice thing as @adamski mentioned is:

From what I’ve heard on the ADC talk on Android,
They’re working with manufactures. but they can do whatever they want. There are many Chinese phones, I do hope they’ll also cope.

Though, If JUCE would like to take the Oboe concept one step further, I’d try allowing a link to Samsung’s Audio API also. so JUCE would decide which path is best not only AOSP/Oboe style but would migrate all under the hood for best user experience.


#12

Re: allowing the option of using the Samsung Audio API as well, would be awesome, especially if it could be checked for at runtime - looks like its based on JACK so in theory the infastructure should already be there to interact with it…


#13

Re: the Samsung SDK, we investigated it in depth but it actually didn’t perform any better than openSL. It’s also going to be deprecated by Samsung anyway, so not really worth wasting any time on.


#14

Ha, good to know, thanks for clarifying.


#15

So let me understand where we are at with latency (Please keep in mind, I’m the producer and not the developer):

With this new addition to Juce, it makes it easier to be able to do a single click and build for low latency Android. But what @adamski is saying is that these low latency drivers will only work for the newest devices and only Pro Audio Devices.

Can anyone explain specifically, which devices this low latency code works on?


#16

We’ve done some tests on the Android latency here, which you may have seen. We don’t have any newer information to share at this point, but we’ll be testing Samsung devices running Android 8 when they become available and will share our findings.


#17

Ok got it…So the new Android 8 should help with other devices latency. Thanks for the updates.