2 min read

Yesterday, Google released the first production-ready version of Oboe. It is a C++ library for building real-time audio apps. One of its main benefits includes the lowest possible audio latency across the widest range of Android devices. It is similar to AndroidX for native audio.

How Oboe works

The communication between apps and Oboe happens by reading and writing data to streams.  This library facilitates the movement of audio data between your app and the audio inputs and outputs on your Android device. The apps are able to pass data in and out by reading from and writing to audio streams, represented by the class AudioStream.

A stream consists of the following:

Audio device

An audio device is a hardware interface or virtual endpoint that acts as a source or sink for a continuous stream of digital audio data. For example, a built-in mic or bluetooth headset.

Sharing mode

The sharing mode determines whether a stream has exclusive access to an audio device that might otherwise be shared among multiple streams.

Audio format

This the format of the audio data in the stream. The data that is passed through a stream has the usual digital audio attributes, which developers must specify when defining a stream. These are as follows:

  • Sample format
  • Samples per frame
  • Sample rate

The following sample formats are allowed by Oboe:

Oboe

Source: GitHub

What are its benefits

Oboe leverages the improved performance and features of AAudio on Orea MR1 (API 27+) and also maintains backward compatibility on API 16+. The following are some of its benefits:

  • You write and maintain less code: It uses C++ allowing you to write clean and elegant code. With Oboe you can create an audio stream in just three lines of code whereas, when using OpenSL ES the same thing requires 50+ lines.
  • Accelerated release process: As Oboe is supplied as a source library, bug fixes can be rolled out in few days as opposed to the Android platform release cycle.
  • Better bug handling and less guesswork: It provides workarounds for known audio bugs and has sensible default behaviour for stream properties.
  • Open source: It is open source and maintained by Google engineers.

To get started with Oboe, check out the full documentation and the code samples available on its GitHub repository. Also, read the announcement posted on the Android Developers Blog.

Read Next

What role does Linux play in securing Android devices?

A decade of Android: Slayer of Blackberry, challenger of iPhone, mother of the modern mobile ecosystem

Google announces updates to Chrome DevTools in Chrome 71