to top

Audio Implementation

In this document

This section explains how to implement the audio Hardware Abstraction Layer (HAL), provides details about configuring an audio policy (file formats, code organization, pre-processing effects), and describes how to configure the shared library (creating the Android.mk file).

Implementing the audio HAL

The audio HAL is composed of the following interfaces:

  • hardware/libhardware/include/hardware/audio.h. Represents the main functions of an audio device.
  • hardware/libhardware/include/hardware/audio_effect.h. Represents effects that can be applied to audio such as downmixing, echo, or noise suppression.

You must implement all interfaces.

Audio header files

For a reference of the properties you can define, refer to the audio header files:

  • In Android 6.0 and higher, see system/media/audio/include/system/audio.h.
  • In Android 5.1 and lower, see system/core/include/system/audio.h.

For an example, refer to the implementation for the Galaxy Nexus at device/samsung/tuna/audio.

Next steps

In addition to implementing the audio HAL, you must also create an audio policy configuration file that describes your audio topology and package the HAL implementation into a shared library. You can also configure pre-processing effects such as automatic gain control and noise suppression.