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 |
List<Pair<Integer, Integer>>
|
getChannelMapping()
Returns a |
String
|
getDescription()
Returns alphanumeric code that uniquely identifies the device. |
int
|
getDirectionality()
Returns the directionality of microphone. |
List<Pair<Float, Float>>
|
getFrequencyResponse()
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
|
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
|
getPosition()
Returns A |
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
public static final int CHANNEL_MAPPING_DIRECT
The channel contains raw audio from this microphone.
Constant Value: 1 (0x00000001)
CHANNEL_MAPPING_PROCESSED
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
public static final int DIRECTIONALITY_BI_DIRECTIONAL
Microphone directionality type: bi-directional.
Constant Value: 2 (0x00000002)
DIRECTIONALITY_CARDIOID
public static final int DIRECTIONALITY_CARDIOID
Microphone directionality type: cardioid.
Constant Value: 3 (0x00000003)
DIRECTIONALITY_HYPER_CARDIOID
public static final int DIRECTIONALITY_HYPER_CARDIOID
Microphone directionality type: hyper cardioid.
Constant Value: 4 (0x00000004)
DIRECTIONALITY_OMNI
public static final int DIRECTIONALITY_OMNI
Microphone directionality type: omni.
Constant Value: 1 (0x00000001)
DIRECTIONALITY_SUPER_CARDIOID
public static final int DIRECTIONALITY_SUPER_CARDIOID
Microphone directionality type: super cardioid.
Constant Value: 5 (0x00000005)
DIRECTIONALITY_UNKNOWN
public static final int DIRECTIONALITY_UNKNOWN
Unknown microphone directionality.
Constant Value: 0 (0x00000000)
GROUP_UNKNOWN
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
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
public static final int LOCATION_MAINBODY
A microphone that locate on main body of the device.
Constant Value: 1 (0x00000001)
LOCATION_MAINBODY_MOVABLE
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
public static final int LOCATION_PERIPHERAL
A microphone that locate on a peripheral.
Constant Value: 3 (0x00000003)
LOCATION_UNKNOWN
public static final int LOCATION_UNKNOWN
A microphone that the location is unknown.
Constant Value: 0 (0x00000000)
SENSITIVITY_UNKNOWN
public static final float SENSITIVITY_UNKNOWN
Value used for when the sensitivity of the microphone is unknown.
Constant Value: -3.4028235E38
SPL_UNKNOWN
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
public static final MicrophoneInfo.Coordinate3F ORIENTATION_UNKNOWN
Value used for when the orientation of the microphone is unknown.
POSITION_UNKNOWN
public static final MicrophoneInfo.Coordinate3F POSITION_UNKNOWN
Value used for when the position of the microphone is unknown.
Public methods
getAddress
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 cannot be null . |
getChannelMapping
public List<Pair<Integer, Integer>> 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<Integer, Integer>> |
a Pair list for channel mapping |
getDescription
public String getDescription ()
Returns alphanumeric code that uniquely identifies the device.
Returns | |
---|---|
String |
the description of the microphone |
getDirectionality
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 a combination of DIRECTIONALITY_UNKNOWN , DIRECTIONALITY_OMNI , DIRECTIONALITY_BI_DIRECTIONAL , DIRECTIONALITY_CARDIOID , DIRECTIONALITY_HYPER_CARDIOID , and DIRECTIONALITY_SUPER_CARDIOID |
getFrequencyResponse
public List<Pair<Float, Float>> 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<Float, Float>> |
the frequency response of the microphone |
getGroup
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
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
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
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 a combination of LOCATION_UNKNOWN , LOCATION_MAINBODY , LOCATION_MAINBODY_MOVABLE , and LOCATION_PERIPHERAL |
getMaxSpl
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
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
public MicrophoneInfo.Coordinate3F getOrientation ()
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.
Returns | |
---|---|
MicrophoneInfo.Coordinate3F |
the orientation of the microphone or ORIENTATION_UNKNOWN if orientation
is unknown |
getPosition
public MicrophoneInfo.Coordinate3F getPosition ()
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
PackageManager.FEATURE_AUTOMOTIVE
, axes are defined with respect
to the vehicle body frame, originating from the center of the vehicle's rear axle.
Returns | |
---|---|
MicrophoneInfo.Coordinate3F |
the geometric location of the microphone or POSITION_UNKNOWN if the
geometric location is unknown |
See also:
getSensitivity
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
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 |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.