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 |
MutableList<Pair<Int!, Int!>!>! |
Returns a |
String! |
Returns alphanumeric code that uniquely identifies the device. |
Int |
Returns the directionality of microphone. |
MutableList<Pair<Float!, Float!>!>! |
Returns a |
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 |
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 |
MicrophoneInfo.Coordinate3F! |
Returns A |
Float |
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). |
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
static val CHANNEL_MAPPING_DIRECT: Int
The channel contains raw audio from this microphone.
Value: 1
CHANNEL_MAPPING_PROCESSED
static val CHANNEL_MAPPING_PROCESSED: Int
The channel contains processed audio from this microphone and possibly another microphone.
Value: 2
DIRECTIONALITY_BI_DIRECTIONAL
static val DIRECTIONALITY_BI_DIRECTIONAL: Int
Microphone directionality type: bi-directional.
Value: 2
DIRECTIONALITY_CARDIOID
static val DIRECTIONALITY_CARDIOID: Int
Microphone directionality type: cardioid.
Value: 3
DIRECTIONALITY_HYPER_CARDIOID
static val DIRECTIONALITY_HYPER_CARDIOID: Int
Microphone directionality type: hyper cardioid.
Value: 4
DIRECTIONALITY_OMNI
static val DIRECTIONALITY_OMNI: Int
Microphone directionality type: omni.
Value: 1
DIRECTIONALITY_SUPER_CARDIOID
static val DIRECTIONALITY_SUPER_CARDIOID: Int
Microphone directionality type: super cardioid.
Value: 5
DIRECTIONALITY_UNKNOWN
static val DIRECTIONALITY_UNKNOWN: Int
Unknown microphone directionality.
Value: 0
GROUP_UNKNOWN
static val GROUP_UNKNOWN: Int
Value used for when the group of the microphone is unknown.
Value: -1
INDEX_IN_THE_GROUP_UNKNOWN
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
static val LOCATION_MAINBODY: Int
A microphone that locate on main body of the device.
Value: 1
LOCATION_MAINBODY_MOVABLE
static val LOCATION_MAINBODY_MOVABLE: Int
A microphone that locate on a movable main body of the device.
Value: 2
LOCATION_PERIPHERAL
static val LOCATION_PERIPHERAL: Int
A microphone that locate on a peripheral.
Value: 3
LOCATION_UNKNOWN
static val LOCATION_UNKNOWN: Int
A microphone that the location is unknown.
Value: 0
SENSITIVITY_UNKNOWN
static val SENSITIVITY_UNKNOWN: Float
Value used for when the sensitivity of the microphone is unknown.
Value: -3.4028235E38f
SPL_UNKNOWN
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
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
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
fun getDescription(): String!
Returns alphanumeric code that uniquely identifies the device.
Return | |
---|---|
String! |
the description of the microphone |
getDirectionality
fun getDirectionality(): Int
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
.
Return | |
---|---|
Int |
the directionality of microphone Value is either 0 or a combination of android.media.MicrophoneInfo#DIRECTIONALITY_UNKNOWN , android.media.MicrophoneInfo#DIRECTIONALITY_OMNI , android.media.MicrophoneInfo#DIRECTIONALITY_BI_DIRECTIONAL , android.media.MicrophoneInfo#DIRECTIONALITY_CARDIOID , android.media.MicrophoneInfo#DIRECTIONALITY_HYPER_CARDIOID , and android.media.MicrophoneInfo#DIRECTIONALITY_SUPER_CARDIOID |
getFrequencyResponse
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
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
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
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
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
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
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
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
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
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
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
static val ORIENTATION_UNKNOWN: MicrophoneInfo.Coordinate3F!
Value used for when the orientation of the microphone is unknown.
POSITION_UNKNOWN
static val POSITION_UNKNOWN: MicrophoneInfo.Coordinate3F!
Value used for when the position of the microphone is unknown.