class_docstr: Gradually change the volume up or down over a random time span. Also known as
  fade in and fade out. The fade works on a logarithmic scale, which is natural to
  human hearing.
  
  The way this works is that it picks two gains: a first gain and a second gain.
  Then it picks a time range for the transition between those two gains.
  Note that this transition can start before the audio starts and/or end after the
  audio ends, so the output audio can start or end in the middle of a transition.
  The gain starts at the first gain and is held constant until the transition start.
  Then it transitions to the second gain. Then that gain is held constant until the
  end of the sound.
class_docstr_tok: ["Gradually","change","the","volume","up","or","down","over","a","random","time","span",".","Also","known","as","fade","in","and","fade","out",".","The","fade","works","on","a","logarithmic","scale",",","which","is","natural","to","human","hearing",".","The","way","this","works","is","that","it","picks","two","gains",":","a","first","gain","and","a","second","gain",".","Then","it","picks","a","time","range","for","the","transition","between","those","two","gains",".","Note","that","this","transition","can","start","before","the","audio","starts","and\/or","end","after","the","audio","ends",",","so","the","output","audio","can","start","or","end","in","the","middle","of","a","transition",".","The","gain","starts","at","the","first","gain","and","is","held","constant","until","the","transition","start",".","Then","it","transitions","to","the","second","gain",".","Then","that","gain","is","held","constant","until","the","end","of","the","sound","."]
docstr: :param min_gain_in_db: Deprecated. Use min_gain_db instead
  :param max_gain_in_db: Deprecated. Use max_gain_db instead
  :param min_gain_db: Minimum gain
  :param max_gain_db: Maximum gain
  :param min_duration: Minimum length of transition. See also duration_unit.
  :param max_duration: Maximum length of transition. See also duration_unit.
  :param duration_unit: Defines the unit of the value of min_duration and max_duration.
      "fraction": Fraction of the total sound length
      "samples": Number of audio samples
      "seconds": Number of seconds
  :param p: The probability of applying this transform
docstr_tok: [":","param","min_gain_in_db",":","Deprecated",".","Use","min_gain_db","instead",":","param","max_gain_in_db",":","Deprecated",".","Use","max_gain_db","instead",":","param","min_gain_db",":","Minimum","gain",":","param","max_gain_db",":","Maximum","gain",":","param","min_duration",":","Minimum","length","of","transition",".","See","also","duration_unit",".",":","param","max_duration",":","Maximum","length","of","transition",".","See","also","duration_unit",".",":","param","duration_unit",":","Defines","the","unit","of","the","value","of","min_duration","and","max_duration",".","``","fraction","''",":","Fraction","of","the","total","sound","length","``","samples","''",":","Number","of","audio","samples","``","seconds","''",":","Number","of","seconds",":","param","p",":","The","probability","of","applying","this","transform"]
code: def __init__(
      self,
      min_gain_in_db: float = None,
      max_gain_in_db: float = None,
      min_gain_db: float = None,
      max_gain_db: float = None,
      min_duration: Union[float, int] = 0.2,
      max_duration: Union[float, int] = 6.0,
      duration_unit: str = "seconds",
      p: float = 0.5,
  ):
      """
  
      :param min_gain_in_db: Deprecated. Use min_gain_db instead
      :param max_gain_in_db: Deprecated. Use max_gain_db instead
      :param min_gain_db: Minimum gain
      :param max_gain_db: Maximum gain
      :param min_duration: Minimum length of transition. See also duration_unit.
      :param max_duration: Maximum length of transition. See also duration_unit.
      :param duration_unit: Defines the unit of the value of min_duration and max_duration.
          "fraction": Fraction of the total sound length
          "samples": Number of audio samples
          "seconds": Number of seconds
      :param p: The probability of applying this transform
      """
      super().__init__(p)
  
      if min_gain_db is not None and min_gain_in_db is not None:
          raise ValueError(
              "Passing both min_gain_db and min_gain_in_db is not supported. Use only"
              " min_gain_db."
          )
      elif min_gain_db is not None:
          self.min_gain_db = min_gain_db
      elif min_gain_in_db is not None:
          warnings.warn(
              "The min_gain_in_db parameter is deprecated. Use min_gain_db instead.",
              DeprecationWarning,
          )
          self.min_gain_db = min_gain_in_db
      else:
          self.min_gain_db = -24.0  # the default
  
      if max_gain_db is not None and max_gain_in_db is not None:
          raise ValueError(
              "Passing both max_gain_db and max_gain_in_db is not supported. Use only"
              " max_gain_db."
          )
      elif max_gain_db is not None:
          self.max_gain_db = max_gain_db
      elif max_gain_in_db is not None:
          warnings.warn(
              "The max_gain_in_db parameter is deprecated. Use max_gain_db instead.",
              DeprecationWarning,
          )
          self.max_gain_db = max_gain_in_db
      else:
          self.max_gain_db = 6.0  # the default
  
      assert self.min_gain_db <= self.max_gain_db
  
      assert min_duration > 0
      assert min_duration <= max_duration
      self.min_duration = min_duration
      self.max_duration = max_duration
      self.duration_unit = duration_unit
  
file_path: audiomentations/audiomentations/augmentations/gain_transition.py
imports: import random
  import warnings
  from typing import Union
  import numpy
  from numpy.typing import NDArray
  from audiomentations.core.transforms_interface import BaseWaveformTransform
  from audiomentations.core.utils import convert_decibels_to_amplitude_ratio
label_desc: Use image node_id 1 to create a new GainTransition object from inherited base classes: BaseWaveformTransform with example: obj = GainTransition(min_gain_in_db, max_gain_in_db, min_gain_db, max_gain_db, min_duration, max_duration, duration_unit, p)