class_docstr: A simple audio limiter (dynamic range compression).
  Note: This transform also delays the signal by a fraction of the attack time.
class_docstr_tok: ["A","simple","audio","limiter","(","dynamic","range","compression",")",".","Note",":","This","transform","also","delays","the","signal","by","a","fraction","of","the","attack","time","."]
code: def apply(self, samples: NDArray[np.float32], sample_rate: int):
      if self.parameters["threshold"] == 0.0:
          # Digital silence input can cause this to happen
          return samples
      try:
          from cylimiter import Limiter as CyLimiter
      except ImportError:
          print(
              "Failed to import cylimiter. Maybe it is not installed? "
              "To install the optional cylimiter dependency of audiomentations,"
              " run `pip install cylimiter` or `pip install audiomentations[extras]`",
              file=sys.stderr,
          )
          raise
  
      limiter = CyLimiter(
          attack=self.parameters["attack"],
          release=self.parameters["release"],
          delay=self.parameters["delay"],
          threshold=self.parameters["threshold"],
      )
      if samples.ndim == 1:
          processed_samples = np.copy(samples)
          limiter.limit_inplace(processed_samples)
      else:
          # By default, there is no interchannel linking. The channels are processed
          # independently. Support for linking may be added in the future:
          # https://github.com/pzelasko/cylimiter/issues/4
          processed_samples = np.copy(samples)
          for chn_idx in range(samples.shape[0]):
              limiter.reset()
              channel = np.ascontiguousarray(
                  processed_samples[chn_idx, :]
              )
              limiter.limit_inplace(channel)
              processed_samples[chn_idx, :] = channel
  
      return processed_samples
  
file_path: audiomentations/audiomentations/augmentations/limiter.py
imports: import random
  import math
  import numpy
  import sys
  from numpy.typing import NDArray
  from audiomentations.core.transforms_interface import BaseWaveformTransform
  from audiomentations.core.utils import convert_decibels_to_amplitude_ratio, get_max_abs_amplitude
label_desc: Use image node_id 4 for calling the Limiter obj's underlying member method code with example usage: obj.apply(samples, sample_rate) and returns: processed_samples, samples