DynamicsProcessing
class DynamicsProcessing : AudioEffect
kotlin.Any | ||
↳ | android.media.audiofx.AudioEffect | |
↳ | android.media.audiofx.DynamicsProcessing |
DynamicsProcessing is an audio effect for equalizing and changing dynamic range properties of the sound. It is composed of multiple stages including equalization, multi-band compression and limiter.
The number of bands and active stages is configurable, and most parameters can be controlled in realtime, such as gains, attack/release times, thresholds, etc.
The effect is instantiated and controlled by channels. Each channel has the same basic architecture, but all of their parameters are independent from other channels.
The basic channel configuration is:
Channel 0 Channel 1 .... Channel N-1 Input Input Input | | | +----v----+ +----v----+ +----v----+ |inputGain| |inputGain| |inputGain| +---------+ +---------+ +---------+ | | | +-----v-----+ +-----v-----+ +-----v-----+ | PreEQ | | PreEQ | | PreEQ | +-----------+ +-----------+ +-----------+ | | | +-----v-----+ +-----v-----+ +-----v-----+ | MBC | | MBC | | MBC | +-----------+ +-----------+ +-----------+ | | | +-----v-----+ +-----v-----+ +-----v-----+ | PostEQ | | PostEQ | | PostEQ | +-----------+ +-----------+ +-----------+ | | | +-----v-----+ +-----v-----+ +-----v-----+ | Limiter | | Limiter | | Limiter | +-----------+ +-----------+ +-----------+ | | | Output Output Output
Where the stages are: inputGain: input gain factor in decibels (dB). 0 dB means no change in level. PreEQ: Multi-band Equalizer. MBC: Multi-band Compressor PostEQ: Multi-band Equalizer Limiter: Single band compressor/limiter.
An application creates a DynamicsProcessing object to instantiate and control this audio effect in the audio framework. A DynamicsProcessor.Config and DynamicsProcessor.Config.Builder are available to help configure the multiple stages and each band parameters if desired.
See each stage documentation for further details.
If no Config is specified during creation, a default configuration is chosen.
To attach the DynamicsProcessing to a particular AudioTrack or MediaPlayer, specify the audio session ID of this AudioTrack or MediaPlayer when constructing the effect (see AudioTrack#getAudioSessionId()
and MediaPlayer#getAudioSessionId()
).
To attach the DynamicsProcessing to a particular AudioTrack or MediaPlayer, specify the audio session ID of this AudioTrack or MediaPlayer when constructing the DynamicsProcessing.
See android.media.MediaPlayer#getAudioSessionId()
for details on audio sessions.
See android.media.audiofx.AudioEffect
class for more details on controlling audio effects.
Summary
Nested classes | |
---|---|
Base class for bands |
|
Base class for stages that hold bands |
|
Class for Channel configuration parameters. |
|
Class for Config object, used by DynamicsProcessing to configure and update the audio effect. |
|
Class for Equalizer stage |
|
Class for Equalizer Bands Equalizer bands have three controllable parameters: enabled/disabled, cutoffFrequency and gain |
|
Class for Limiter Stage Limiter is a single band compressor at the end of the processing chain, commonly used to protect the signal from overloading and distortion. |
|
Class for Multi-Band Compressor (MBC) stage |
|
Class for Multi-Band compressor bands MBC bands have multiple controllable parameters: enabled/disabled, cutoffFrequency, attackTime, releaseTime, ratio, threshold, kneeWidth, noiseGateThreshold, expanderRatio, preGain and postGain. |
|
base class for the different stages. |
Constants | |
---|---|
static Int |
Index of variant that favors frequency resolution. |
static Int |
Index of variant that favors time resolution resolution. |
Inherited constants | |
---|---|
Public constructors | |
---|---|
DynamicsProcessing(audioSession: Int) Class constructor. |
|
DynamicsProcessing(priority: Int, audioSession: Int, cfg: DynamicsProcessing.Config?) Class constructor for the DynamicsProcessing audio effect |
Inherited functions | |
---|---|
Inherited properties | |
---|---|
Constants
VARIANT_FAVOR_FREQUENCY_RESOLUTION
static val VARIANT_FAVOR_FREQUENCY_RESOLUTION: Int
Index of variant that favors frequency resolution. Frequency domain based implementation.
Value: 0
VARIANT_FAVOR_TIME_RESOLUTION
static val VARIANT_FAVOR_TIME_RESOLUTION: Int
Index of variant that favors time resolution resolution. Time domain based implementation.
Value: 1
Public constructors
DynamicsProcessing
DynamicsProcessing(audioSession: Int)
Class constructor.
Parameters | |
---|---|
audioSession |
Int: system-wide unique audio session identifier. The DynamicsProcessing will be attached to the MediaPlayer or AudioTrack in the same audio session. |
DynamicsProcessing
DynamicsProcessing(
priority: Int,
audioSession: Int,
cfg: DynamicsProcessing.Config?)
Class constructor for the DynamicsProcessing audio effect
Parameters | |
---|---|
priority |
Int: the priority level requested by the application for controlling the DynamicsProcessing engine. As the same engine can be shared by several applications, this parameter indicates how much the requesting application needs control of effect parameters. The normal priority is 0, above normal is a positive number, below normal a negative number. |
audioSession |
Int: system-wide unique audio session identifier. The DynamicsProcessing will be attached to the MediaPlayer or AudioTrack in the same audio session. |
cfg |
DynamicsProcessing.Config?: Config object used to setup the audio effect, including bands per stage, and specific parameters for each stage/band. Use android.media.audiofx.DynamicsProcessing.Config.Builder to create a Config object that suits your needs. A null cfg parameter will create and use a default configuration for the effect |
Public methods
getChannelByChannelIndex
fun getChannelByChannelIndex(channelIndex: Int): DynamicsProcessing.Channel!
getChannelCount
fun getChannelCount(): Int
Gets the number of channels in the effect engine
Return | |
---|---|
Int |
number of channels currently in use by the effect engine |
getConfig
fun getConfig(): DynamicsProcessing.Config!
Returns the Config object used to setup this effect.
Return | |
---|---|
DynamicsProcessing.Config! |
Config Current Config object used to setup this DynamicsProcessing effect. |
getInputGainByChannelIndex
fun getInputGainByChannelIndex(channelIndex: Int): Float
getLimiterByChannelIndex
fun getLimiterByChannelIndex(channelIndex: Int): DynamicsProcessing.Limiter!
getMbcBandByChannelIndex
fun getMbcBandByChannelIndex(
channelIndex: Int,
band: Int
): DynamicsProcessing.MbcBand!
getMbcByChannelIndex
fun getMbcByChannelIndex(channelIndex: Int): DynamicsProcessing.Mbc!
getPostEqBandByChannelIndex
fun getPostEqBandByChannelIndex(
channelIndex: Int,
band: Int
): DynamicsProcessing.EqBand!
getPostEqByChannelIndex
fun getPostEqByChannelIndex(channelIndex: Int): DynamicsProcessing.Eq!
getPreEqBandByChannelIndex
fun getPreEqBandByChannelIndex(
channelIndex: Int,
band: Int
): DynamicsProcessing.EqBand!
getPreEqByChannelIndex
fun getPreEqByChannelIndex(channelIndex: Int): DynamicsProcessing.Eq!
setAllChannelsTo
fun setAllChannelsTo(channel: DynamicsProcessing.Channel!): Unit
setChannelTo
fun setChannelTo(
channelIndex: Int,
channel: DynamicsProcessing.Channel!
): Unit
setInputGainAllChannelsTo
fun setInputGainAllChannelsTo(inputGain: Float): Unit
setInputGainbyChannel
fun setInputGainbyChannel(
channelIndex: Int,
inputGain: Float
): Unit
setLimiterAllChannelsTo
fun setLimiterAllChannelsTo(limiter: DynamicsProcessing.Limiter!): Unit
setLimiterByChannelIndex
fun setLimiterByChannelIndex(
channelIndex: Int,
limiter: DynamicsProcessing.Limiter!
): Unit
setMbcAllChannelsTo
fun setMbcAllChannelsTo(mbc: DynamicsProcessing.Mbc!): Unit
setMbcBandAllChannelsTo
fun setMbcBandAllChannelsTo(
band: Int,
mbcBand: DynamicsProcessing.MbcBand!
): Unit
setMbcBandByChannelIndex
fun setMbcBandByChannelIndex(
channelIndex: Int,
band: Int,
mbcBand: DynamicsProcessing.MbcBand!
): Unit
setMbcByChannelIndex
fun setMbcByChannelIndex(
channelIndex: Int,
mbc: DynamicsProcessing.Mbc!
): Unit
setPostEqAllChannelsTo
fun setPostEqAllChannelsTo(postEq: DynamicsProcessing.Eq!): Unit
setPostEqBandAllChannelsTo
fun setPostEqBandAllChannelsTo(
band: Int,
postEqBand: DynamicsProcessing.EqBand!
): Unit
setPostEqBandByChannelIndex
fun setPostEqBandByChannelIndex(
channelIndex: Int,
band: Int,
postEqBand: DynamicsProcessing.EqBand!
): Unit
setPostEqByChannelIndex
fun setPostEqByChannelIndex(
channelIndex: Int,
postEq: DynamicsProcessing.Eq!
): Unit
setPreEqAllChannelsTo
fun setPreEqAllChannelsTo(preEq: DynamicsProcessing.Eq!): Unit
setPreEqBandAllChannelsTo
fun setPreEqBandAllChannelsTo(
band: Int,
preEqBand: DynamicsProcessing.EqBand!
): Unit
setPreEqBandByChannelIndex
fun setPreEqBandByChannelIndex(
channelIndex: Int,
band: Int,
preEqBand: DynamicsProcessing.EqBand!
): Unit
setPreEqByChannelIndex
fun setPreEqByChannelIndex(
channelIndex: Int,
preEq: DynamicsProcessing.Eq!
): Unit