class_docstr: This class implements ambient noise augmentation for audio.
docstr: This function adds a random noise sample selected from the
  noise samples provided in the noise directory scaled by a random gain.
  The sample should contain floating-point values in [-1, 1].
  
  Args:
      data: A dictionary containing {"samples": {"audio": @audio}}, where
          @audio is a tensor of shape [num_channels, sequence_length].
  
  Returns:
      The modified dictionary with the augmented audio.
docstr_tok: ["This","function","adds","a","random","noise","sample","selected","from","the","noise","samples","provided","in","the","noise","directory","scaled","by","a","random","gain",".","The","sample","should","contain","floating-point","values","in","[","-1",",","1","]",".","Args",":","data",":","A","dictionary","containing","{","``","samples","''",":","{","``","audio","''",":","@","audio","}","}",",","where","@","audio","is","a","tensor","of","shape","[","num_channels",",","sequence_length","]",".","Returns",":","The","modified","dictionary","with","the","augmented","audio","."]
code: def __call__(self, data: Dict) -> Dict:
      """
      This function adds a random noise sample selected from the
      noise samples provided in the noise directory scaled by a random gain.
      The sample should contain floating-point values in [-1, 1].
  
      Args:
          data: A dictionary containing {"samples": {"audio": @audio}}, where
              @audio is a tensor of shape [num_channels, sequence_length].
  
      Returns:
          The modified dictionary with the augmented audio.
      """
      audio = data["samples"]["audio"]
      assert audio.shape[0] in [1, 2]
      gain_level = random.choice(self.gain_levels)
      noise_wave, noise_fps = random.choice(self.noise_waves)
      # @noise_wave is in [num_channels, sequence_length] format.
      assert math.isclose(
          data["metadata"]["audio_fps"], noise_fps, rel_tol=1e-6
      )
      if noise_wave.shape[-1] >= audio.shape[-1]:
          random_start_point = random.randint(
              0, noise_wave.shape[-1] - audio.shape[-1]
          )
          noise_wave = noise_wave[
              :,
              random_start_point : random_start_point + audio.shape[-1],
          ]
      else:
          noise_wave = torch.nn.functional.pad(
              noise_wave.unsqueeze(0),
              (0, audio.shape[-1] - noise_wave.shape[-1]),
              mode="circular",
          )
          # @noise_wave is in [1, num_channels, sequence_length] format.
          noise_wave = noise_wave[0]
      augmented_audio = audio + 10.0 ** (gain_level / 20.0) * noise_wave
      data["samples"]["audio"] = augmented_audio
      self.refresh_counter -= 1
      if (
          self.refresh_counter <= 0
          and self.refresh_freq > 0
          and self.noise_files_dir is not None
      ):
          # Refresh cache when met refresh criteria.
          self.noise_waves = self.load_noise_files(self.cache_size)
          self.refresh_counter = self.refresh_freq
      return data
  
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 4 for calling the Noise obj's underlying member method code with example usage: obj.__call__(data) and returns: data