DynamicsProcessing
  public
  
  final
  
  class
  DynamicsProcessing
  
  
  
  
    extends AudioEffect
  
  
  
  
  
  
  
    
  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 MediaPlayer.getAudioSessionId() for details on audio sessions.
 
See AudioEffect class for more details on controlling audio
 effects.
Summary
| Nested classes | 
|---|
  
    
      | 
        
        
        
        
        class | DynamicsProcessing.BandBaseBase class for bands 
        
    
 | 
    
    
    
      | 
        
        
        
        
        class | DynamicsProcessing.BandStageBase class for stages that hold bands 
        
    
 | 
    
    
    
      | 
        
        
        
        
        class | DynamicsProcessing.ChannelClass for Channel configuration parameters. 
        
    
 | 
    
    
    
      | 
        
        
        
        
        class | DynamicsProcessing.ConfigClass for Config object, used by DynamicsProcessing to configure and update the audio effect. 
        
    
 | 
    
    
    
      | 
        
        
        
        
        class | DynamicsProcessing.EqClass for Equalizer stage 
        
    
 | 
    
    
    
      | 
        
        
        
        
        class | DynamicsProcessing.EqBandClass for Equalizer Bands
 Equalizer bands have three controllable parameters: enabled/disabled, cutoffFrequency and
 gain 
        
    
 | 
    
    
    
      | 
        
        
        
        
        class | DynamicsProcessing.LimiterClass 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 | DynamicsProcessing.MbcClass for Multi-Band Compressor (MBC) stage 
        
    
 | 
    
    
    
      | 
        
        
        
        
        class | DynamicsProcessing.MbcBandClass for Multi-Band compressor bands
 MBC bands have multiple controllable parameters: enabled/disabled, cutoffFrequency,
 attackTime, releaseTime, ratio, threshold, kneeWidth, noiseGateThreshold, expanderRatio,
 preGain and postGain. 
        
    
 | 
    
    
    
      | 
        
        
        
        
        class | DynamicsProcessing.Stagebase class for the different stages. 
        
    
 | 
    
    
| Public methods | 
|---|
  
  
  
    | 
        
        
        
        
        
        DynamicsProcessing.Channel | 
      getChannelByChannelIndex(int channelIndex)
       | 
  
  
  
  
    | 
        
        
        
        
        
        int | 
      getChannelCount()
      Gets the number of channels in the effect engine
        
    
 | 
  
  
  
  
    | 
        
        
        
        
        
        DynamicsProcessing.Config | 
      getConfig()
      Returns the Config object used to setup this effect.
        
    
 | 
  
  
  
  
    | 
        
        
        
        
        
        float | 
      getInputGainByChannelIndex(int channelIndex)
       | 
  
  
  
  
    | 
        
        
        
        
        
        DynamicsProcessing.Limiter | 
      getLimiterByChannelIndex(int channelIndex)
       | 
  
  
  
  
    | 
        
        
        
        
        
        DynamicsProcessing.MbcBand | 
      getMbcBandByChannelIndex(int channelIndex, int band)
       | 
  
  
  
  
    | 
        
        
        
        
        
        DynamicsProcessing.Mbc | 
      getMbcByChannelIndex(int channelIndex)
       | 
  
  
  
  
    | 
        
        
        
        
        
        DynamicsProcessing.EqBand | 
      getPostEqBandByChannelIndex(int channelIndex, int band)
       | 
  
  
  
  
    | 
        
        
        
        
        
        DynamicsProcessing.Eq | 
      getPostEqByChannelIndex(int channelIndex)
       | 
  
  
  
  
    | 
        
        
        
        
        
        DynamicsProcessing.EqBand | 
      getPreEqBandByChannelIndex(int channelIndex, int band)
       | 
  
  
  
  
    | 
        
        
        
        
        
        DynamicsProcessing.Eq | 
      getPreEqByChannelIndex(int channelIndex)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setAllChannelsTo(DynamicsProcessing.Channel channel)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setChannelTo(int channelIndex, DynamicsProcessing.Channel channel)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setInputGainAllChannelsTo(float inputGain)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setInputGainbyChannel(int channelIndex, float inputGain)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setLimiterAllChannelsTo(DynamicsProcessing.Limiter limiter)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setLimiterByChannelIndex(int channelIndex, DynamicsProcessing.Limiter limiter)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setMbcAllChannelsTo(DynamicsProcessing.Mbc mbc)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setMbcBandAllChannelsTo(int band, DynamicsProcessing.MbcBand mbcBand)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setMbcBandByChannelIndex(int channelIndex, int band, DynamicsProcessing.MbcBand mbcBand)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setMbcByChannelIndex(int channelIndex, DynamicsProcessing.Mbc mbc)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setPostEqAllChannelsTo(DynamicsProcessing.Eq postEq)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setPostEqBandAllChannelsTo(int band, DynamicsProcessing.EqBand postEqBand)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setPostEqBandByChannelIndex(int channelIndex, int band, DynamicsProcessing.EqBand postEqBand)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setPostEqByChannelIndex(int channelIndex, DynamicsProcessing.Eq postEq)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setPreEqAllChannelsTo(DynamicsProcessing.Eq preEq)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setPreEqBandAllChannelsTo(int band, DynamicsProcessing.EqBand preEqBand)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setPreEqBandByChannelIndex(int channelIndex, int band, DynamicsProcessing.EqBand preEqBand)
       | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      setPreEqByChannelIndex(int channelIndex, DynamicsProcessing.Eq preEq)
       | 
  
