class_docstr: This class implements ambient noise augmentation for audio.
code: def __init__(
      self,
      opts: argparse.Namespace,
      is_training: bool = True,
      noise_files_dir: Optional[str] = None,
      *args,
      **kwargs,
  ) -> None:
      super().__init__(opts=opts)
      self.gain_levels = getattr(
          opts, "audio_augmentation.noise.levels"
      )
      self.cache_size = getattr(
          opts, "audio_augmentation.noise.cache_size"
      )
      self.refresh_freq = getattr(
          opts, "audio_augmentation.noise.refresh_freq"
      )
      self.refresh_counter = self.refresh_freq
  
      self.noise_files_dir = noise_files_dir
      if self.noise_files_dir is None:
          self.noise_files_dir = getattr(
              opts, "audio_augmentation.noise.files_dir"
          )
  
      self.noise_files = []
      self.pointer = 0
      if self.noise_files_dir is not None:
          self.noise_files = sorted(
              pathlib.Path(self.noise_files_dir).glob("**/*.wav")
          )
          if is_training:
              random.shuffle(self.noise_files)
          self.noise_waves = self.load_noise_files(
              cache_size=self.cache_size
          )
      if len(self.noise_files) == 0:
          raise ValueError(
              "--audio-augmentation.noise.files-dir must be provided for this augmentation"
          )
  
imports: import argparse
  import math
  import pathlib
  import random
  from typing import Callable, Dict, List, Optional, Union
  import torch
  import torchaudio
  from data.transforms import TRANSFORMATIONS_REGISTRY, BaseTransformation
  from data.transforms.audio_aux import mfccs
label_desc: Use image node_id 1 to create a new Noise object from inherited base classes: BaseTransformation with example: obj = Noise(opts, is_training, noise_files_dir)