Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

AudioFormat

extends Object
java.lang.Object
   ↳ android.media.AudioFormat

Class Overview

The AudioFormat class is used to access a number of audio format and channel configuration constants. They are for instance used in AudioTrack and AudioRecord .

Summary

Constants
int CHANNEL_CONFIGURATION_DEFAULT This constant was deprecated in API level 5. use CHANNEL_OUT_DEFAULT or CHANNEL_IN_DEFAULT instead
int CHANNEL_CONFIGURATION_INVALID This constant was deprecated in API level 5. use CHANNEL_INVALID instead
int CHANNEL_CONFIGURATION_MONO This constant was deprecated in API level 5. use CHANNEL_OUT_MONO or CHANNEL_IN_MONO instead
int CHANNEL_CONFIGURATION_STEREO This constant was deprecated in API level 5. use CHANNEL_OUT_STEREO or CHANNEL_IN_STEREO instead
int CHANNEL_INVALID Invalid audio channel mask
int CHANNEL_IN_BACK
int CHANNEL_IN_BACK_PROCESSED
int CHANNEL_IN_DEFAULT
int CHANNEL_IN_FRONT
int CHANNEL_IN_FRONT_PROCESSED
int CHANNEL_IN_LEFT
int CHANNEL_IN_LEFT_PROCESSED
int CHANNEL_IN_MONO
int CHANNEL_IN_PRESSURE
int CHANNEL_IN_RIGHT
int CHANNEL_IN_RIGHT_PROCESSED
int CHANNEL_IN_STEREO
int CHANNEL_IN_VOICE_DNLINK
int CHANNEL_IN_VOICE_UPLINK
int CHANNEL_IN_X_AXIS
int CHANNEL_IN_Y_AXIS
int CHANNEL_IN_Z_AXIS
int CHANNEL_OUT_5POINT1
int CHANNEL_OUT_7POINT1
int CHANNEL_OUT_BACK_CENTER
int CHANNEL_OUT_BACK_LEFT
int CHANNEL_OUT_BACK_RIGHT
int CHANNEL_OUT_DEFAULT Default audio channel mask
int CHANNEL_OUT_FRONT_CENTER
int CHANNEL_OUT_FRONT_LEFT
int CHANNEL_OUT_FRONT_LEFT_OF_CENTER
int CHANNEL_OUT_FRONT_RIGHT
int CHANNEL_OUT_FRONT_RIGHT_OF_CENTER
int CHANNEL_OUT_LOW_FREQUENCY
int CHANNEL_OUT_MONO
int CHANNEL_OUT_QUAD
int CHANNEL_OUT_STEREO
int CHANNEL_OUT_SURROUND
int ENCODING_DEFAULT Default audio data format
int ENCODING_INVALID Invalid audio data format
int ENCODING_PCM_16BIT Audio data format: PCM 16 bit per sample.
int ENCODING_PCM_8BIT Audio data format: PCM 8 bit per sample.
Public Constructors
AudioFormat ()
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int CHANNEL_CONFIGURATION_DEFAULT

Added in API level 3

This constant was deprecated in API level 5.
use CHANNEL_OUT_DEFAULT or CHANNEL_IN_DEFAULT instead

Constant Value: 1 (0x00000001)

public static final int CHANNEL_CONFIGURATION_INVALID

Added in API level 3

This constant was deprecated in API level 5.
use CHANNEL_INVALID instead

Constant Value: 0 (0x00000000)

public static final int CHANNEL_CONFIGURATION_MONO

Added in API level 3

This constant was deprecated in API level 5.
use CHANNEL_OUT_MONO or CHANNEL_IN_MONO instead

Constant Value: 2 (0x00000002)

public static final int CHANNEL_CONFIGURATION_STEREO

Added in API level 3

This constant was deprecated in API level 5.
use CHANNEL_OUT_STEREO or CHANNEL_IN_STEREO instead

Constant Value: 3 (0x00000003)

public static final int CHANNEL_INVALID

Added in API level 5

Invalid audio channel mask

Constant Value: 0 (0x00000000)

public static final int CHANNEL_IN_BACK

Added in API level 5

Constant Value: 32 (0x00000020)

public static final int CHANNEL_IN_BACK_PROCESSED

Added in API level 5

Constant Value: 512 (0x00000200)

public static final int CHANNEL_IN_DEFAULT

Added in API level 5

Constant Value: 1 (0x00000001)

