class_docstr: A series of data augmentation effects that can be applied to a given waveform.
  
  Note: Currently we only support single-channel waveforms.
  
  Args:
      effects (list): a list of effects to be applied to the waveform.
          Example:
              [
                  [0.1, "lowpass", {"cutoff_freq": 1000, "Q": 0.707}],
                  [0.1, "highpass", {"cutoff_freq": 3000, "Q": 0.707}],
                  [0.1, "equalization", {"center_freq": 1000, "gain": 0, "Q": 0.707}],
                  [
                      0.1,
                      [
                          [0.3, "speed_perturb", {"factor": 0.9}],
                          [0.3, "speed_perturb", {"factor": 1.1}],
                      ]
                  ],
              ]
          Description:
              - The above list defines a series of data augmentation effects that will
                be randomly sampled to apply to a given waveform.
              - The data structure of each element can be either
                type1=Tuple[float, str, Dict] or type2=Tuple[float, type1].
              - In type1, the three values are the weight of sampling this effect, the
                name (key) of the effect, and the keyword arguments for the effect.
              - In type2, the first value is the weight of sampling this effect.
                The second value is a list of type1 elements which are similarly
                defined as above.
              - Note that he effects defined in each type2 data are mutually exclusive
                (i.e., only one of them can be applied each time).
                This can be useful when you want to avoid applying some specific
                effects at the same time.
      apply_n (list): range of the number of effects to be applied to the waveform.
class_docstr_tok: ["A","series","of","data","augmentation","effects","that","can","be","applied","to","a","given","waveform",".","Note",":","Currently","we","only","support","single-channel","waveforms",".","Args",":","effects","(","list",")",":","a","list","of","effects","to","be","applied","to","the","waveform",".","Example",":","[","[","0.1",",","``","lowpass","''",",","{","``","cutoff_freq","''",":","1000",",","``","Q","''",":","0.707","}","]",",","[","0.1",",","``","highpass","''",",","{","``","cutoff_freq","''",":","3000",",","``","Q","''",":","0.707","}","]",",","[","0.1",",","``","equalization","''",",","{","``","center_freq","''",":","1000",",","``","gain","''",":","0",",","``","Q","''",":","0.707","}","]",",","[","0.1",",","[","[","0.3",",","``","speed_perturb","''",",","{","``","factor","''",":","0.9","}","]",",","[","0.3",",","``","speed_perturb","''",",","{","``","factor","''",":","1.1","}","]",",","]","]",",","]","Description",":","-","The","above","list","defines","a","series","of","data","augmentation","effects","that","will","be","randomly","sampled","to","apply","to","a","given","waveform",".","-","The","data","structure","of","each","element","can","be","either","type1=Tuple","[","float",",","str",",","Dict","]","or","type2=Tuple","[","float",",","type1","]",".","-","In","type1",",","the","three","values","are","the","weight","of","sampling","this","effect",",","the","name","(","key",")","of","the","effect",",","and","the","keyword","arguments","for","the","effect",".","-","In","type2",",","the","first","value","is","the","weight","of","sampling","this","effect",".","The","second","value","is","a","list","of","type1","elements","which","are","similarly","defined","as","above",".","-","Note","that","he","effects","defined","in","each","type2","data","are","mutually","exclusive","(","i.e.",",","only","one","of","them","can","be","applied","each","time",")",".","This","can","be","useful","when","you","want","to","avoid","applying","some","specific","effects","at","the","same","time",".","apply_n","(","list",")",":","range","of","the","number","of","effects","to","be","applied","to","the","waveform","."]
code: def __init__(
      self,
      effects: List[
          Union[
              Tuple[float, List[Tuple[float, str, Dict]]],
              Tuple[float, str, Dict],
          ]
      ],
      apply_n: Tuple[int, int] = [1, 1],
  ):
      self.effects = tuple(
          [
              tup[1] if isinstance(tup[1], list) else tup[1:]
              for tup in effects
          ]
      )
      self.effect_probs = tuple([tup[0] for tup in effects])
      assert apply_n[0] <= apply_n[1], apply_n
      assert apply_n[1] > 0, apply_n
      self.apply_n = tuple(apply_n)
  
imports: import math
  import random
  from typing import Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  import torchaudio
label_desc: Use image node_id 1 to create a new DataAugmentation object  with example: obj = DataAugmentation(effects, apply_n)