| Inherited methods | 
|---|
|  | 
| 
    From class
      
        
          java.lang.Object
        
      
      
  
  
  
    | 
        
        
        
        
        
        Object | 
      clone()
      Creates and returns a copy of this object.
        
    
 |  
  
  
    | 
        
        
        
        
        
        boolean | 
      equals(Object obj)
      Indicates whether some other object is "equal to" this one.
        
    
 |  
  
  
    | 
        
        
        
        
        
        void | 
      finalize()
      Called by the garbage collector on an object when garbage collection
 determines that there are no more references to the object.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        Class<?> | 
      getClass()
      Returns the runtime class of this Object. |  
  
  
    | 
        
        
        
        
        
        int | 
      hashCode()
      Returns a hash code value for the object.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      notify()
      Wakes up a single thread that is waiting on this object's
 monitor.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      notifyAll()
      Wakes up all threads that are waiting on this object's monitor.
        
    
 |  
  
  
    | 
        
        
        
        
        
        String | 
      toString()
      Returns a string representation of the object.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      wait(long timeoutMillis, int nanos)
      Causes the current thread to wait until it is awakened, typically
 by being notified or interrupted, or until a
 certain amount of real time has elapsed.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      wait(long timeoutMillis)
      Causes the current thread to wait until it is awakened, typically
 by being notified or interrupted, or until a
 certain amount of real time has elapsed.
        
    
 |  
  
  
    | 
        
        
        
        final
        
        void | 
      wait()
      Causes the current thread to wait until it is awakened, typically
 by being notified or interrupted.
        
    
 |  | 
Constants
    VARIANT_FAVOR_FREQUENCY_RESOLUTION
    
public static final int VARIANT_FAVOR_FREQUENCY_RESOLUTION
    
    
    
  Index of variant that favors frequency resolution. Frequency domain based implementation.
    
      Constant Value:
      
          0
          (0x00000000)
      
    
 
    VARIANT_FAVOR_TIME_RESOLUTION
    
public static final int VARIANT_FAVOR_TIME_RESOLUTION
    
    
    
  Index of variant that favors time resolution resolution. Time domain based implementation.
    
      Constant Value:
      
          1
          (0x00000001)
      
    
 
Public constructors
    DynamicsProcessing
    
public DynamicsProcessing (int audioSession)
    
    
    
  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. | 
    
 
    
    
public DynamicsProcessing (int priority, 
                int audioSession, 
                DynamicsProcessing.Config cfg)
    
    
    
  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. UseDynamicsProcessing.Config.Builderto 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
    
public DynamicsProcessing.Channel getChannelByChannelIndex (int channelIndex)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
    
    
 
    getChannelCount
    
public int getChannelCount ()
    
    
    
  Gets the number of channels in the effect engine
    
      | Returns | 
|---|
      
        | int | number of channels currently in use by the effect engine | 
    
 
    
    
public float getInputGainByChannelIndex (int channelIndex)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
    
    
 
    getLimiterByChannelIndex
    
public DynamicsProcessing.Limiter getLimiterByChannelIndex (int channelIndex)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
    
    
 
    getMbcBandByChannelIndex
    