public static final int CHANNEL_IN_FRONT

Added in API level 5

Constant Value: 16 (0x00000010)

public static final int CHANNEL_IN_FRONT_PROCESSED

Added in API level 5

Constant Value: 256 (0x00000100)

public static final int CHANNEL_IN_LEFT

Added in API level 5

Constant Value: 4 (0x00000004)

public static final int CHANNEL_IN_LEFT_PROCESSED

Added in API level 5

Constant Value: 64 (0x00000040)

public static final int CHANNEL_IN_MONO

Added in API level 5

Constant Value: 16 (0x00000010)

public static final int CHANNEL_IN_PRESSURE

Added in API level 5

Constant Value: 1024 (0x00000400)

public static final int CHANNEL_IN_RIGHT

Added in API level 5

Constant Value: 8 (0x00000008)

public static final int CHANNEL_IN_RIGHT_PROCESSED

Added in API level 5

Constant Value: 128 (0x00000080)

public static final int CHANNEL_IN_STEREO

Added in API level 5

Constant Value: 12 (0x0000000c)

public static final int CHANNEL_IN_VOICE_DNLINK

Added in API level 5

Constant Value: 32768 (0x00008000)

public static final int CHANNEL_IN_VOICE_UPLINK

Added in API level 5

Constant Value: 16384 (0x00004000)

public static final int CHANNEL_IN_X_AXIS

Added in API level 5

Constant Value: 2048 (0x00000800)

public static final int CHANNEL_IN_Y_AXIS

Added in API level 5

Constant Value: 4096 (0x00001000)

public static final int CHANNEL_IN_Z_AXIS

Added in API level 5

Constant Value: 8192 (0x00002000)

public static final int CHANNEL_OUT_5POINT1

Added in API level 5

Constant Value: 252 (0x000000fc)

public static final int CHANNEL_OUT_7POINT1

Added in API level 5

Constant Value: 1020 (0x000003fc)

public static final int CHANNEL_OUT_BACK_CENTER

Added in API level 5

Constant Value: 1024 (0x00000400)

public static final int CHANNEL_OUT_BACK_LEFT

Added in API level 5

Constant Value: 64 (0x00000040)

public static final int CHANNEL_OUT_BACK_RIGHT

Added in API level 5

Constant Value: 128 (0x00000080)

public static final int CHANNEL_OUT_DEFAULT

Added in API level 5

Default audio channel mask

Constant Value: 1 (0x00000001)

public static final int CHANNEL_OUT_FRONT_CENTER

Added in API level 5

Constant Value: 16 (0x00000010)

public static final int CHANNEL_OUT_FRONT_LEFT

Added in API level 5

Constant Value: 4 (0x00000004)

public static final int CHANNEL_OUT_FRONT_LEFT_OF_CENTER

Added in API level 5

Constant Value: 256 (0x00000100)

public static final int CHANNEL_OUT_FRONT_RIGHT

Added in API level 5

Constant Value: 8 (0x00000008)

public static final int CHANNEL_OUT_FRONT_RIGHT_OF_CENTER

Added in API level 5

Constant Value: 512 (0x00000200)

public static final int CHANNEL_OUT_LOW_FREQUENCY

Added in API level 5

Constant Value: 32 (0x00000020)

public static final int CHANNEL_OUT_MONO

Added in API level 5

Constant Value: 4 (0x00000004)

public static final int CHANNEL_OUT_QUAD

Added in API level 5

Constant Value: 204 (0x000000cc)

public static final int CHANNEL_OUT_STEREO

Added in API level 5

Constant Value: 12 (0x0000000c)

public static final int CHANNEL_OUT_SURROUND

Added in API level 5

Constant Value: 1052 (0x0000041c)

public static final int ENCODING_DEFAULT

Added in API level 3

Default audio data format

Constant Value: 1 (0x00000001)

public static final int ENCODING_INVALID

Added in API level 3

Invalid audio data format

Constant Value: 0 (0x00000000)

public static final int ENCODING_PCM_16BIT

Added in API level 3

Audio data format: PCM 16 bit per sample. Guaranteed to be supported by devices.

Constant Value: 2 (0x00000002)

public static final int ENCODING_PCM_8BIT

Added in API level 3

Audio data format: PCM 8 bit per sample. Not guaranteed to be supported by devices.

Constant Value: 3 (0x00000003)

Public Constructors

public AudioFormat ()

Added in API level 3