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 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 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

int CHANNEL_MAPPING_DIRECT

The channel contains raw audio from this microphone.

Constant Value: 1 (0x00000001)

CHANNEL_MAPPING_PROCESSED

int CHANNEL_MAPPING_PROCESSED

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

Constant Value: 2 (0x00000002)

DIRECTIONALITY_BI_DIRECTIONAL

int DIRECTIONALITY_BI_DIRECTIONAL

Microphone directionality type: bi-directional.

Constant Value: 2 (0x00000002)

DIRECTIONALITY_CARDIOID

int DIRECTIONALITY_CARDIOID

Microphone directionality type: cardioid.

Constant Value: 3 (0x00000003)

DIRECTIONALITY_HYPER_CARDIOID

int DIRECTIONALITY_HYPER_CARDIOID

Microphone directionality type: hyper cardioid.

Constant Value: 4 (0x00000004)

DIRECTIONALITY_OMNI

int DIRECTIONALITY_OMNI

Microphone directionality type: omni.

Constant Value: 1 (0x00000001)

DIRECTIONALITY_SUPER_CARDIOID

int DIRECTIONALITY_SUPER_CARDIOID

Microphone directionality type: super cardioid.

Constant Value: 5 (0x00000005)

DIRECTIONALITY_UNKNOWN

int DIRECTIONALITY_UNKNOWN

Unknown microphone directionality.

Constant Value: 0 (0x00000000)

GROUP_UNKNOWN

int GROUP_UNKNOWN

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

Constant Value: -1 (0xffffffff)

INDEX_IN_THE_GROUP_UNKNOWN

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

int LOCATION_MAINBODY

A microphone that locate on main body of the device.

Constant Value: 1 (0x00000001)

LOCATION_MAINBODY_MOVABLE

int LOCATION_MAINBODY_MOVABLE

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

Constant Value: 2 (0x00000002)

LOCATION_PERIPHERAL

int LOCATION_PERIPHERAL

A microphone that locate on a peripheral.

Constant Value: 3 (0x00000003)

LOCATION_UNKNOWN

int LOCATION_UNKNOWN

A microphone that the location is unknown.

Constant Value: 0 (0x00000000)

SENSITIVITY_UNKNOWN

float SENSITIVITY_UNKNOWN

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

Constant Value: -3.4028235E38

SPL_UNKNOWN

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

MicrophoneInfo.Coordinate3F ORIENTATION_UNKNOWN

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

POSITION_UNKNOWN

MicrophoneInfo.Coordinate3F POSITION_UNKNOWN

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

Public methods

getAddress

String getAddress ()

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

Returns
String the address of the microphone

This value will never be null.

getChannelMapping

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

String getDescription ()

Returns alphanumeric code that uniquely identifies the device.

Returns
String the description of the microphone

getDirectionality

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

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

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

int getId ()

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

Returns
int the microphone's id

getIndexInTheGroup

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

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

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

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

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

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

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

int getType ()

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

Returns
int the device type of the microphone