Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
Toggle table of contents sidebar

# Limiter Stages

Limiter Stages allow the amplitude of the signal to be restricted based on its envelope.

## LimiterRMS

class audio_dsp.stages.LimiterRMS(**kwargs)

  A limiter based on the RMS value of the signal. When the RMS envelope of the signal exceeds the threshold, the signal amplitude is reduced.

  The threshold sets the value above which limiting occurs. The attack time sets how fast the limiter starts limiting. The release time sets how long the signal takes to ramp up to its original level after the envelope is below the threshold.

  Attributes:
    dsp_block `audio_dsp.dsp.drc.drc.limiter_rms`

      The DSP block class; see RMS Limiter for implementation details.

  make_limiter_rms(threshold_db, attack_t, release_t, Q_sig=27)

    Update limiter configuration based on new parameters.

    Parameters:
      threshold_db float

        Threshold in decibels above which limiting occurs.

      attack_t float

        Attack time of the limiter in seconds.

      release_t float

        Release time of the limiter in seconds.

  set_parameters(
    parameters: LimiterRMSParameters,
  )

    Update limiter configuration based on new parameters.

    Parameters:
      parameters LimiterParameters

        The parameters to update the limiter with.

pydantic model audio_dsp.models.limiter.LimiterRMSParameters

  Parameters for RMS limiter stage.

  field attack_t: float = 0.01

    Time in seconds for limiter to start limiting

    Constraints:

      - gt = 0

      - le = 1

  field release_t: float = 0.2

    Time in seconds for signal to return to original level

    Constraints:

      - gt = 0

      - le = 5

  field threshold_db: float = 0.0

    Level in dB above which limiting occurs

    Constraints:

      - ge = -81.27809882927492

      - le = 12.041199858916709

### LimiterRMS Control

The following runtime command ids are available for the LimiterRMS Stage. For details on reading and writing these commands, see the Run-Time Control User Guide.

Control parameter | Payload length
--- | ---
CMD_LIMITER_RMS_ATTACK_ALPHA | `sizeof(int32_t)`
The attack alpha in Q0.31 format. To convert an attack time in seconds to an `int32_t` control value, use the function `calc_alpha()` in `control/helpers.h`. |
CMD_LIMITER_RMS_RELEASE_ALPHA | `sizeof(int32_t)`
The release alpha in Q0.31 format. To convert a release time in seconds to an `int32_t` control value, use the function `calc_alpha()` in `control/helpers.h`. |
CMD_LIMITER_RMS_ENVELOPE | `sizeof(int32_t)`
The current RMS² envelope of the signal in Q_SIG format. To read the `int32_t` control value, use the function `qxx_to_db_pow()` in `control/helpers.h` with Q=Q_SIG. This command is read only. When sending a write control command, it will be ignored. |
CMD_LIMITER_RMS_THRESHOLD | `sizeof(int32_t)`
The threshold in Q_SIG format above which limiting will occur. To convert a threshold in dB to the `int32_t` control value, use the function `calculate_rms_threshold()` in `control/helpers.h`. |
CMD_LIMITER_RMS_GAIN | `sizeof(int32_t)`
The current gain applied by the limiter in Q0.31 format. To read the `int32_t` control value, use the function `qxx_to_db()` in `control/helpers.h` with Q=31. This command is read only. When sending a write control command, it will be ignored. |

## LimiterPeak

class audio_dsp.stages.LimiterPeak(**kwargs)

  A limiter based on the peak value of the signal. When the peak envelope of the signal exceeds the threshold, the signal amplitude is reduced.

  The threshold sets the value above which limiting occurs. The attack time sets how fast the limiter starts limiting. The release time sets how long the signal takes to ramp up to its original level after the envelope is below the threshold.

  Attributes:
    dsp_block `audio_dsp.dsp.drc.drc.limiter_peak`

      The DSP block class; see Peak Limiter for implementation details.

  make_limiter_peak(threshold_db, attack_t, release_t, Q_sig=27)

    Update limiter configuration based on new parameters.

    Parameters:
      threshold_db float

        Threshold in decibels above which limiting occurs.

      attack_t float

        Attack time of the limiter in seconds.

      release_t float

        Release time of the limiter in seconds.

  set_parameters(
    parameters: LimiterParameters,
  )

    Update limiter configuration based on new parameters.

    Parameters:
      parameters LimiterParameters

        The parameters to update the limiter with.

pydantic model audio_dsp.models.limiter.LimiterParameters

  Parameters for limiter stage.

  field attack_t: float = 0.01

    Time in seconds for limiter to start limiting

    Constraints:

      - gt = 0

      - le = 1

  field release_t: float = 0.2

    Time in seconds for signal to return to original level

    Constraints:

      - gt = 0

      - le = 5

  field threshold_db: float = 0.0

    Level in dB above which limiting occurs

    Constraints:

      - ge = -162.55619765854985

      - le = 24.082399717833418

### LimiterPeak Control

The following runtime command ids are available for the LimiterPeak Stage. For details on reading and writing these commands, see the Run-Time Control User Guide.

