Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

MicrophoneInfo

public final class MicrophoneInfo
extends Object

java.lang.Object
   ↳ android.media.MicrophoneInfo


Class providing information on a microphone. It indicates the location and orientation of the microphone on the device as well as useful information like frequency response and sensitivity. It can be used by applications implementing special pre processing effects like noise suppression of beam forming that need to know about precise microphone characteristics in order to adapt their algorithms.

Summary

Nested classes

class MicrophoneInfo.Coordinate3F

 

Constants

int CHANNEL_MAPPING_DIRECT

The channel contains raw audio from this microphone.

int CHANNEL_MAPPING_PROCESSED

The channel contains processed audio from this microphone and possibly another microphone.

int DIRECTIONALITY_BI_DIRECTIONAL

Microphone directionality type: bi-directional.

int DIRECTIONALITY_CARDIOID

Microphone directionality type: cardioid.

int DIRECTIONALITY_HYPER_CARDIOID

Microphone directionality type: hyper cardioid.

int DIRECTIONALITY_OMNI

Microphone directionality type: omni.

int DIRECTIONALITY_SUPER_CARDIOID

Microphone directionality type: super cardioid.

int DIRECTIONALITY_UNKNOWN

Unknown microphone directionality.

int GROUP_UNKNOWN

Value used for when the group of the microphone is unknown.

int INDEX_IN_THE_GROUP_UNKNOWN

Value used for when the index in the group of the microphone is unknown.

int LOCATION_MAINBODY

A microphone that locate on main body of the device.

int LOCATION_MAINBODY_MOVABLE

A microphone that locate on a movable main body of the device.

int LOCATION_PERIPHERAL

A microphone that locate on a peripheral.

int LOCATION_UNKNOWN

A microphone that the location is unknown.

float SENSITIVITY_UNKNOWN

Value used for when the sensitivity of the microphone is unknown.

float SPL_UNKNOWN

Value used for when the SPL of the microphone is unknown.

Fields

public static final MicrophoneInfo.Coordinate3F ORIENTATION_UNKNOWN

Value used for when the orientation of the microphone is unknown.

public static final MicrophoneInfo.Coordinate3F POSITION_UNKNOWN

Value used for when the position of the microphone is unknown.

Public methods

String getAddress()

Returns The "address" string of the microphone that corresponds to the address returned by AudioDeviceInfo.getAddress()

List<Pair<IntegerInteger>> getChannelMapping()

Returns a Pair list for channel mapping, which indicating how this microphone is used by each channels or a capture stream.

String getDescription()

Returns alphanumeric code that uniquely identifies the device.

int getDirectionality()

Returns the directionality of microphone.

List<Pair<FloatFloat>> getFrequencyResponse()

Returns a Pair list of frequency responses.

int getGroup()

Returns A device group id that can be used to group together microphones on the same peripheral, attachments or logical groups.

int getId()

Returns The system unique device ID that corresponds to the id returned by AudioDeviceInfo.getId().

int getIndexInTheGroup()

Returns unique index for device within its group.

int getLocation()

Returns the location of the microphone.

float getMaxSpl()

Returns the level in dB of the maximum SPL supported by the device at 1000Hz.

float getMinSpl()

Returns the level in dB of the minimum SPL that can be registered by the device at 1000Hz.

MicrophoneInfo.Coordinate3F getOrientation()

Returns A MicrophoneInfo.Coordinate3F object that represents the orientation of microphone.

MicrophoneInfo.Coordinate3F getPosition()

Returns A MicrophoneInfo.Coordinate3F object that represents the geometric location of microphone in meters, from bottom-left-back corner of appliance.

float getSensitivity()

Returns the level in dBFS produced by a 1000Hz tone at 94 dB SPL.

int getType()

Returns the device type identifier of the microphone (e.g AudioDeviceInfo.TYPE_BUILTIN_MIC).

Inherited methods

Constants

CHANNEL_MAPPING_DIRECT

added in API level 28
public static final int CHANNEL_MAPPING_DIRECT

The channel contains raw audio from this microphone.

Constant Value: 1 (0x00000001)

CHANNEL_MAPPING_PROCESSED

added in API level 28
public static final int CHANNEL_MAPPING_PROCESSED

The channel contains processed audio from this microphone and possibly another microphone.

