Added in API level 16

AutomaticGainControl

open class AutomaticGainControl : AudioEffect
kotlin.Any
   ↳ android.media.audiofx.AudioEffect
   ↳ android.media.audiofx.AutomaticGainControl

Automatic Gain Control (AGC).

Automatic Gain Control (AGC) is an audio pre-processor which automatically normalizes the output of the captured signal by boosting or lowering input from the microphone to match a preset level so that the output signal level is virtually constant. AGC can be used by applications where the input signal dynamic range is not important but where a constant strong capture level is desired.

An application creates a AutomaticGainControl object to instantiate and control an AGC engine in the audio framework.

To attach the AutomaticGainControl to a particular android.media.AudioRecord, specify the audio session ID of this AudioRecord when creating the AutomaticGainControl. The audio session is retrieved by calling android.media.AudioRecord#getAudioSessionId() on the AudioRecord instance.

On some devices, an AGC can be inserted by default in the capture path by the platform according to the android.media.MediaRecorder.AudioSource used. The application should call AutomaticGainControl.getEnable() after creating the AGC to check the default AGC activation state on a particular AudioRecord session.

See android.media.audiofx.AudioEffect class for more details on controlling audio effects.

Summary

Inherited constants
Public methods
open static AutomaticGainControl!
create(audioSession: Int)

Creates an AutomaticGainControl and attaches it to the AudioRecord on the audio session specified.

open static Boolean

Checks if the device implements automatic gain control.

Inherited functions
Inherited properties

Public methods

create

Added in API level 16
open static fun create(audioSession: Int): AutomaticGainControl!

Creates an AutomaticGainControl and attaches it to the AudioRecord on the audio session specified.

Parameters
audioSession Int: system wide unique audio session identifier. The AutomaticGainControl will be applied to the AudioRecord with the same audio session.
Return
AutomaticGainControl! AutomaticGainControl created or null if the device does not implement AGC.

isAvailable

Added in API level 16
open static fun isAvailable(): Boolean

Checks if the device implements automatic gain control.

Return
Boolean true if the device implements automatic gain control, false otherwise.