Control parameter | Payload length
--- | ---
CMD_LIMITER_PEAK_ATTACK_ALPHA | `sizeof(int32_t)`
The attack alpha in Q0.31 format. To convert an attack time in seconds to an `int32_t` control value, use the function `calc_alpha()` in `control/helpers.h`. |
CMD_LIMITER_PEAK_RELEASE_ALPHA | `sizeof(int32_t)`
The release alpha in Q0.31 format. To convert a release time in seconds to an `int32_t` control value, use the function `calc_alpha()` in `control/helpers.h`. |
CMD_LIMITER_PEAK_ENVELOPE | `sizeof(int32_t)`
The current peak envelope of the signal in Q_SIG format. To read the `int32_t` control value, use the function `qxx_to_db()` in `control/helpers.h` with Q=Q_SIG. This command is read only. When sending a write control command, it will be ignored. |
CMD_LIMITER_PEAK_THRESHOLD | `sizeof(int32_t)`
The threshold in Q_SIG format above which limiting will occur. To convert a threshold in dB to the `int32_t` control value, use the function `calculate_peak_threshold()` in `control/helpers.h`. |
CMD_LIMITER_PEAK_GAIN | `sizeof(int32_t)`
The current gain applied by the limiter in Q0.31 format. To read the `int32_t` control value, use the function `qxx_to_db()` in `control/helpers.h` with Q=31. This command is read only. When sending a write control command, it will be ignored. |

## HardLimiterPeak

class audio_dsp.stages.HardLimiterPeak(**kwargs)

  A limiter based on the peak value of the signal. The peak envelope of the signal may never exceed the threshold.

  When the peak envelope of the signal exceeds the threshold, the signal amplitude is reduced. If the signal still exceeds the threshold, it is clipped.

  The threshold sets the value above which limiting/clipping occurs. The attack time sets how fast the limiter starts limiting. The release time sets how long the signal takes to ramp up to its original level after the envelope is below the threshold.

  Attributes:
    dsp_block `audio_dsp.dsp.drc.drc.hard_limiter_peak`

      The DSP block class; see Hard Peak Limiter for implementation details.

  make_hard_limiter_peak(
    threshold_db,
    attack_t,
    release_t,
    Q_sig=27,
  )

    Update limiter configuration based on new parameters.

    Parameters:
      threshold_db float

        Threshold in decibels above which limiting occurs.

      attack_t float

        Attack time of the limiter in seconds.

      release_t float

        Release time of the limiter in seconds.

  set_parameters(
    parameters: LimiterParameters,
  )

    Update limiter configuration based on new parameters.

    Parameters:
      parameters LimiterParameters

        The parameters to update the limiter with.

pydantic model audio_dsp.models.limiter.LimiterParameters

  Parameters for limiter stage.

  field attack_t: float = 0.01

    Time in seconds for limiter to start limiting

    Constraints:

      - gt = 0

      - le = 1

  field release_t: float = 0.2

    Time in seconds for signal to return to original level

    Constraints:

      - gt = 0

      - le = 5

  field threshold_db: float = 0.0

    Level in dB above which limiting occurs

    Constraints:

      - ge = -162.55619765854985

      - le = 24.082399717833418

### HardLimiterPeak Control

The following runtime command ids are available for the HardLimiterPeak Stage. For details on reading and writing these commands, see the Run-Time Control User Guide.

Control parameter | Payload length
--- | ---
CMD_HARD_LIMITER_PEAK_ATTACK_ALPHA | `sizeof(int32_t)`
The attack alpha in Q0.31 format. To convert an attack time in seconds to an `int32_t` control value, use the function `calc_alpha()` in `control/helpers.h`. |
CMD_HARD_LIMITER_PEAK_RELEASE_ALPHA | `sizeof(int32_t)`
The release alpha in Q0.31 format. To convert a release time in seconds to an `int32_t` control value, use the function `calc_alpha()` in `control/helpers.h`. |
CMD_HARD_LIMITER_PEAK_ENVELOPE | `sizeof(int32_t)`
The current peak envelope of the signal in Q_SIG format. To read the `int32_t` control value, use the function `qxx_to_db()` in `control/helpers.h` with Q=Q_SIG. This command is read only. When sending a write control command, it will be ignored. |
CMD_HARD_LIMITER_PEAK_THRESHOLD | `sizeof(int32_t)`
The threshold in Q_SIG format above which limiting will occur. To convert a threshold in dB to the `int32_t` control value, use the function `calculate_peak_threshold()` in `control/helpers.h`. |
CMD_HARD_LIMITER_PEAK_GAIN | `sizeof(int32_t)`
The current gain applied by the limiter in Q0.31 format. To read the `int32_t` control value, use the function `qxx_to_db()` in `control/helpers.h` with Q=31. This command is read only. When sending a write control command, it will be ignored. |

## Clipper

class audio_dsp.stages.Clipper(**kwargs)

  A simple clipper that limits the signal to a specified threshold.

  If the signal is greater than the threshold level, it is set to the threshold value.

  Attributes:
    dsp_block `audio_dsp.dsp.drc.drc.clipper`

      The DSP block class; see Clipper for implementation details.

  make_clipper(threshold_db, Q_sig=27)

    Update clipper configuration based on new parameters.

    Parameters:
      threshold_db float

        Threshold in decibels above which clipping occurs.

  set_parameters(parameters: ClipperParameters)

    Update clipper configuration based on new parameters.

    Parameters:
      parameters LimiterParameters

        The parameters to update the clipper with.

pydantic model audio_dsp.models.limiter.ClipperParameters

  Parameters for clipper stage.

  field threshold_db: float = 0.0

    Level in dB above which clipping occurs

    Constraints:

      - ge = -162.55619765854985

      - le = 24.082399717833418

### Clipper Control

The following runtime command ids are available for the Clipper Stage. For details on reading and writing these commands, see the Run-Time Control User Guide.

Control parameter | Payload length
--- | ---
CMD_CLIPPER_THRESHOLD | `sizeof(int32_t)`
The threshold in Q_SIG format above which clipping will occur. To convert a threshold in dB to the `int32_t` control value, use the function `calculate_peak_threshold()` in `control/helpers.h`. |