Constant Value: 2 (0x00000002)

DIRECTIONALITY_BI_DIRECTIONAL

added in API level 28
public static final int DIRECTIONALITY_BI_DIRECTIONAL

Microphone directionality type: bi-directional.

Constant Value: 2 (0x00000002)

DIRECTIONALITY_CARDIOID

added in API level 28
public static final int DIRECTIONALITY_CARDIOID

Microphone directionality type: cardioid.

Constant Value: 3 (0x00000003)

DIRECTIONALITY_HYPER_CARDIOID

added in API level 28
public static final int DIRECTIONALITY_HYPER_CARDIOID

Microphone directionality type: hyper cardioid.

Constant Value: 4 (0x00000004)

DIRECTIONALITY_OMNI

added in API level 28
public static final int DIRECTIONALITY_OMNI

Microphone directionality type: omni.

Constant Value: 1 (0x00000001)

DIRECTIONALITY_SUPER_CARDIOID

added in API level 28
public static final int DIRECTIONALITY_SUPER_CARDIOID

Microphone directionality type: super cardioid.

Constant Value: 5 (0x00000005)

DIRECTIONALITY_UNKNOWN

added in API level 28
public static final int DIRECTIONALITY_UNKNOWN

Unknown microphone directionality.

Constant Value: 0 (0x00000000)

GROUP_UNKNOWN

added in API level 28
public static final int GROUP_UNKNOWN

Value used for when the group of the microphone is unknown.

Constant Value: -1 (0xffffffff)

INDEX_IN_THE_GROUP_UNKNOWN

added in API level 28
public static final int INDEX_IN_THE_GROUP_UNKNOWN

Value used for when the index in the group of the microphone is unknown.

Constant Value: -1 (0xffffffff)

LOCATION_MAINBODY

added in API level 28
public static final int LOCATION_MAINBODY

A microphone that locate on main body of the device.

Constant Value: 1 (0x00000001)

LOCATION_MAINBODY_MOVABLE

added in API level 28
public static final int LOCATION_MAINBODY_MOVABLE

A microphone that locate on a movable main body of the device.

Constant Value: 2 (0x00000002)

LOCATION_PERIPHERAL

added in API level 28
public static final int LOCATION_PERIPHERAL

A microphone that locate on a peripheral.

Constant Value: 3 (0x00000003)

LOCATION_UNKNOWN

added in API level 28
public static final int LOCATION_UNKNOWN

A microphone that the location is unknown.

Constant Value: 0 (0x00000000)

SENSITIVITY_UNKNOWN

added in API level 28
public static final float SENSITIVITY_UNKNOWN

Value used for when the sensitivity of the microphone is unknown.

Constant Value: -3.4028235E38

SPL_UNKNOWN

added in API level 28
public static final float SPL_UNKNOWN

Value used for when the SPL of the microphone is unknown. This value could be used when maximum SPL or minimum SPL is unknown.

Constant Value: -3.4028235E38

Fields

ORIENTATION_UNKNOWN

added in API level 28
public static final MicrophoneInfo.Coordinate3F ORIENTATION_UNKNOWN

Value used for when the orientation of the microphone is unknown.

POSITION_UNKNOWN

added in API level 28
public static final MicrophoneInfo.Coordinate3F POSITION_UNKNOWN

Value used for when the position of the microphone is unknown.

Public methods

getAddress

added in API level 28
public String getAddress ()

Returns The "address" string of the microphone that corresponds to the address returned by AudioDeviceInfo.getAddress()

Returns
String the address of the microphone

This value will never be null.

getChannelMapping

added in API level 28
public List<Pair<IntegerInteger>> getChannelMapping ()

Returns a Pair list for channel mapping, which indicating how this microphone is used by each channels or a capture stream. For each Pair, the first value is channel index, the second value is channel mapping type, which could be either CHANNEL_MAPPING_DIRECT or CHANNEL_MAPPING_PROCESSED. If a channel has contributions from more than one microphone, it is likely the HAL did some extra processing to combine the sources, but this is to be inferred by the user. Empty list when the MicrophoneInfo is returned by AudioManager.getMicrophones(). At least one entry when the MicrophoneInfo is returned by AudioRecord.getActiveMicrophones().