public DynamicsProcessing.MbcBand getMbcBandByChannelIndex (int channelIndex, 
                int band)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
      
        | band | int | 
    
    
 
    getMbcByChannelIndex
    
public DynamicsProcessing.Mbc getMbcByChannelIndex (int channelIndex)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
    
    
 
    getPostEqBandByChannelIndex
    
public DynamicsProcessing.EqBand getPostEqBandByChannelIndex (int channelIndex, 
                int band)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
      
        | band | int | 
    
    
 
    getPostEqByChannelIndex
    
public DynamicsProcessing.Eq getPostEqByChannelIndex (int channelIndex)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
    
    
 
    getPreEqBandByChannelIndex
    
public DynamicsProcessing.EqBand getPreEqBandByChannelIndex (int channelIndex, 
                int band)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
      
        | band | int | 
    
    
 
    getPreEqByChannelIndex
    
public DynamicsProcessing.Eq getPreEqByChannelIndex (int channelIndex)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
    
    
 
    
    
public void setChannelTo (int channelIndex, 
                DynamicsProcessing.Channel channel)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
      
        | channel | DynamicsProcessing.Channel | 
    
 
    
    
public void setInputGainAllChannelsTo (float inputGain)
    
    
    
  
    
    | Parameters | 
|---|
      
        | inputGain | float | 
    
 
    
    
public void setInputGainbyChannel (int channelIndex, 
                float inputGain)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
      
        | inputGain | float | 
    
 
    
    
public void setLimiterByChannelIndex (int channelIndex, 
                DynamicsProcessing.Limiter limiter)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
      
        | limiter | DynamicsProcessing.Limiter | 
    
 
    
    
public void setMbcBandAllChannelsTo (int band, 
                DynamicsProcessing.MbcBand mbcBand)
    
    
    
  
    
    | Parameters | 
|---|
      
        | band | int | 
      
        | mbcBand | DynamicsProcessing.MbcBand | 
    
 
    
    
public void setMbcBandByChannelIndex (int channelIndex, 
                int band, 
                DynamicsProcessing.MbcBand mbcBand)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
      
        | band | int | 
      
        | mbcBand | DynamicsProcessing.MbcBand | 
    
 
    
    
public void setMbcByChannelIndex (int channelIndex, 
                DynamicsProcessing.Mbc mbc)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
      
        | mbc | DynamicsProcessing.Mbc | 
    
 
    setPostEqAllChannelsTo
    
public void setPostEqAllChannelsTo (DynamicsProcessing.Eq postEq)
    
    
    
  
    
    | Parameters | 
|---|
      
        | postEq | DynamicsProcessing.Eq | 
    
 
    setPostEqBandAllChannelsTo
    
public void setPostEqBandAllChannelsTo (int band, 
                DynamicsProcessing.EqBand postEqBand)
    
    
    
  
    
    | Parameters | 
|---|
      
        | band | int | 
      
        | postEqBand | DynamicsProcessing.EqBand | 
    
 
    setPostEqBandByChannelIndex
    
public void setPostEqBandByChannelIndex (int channelIndex, 
                int band, 
                DynamicsProcessing.EqBand postEqBand)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
      
        | band | int | 
      
        | postEqBand | DynamicsProcessing.EqBand | 
    
 
    setPostEqByChannelIndex
    
public void setPostEqByChannelIndex (int channelIndex, 
                DynamicsProcessing.Eq postEq)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
      
        | postEq | DynamicsProcessing.Eq | 
    
 
    
    
public void setPreEqBandAllChannelsTo (int band, 
                DynamicsProcessing.EqBand preEqBand)
    
    
    
  
    
    | Parameters | 
|---|
      
        | band | int | 
      
        | preEqBand | DynamicsProcessing.EqBand | 
    
 
    
    
public void setPreEqBandByChannelIndex (int channelIndex, 
                int band, 
                DynamicsProcessing.EqBand preEqBand)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
      
        | band | int | 
      
        | preEqBand | DynamicsProcessing.EqBand | 
    
 
    
    
public void setPreEqByChannelIndex (int channelIndex, 
                DynamicsProcessing.Eq preEq)
    
    
    
  
    
    | Parameters | 
|---|
      
        | channelIndex | int | 
      
        | preEq | DynamicsProcessing.Eq | 
    
 
  
  
    
  
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  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 2025-02-10 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]