Added in API level 28

MicrophoneInfo

class MicrophoneInfo
kotlin.Any
   ↳ 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

Constants
static Int

The channel contains raw audio from this microphone.

static Int

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

static Int

Microphone directionality type: bi-directional.

static Int

Microphone directionality type: cardioid.

static Int

Microphone directionality type: hyper cardioid.

static Int

Microphone directionality type: omni.

static Int

Microphone directionality type: super cardioid.

static Int

Unknown microphone directionality.

static Int

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

static Int

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

static Int

A microphone that locate on main body of the device.

static Int

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

static Int

A microphone that locate on a peripheral.

static Int

A microphone that the location is unknown.

static Float

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

static Float

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

Public methods
String

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

MutableList<Pair<Int!, Int!>!>!

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

String!

Returns alphanumeric code that uniquely identifies the device.

Int

Returns the directionality of microphone.

MutableList<Pair<Float!, Float!>!>!

Returns a android.util.Pair list of frequency responses.

Int

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

Int

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

Int

Returns unique index for device within its group.

Int

Returns the location of the microphone.

Float

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

Float

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

MicrophoneInfo.Coordinate3F!

Returns A Coordinate3F object that represents the orientation of microphone.

MicrophoneInfo.Coordinate3F!

Returns A Coordinate3F object that represents the geometric location of microphone in meters.

Float

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

Int

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

Properties
static MicrophoneInfo.Coordinate3F!

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

static MicrophoneInfo.Coordinate3F!

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

Constants

CHANNEL_MAPPING_DIRECT

Added in API level 28
static val CHANNEL_MAPPING_DIRECT: Int

The channel contains raw audio from this microphone.

Value: 1

CHANNEL_MAPPING_PROCESSED

Added in API level 28
static val CHANNEL_MAPPING_PROCESSED: Int

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

Value: 2

DIRECTIONALITY_BI_DIRECTIONAL

Added in API level 28
static val DIRECTIONALITY_BI_DIRECTIONAL: Int

Microphone directionality type: bi-directional.

Value: 2

DIRECTIONALITY_CARDIOID

Added in API level 28
static val DIRECTIONALITY_CARDIOID: Int

Microphone directionality type: cardioid.

Value: 3

DIRECTIONALITY_HYPER_CARDIOID

Added in API level 28
static val DIRECTIONALITY_HYPER_CARDIOID: Int

Microphone directionality type: hyper cardioid.

Value: 4

DIRECTIONALITY_OMNI

Added in API level 28
static val DIRECTIONALITY_OMNI: Int

Microphone directionality type: omni.

Value: 1

DIRECTIONALITY_SUPER_CARDIOID

Added in API level 28
static val DIRECTIONALITY_SUPER_CARDIOID: Int

Microphone directionality type: super cardioid.

Value: 5

DIRECTIONALITY_UNKNOWN

Added in API level 28
static val DIRECTIONALITY_UNKNOWN: Int

Unknown microphone directionality.

Value: 0

GROUP_UNKNOWN

Added in API level 28
static val GROUP_UNKNOWN: Int

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

Value: -1

INDEX_IN_THE_GROUP_UNKNOWN

Added in API level 28
static val INDEX_IN_THE_GROUP_UNKNOWN: Int

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

Value: -1

LOCATION_MAINBODY

Added in API level 28
static val LOCATION_MAINBODY: Int

A microphone that locate on main body of the device.

Value: 1

LOCATION_MAINBODY_MOVABLE

Added in API level 28
static val LOCATION_MAINBODY_MOVABLE: Int

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

Value: 2

LOCATION_PERIPHERAL

Added in API level 28
static val LOCATION_PERIPHERAL: Int

A microphone that locate on a peripheral.

Value: 3

LOCATION_UNKNOWN

Added in API level 28
static val LOCATION_UNKNOWN: Int

A microphone that the location is unknown.

Value: 0

SENSITIVITY_UNKNOWN

Added in API level 28
static val SENSITIVITY_UNKNOWN: Float

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

Value: -3.4028235E38f

SPL_UNKNOWN

Added in API level 28
static val SPL_UNKNOWN: Float

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

Value: -3.4028235E38f

Public methods

getAddress

Added in API level 28
fun getAddress(): String

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

Return
String the address of the microphone This value cannot be null.

getChannelMapping

Added in API level 28
fun getChannelMapping(): MutableList<Pair<Int!, Int!>!>!

Returns a android.util.Pair list for channel mapping, which indicating how this microphone is used by each channels or a capture stream. For each android.util.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().

Return
MutableList<Pair<Int!, Int!>!>! a android.util.Pair list for channel mapping

getDescription

Added in API level 28
fun getDescription(): String!

Returns alphanumeric code that uniquely identifies the device.

Return
String! the description of the microphone

getFrequencyResponse

Added in API level 28
fun getFrequencyResponse(): MutableList<Pair<Float!, Float!>!>!

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

Return
MutableList<Pair<Float!, Float!>!>! the frequency response of the microphone

getGroup

Added in API level 28
fun getGroup(): Int

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.

Return
Int the group of the microphone or GROUP_UNKNOWN if the group is unknown

getId

Added in API level 28
fun getId(): Int

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

Return
Int the microphone's id

getIndexInTheGroup

Added in API level 28
fun getIndexInTheGroup(): Int

Returns unique index for device within its group.

Return
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
fun getLocation(): Int

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

Return
Int the location of the microphone Value is either 0 or a combination of android.media.MicrophoneInfo#LOCATION_UNKNOWN, android.media.MicrophoneInfo#LOCATION_MAINBODY, android.media.MicrophoneInfo#LOCATION_MAINBODY_MOVABLE, and android.media.MicrophoneInfo#LOCATION_PERIPHERAL

getMaxSpl

Added in API level 28
fun getMaxSpl(): Float

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

Return
Float the maximum level in dB or SPL_UNKNOWN if maximum SPL is unknown

getMinSpl

Added in API level 28
fun getMinSpl(): Float

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

Return
Float the minimum level in dB or SPL_UNKNOWN if minimum SPL is unknown

getOrientation

Added in API level 28
fun getOrientation(): MicrophoneInfo.Coordinate3F!

Returns A 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.

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

getPosition

Added in API level 28
fun getPosition(): MicrophoneInfo.Coordinate3F!

Returns A Coordinate3F object that represents the geometric location of microphone in meters. X-axis, Y-axis and Z-axis show as the x, y, z values. For mobile devices, the axes originate from the bottom-left-back corner of the appliance. In devices with android.content.pm.PackageManager#FEATURE_AUTOMOTIVE, axes are defined with respect to the vehicle body frame, originating from the center of the vehicle's rear axle.

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

See Also

    getSensitivity

    Added in API level 28
    fun getSensitivity(): Float

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

    Return
    Float the sensitivity of the microphone or SENSITIVITY_UNKNOWN if the sensitivity is unknown

    getType

    Added in API level 28
    fun getType(): Int

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

    Return
    Int the device type of the microphone

    Properties

    ORIENTATION_UNKNOWN

    Added in API level 28
    static val ORIENTATION_UNKNOWN: MicrophoneInfo.Coordinate3F!

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

    POSITION_UNKNOWN

    Added in API level 28
    static val POSITION_UNKNOWN: MicrophoneInfo.Coordinate3F!

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