Returns
List<Pair<IntegerInteger>> a Pair list for channel mapping

getDescription

added in API level 28
public String getDescription ()

Returns alphanumeric code that uniquely identifies the device.

Returns
String the description of the microphone

getDirectionality

added in API level 28
public int getDirectionality ()

Returns the directionality of microphone. The return value is one of DIRECTIONALITY_UNKNOWN, DIRECTIONALITY_OMNI, DIRECTIONALITY_BI_DIRECTIONAL, DIRECTIONALITY_CARDIOID, DIRECTIONALITY_HYPER_CARDIOID, or DIRECTIONALITY_SUPER_CARDIOID.

Returns
int the directionality of microphone

Value is either 0 or combination of DIRECTIONALITY_UNKNOWN, DIRECTIONALITY_OMNI, DIRECTIONALITY_BI_DIRECTIONAL, DIRECTIONALITY_CARDIOID, DIRECTIONALITY_HYPER_CARDIOID or DIRECTIONALITY_SUPER_CARDIOID.

getFrequencyResponse

added in API level 28
public List<Pair<FloatFloat>> getFrequencyResponse ()

Returns a Pair list of frequency responses. For every Pair in the list, the first value represents frequency in Hz, and the second value represents response in dB.

Returns
List<Pair<FloatFloat>> the frequency response of the microphone

getGroup

added in API level 28
public int getGroup ()

Returns A device group id that can be used to group together microphones on the same peripheral, attachments or logical groups. Main body is usually group 0.

Returns
int the group of the microphone or GROUP_UNKNOWN if the group is unknown

getId

added in API level 28
public int getId ()

Returns The system unique device ID that corresponds to the id returned by AudioDeviceInfo.getId().

Returns
int the microphone's id

getIndexInTheGroup

added in API level 28
public int getIndexInTheGroup ()

Returns unique index for device within its group.

Returns
int the microphone's index in its group or INDEX_IN_THE_GROUP_UNKNOWN if the index in the group is unknown

getLocation

added in API level 28
public int getLocation ()

Returns the location of the microphone. The return value is one of LOCATION_UNKNOWN, LOCATION_MAINBODY, LOCATION_MAINBODY_MOVABLE, or LOCATION_PERIPHERAL.

Returns
int the location of the microphone

Value is either 0 or combination of LOCATION_UNKNOWN, LOCATION_MAINBODY, LOCATION_MAINBODY_MOVABLE or LOCATION_PERIPHERAL.

getMaxSpl

added in API level 28
public float getMaxSpl ()

Returns the level in dB of the maximum SPL supported by the device at 1000Hz.

Returns
float the maximum level in dB or SPL_UNKNOWN if maximum SPL is unknown

getMinSpl

added in API level 28
public float getMinSpl ()

Returns the level in dB of the minimum SPL that can be registered by the device at 1000Hz.

Returns
float the minimum level in dB or SPL_UNKNOWN if minimum SPL is unknown

getOrientation

added in API level 28
public MicrophoneInfo.Coordinate3F getOrientation ()

Returns A MicrophoneInfo.Coordinate3F object that represents the orientation of microphone. X-axis, Y-axis and Z-axis show as the x, y, z value. The orientation will be normalized such as sqrt(x^2 + y^2 + z^2) equals 1.

Returns
MicrophoneInfo.Coordinate3F the orientation of the microphone or ORIENTATION_UNKNOWN if orientation is unknown

getPosition

added in API level 28
public MicrophoneInfo.Coordinate3F getPosition ()

Returns A MicrophoneInfo.Coordinate3F object that represents the geometric location of microphone in meters, from bottom-left-back corner of appliance. X-axis, Y-axis and Z-axis show as the x, y, z values.

Returns
MicrophoneInfo.Coordinate3F the geometric location of the microphone or POSITION_UNKNOWN if the geometric location is unknown

getSensitivity

added in API level 28
public float getSensitivity ()

Returns the level in dBFS produced by a 1000Hz tone at 94 dB SPL.

Returns
float the sensitivity of the microphone or SENSITIVITY_UNKNOWN if the sensitivity is unknown

getType

added in API level 28
public int getType ()

Returns the device type identifier of the microphone (e.g AudioDeviceInfo.TYPE_BUILTIN_MIC).

Returns
int the device type of the microphone