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 randomize_parameters(
      self, samples: NDArray[np.float32], sample_rate: int
  ):
      super().randomize_parameters(samples, sample_rate)
  
      if self.parameters["should_apply"]:
          attack_seconds = random.uniform(
              self.min_attack, self.max_attack
          )
          self.parameters["attack"] = self.convert_time_to_coefficient(
              attack_seconds, sample_rate
          )
          release_seconds = random.uniform(
              self.min_release, self.max_release
          )
          self.parameters["release"] = self.convert_time_to_coefficient(
              release_seconds, sample_rate
          )
          # Delay the signal by 60% of the attack time by default
          self.parameters["delay"] = max(
              round(0.6 * attack_seconds * sample_rate), 1
          )
  
          threshold_factor = (
              get_max_abs_amplitude(samples)
              if self.threshold_mode == "relative_to_signal_peak"
              else 1.0
          )
          threshold_db = random.uniform(
              self.min_threshold_db, self.max_threshold_db
          )
  
          self.parameters[
              "threshold"
          ] = threshold_factor * convert_decibels_to_amplitude_ratio(
              threshold_db
          )
  
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 3 for calling the Limiter obj's underlying member method code with example usage: obj.randomize_parameters(samples, sample_rate) without return types