class_docstr: This class additively combines a noise signal to the input signal.
  
  Arguments
  ---------
  csv_file : str
      The name of a csv file containing the location of the
      noise audio files. If none is provided, white noise will be used.
  csv_keys : list, None, optional
      Default: None . One data entry for the noise data should be specified.
      If None, the csv file is expected to have only one data entry.
  sorting : str
      The order to iterate the csv file, from one of the
      following options: random, original, ascending, and descending.
  num_workers : int
      Number of workers in the DataLoader (See PyTorch DataLoader docs).
  snr_low : int
      The low end of the mixing ratios, in decibels.
  snr_high : int
      The high end of the mixing ratios, in decibels.
  pad_noise : bool
      If True, copy noise signals that are shorter than
      their corresponding clean signals so as to cover the whole clean
      signal. Otherwise, leave the noise un-padded.
  start_index : int
      The index in the noise waveforms to start from. By default, chooses
      a random index in [0, len(noise) - len(waveforms)].
  normalize : bool
      If True, output noisy signals that exceed [-1,1] will be
      normalized to [-1,1].
  noise_funct: funct object
      function to use to draw a noisy sample. It is enabled if the csv files
      containing the noisy sequences are not provided. By default,
      torch.randn_like is used (to sample white noise). In general, it must
      be a function that takes in input the original waveform and returns
      a tensor with the corresponsing noise to add (e.g., see pink_noise_like).
  replacements : dict
      A set of string replacements to carry out in the
      csv file. Each time a key is found in the text, it will be replaced
      with the corresponding value.
  noise_sample_rate : int
      The sample rate of the noise audio signals, so noise can be resampled
      to the clean sample rate if necessary.
  clean_sample_rate : int
      The sample rate of the clean audio signals, so noise can be resampled
      to the clean sample rate if necessary.
  
  Example
  -------
  >>> import pytest
  >>> from speechbrain.dataio.dataio import read_audio
  >>> signal = read_audio('tests/samples/single-mic/example1.wav')
  >>> clean = signal.unsqueeze(0) # [batch, time, channels]
  >>> noisifier = AddNoise('tests/samples/annotation/noise.csv',
  ...                     replacements={'noise_folder': 'tests/samples/noise'})
  >>> noisy = noisifier(clean, torch.ones(1))
class_docstr_tok: ["This","class","additively","combines","a","noise","signal","to","the","input","signal",".","Arguments","--","--","--","--","-","csv_file",":","str","The","name","of","a","csv","file","containing","the","location","of","the","noise","audio","files",".","If","none","is","provided",",","white","noise","will","be","used",".","csv_keys",":","list",",","None",",","optional","Default",":","None",".","One","data","entry","for","the","noise","data","should","be","specified",".","If","None",",","the","csv","file","is","expected","to","have","only","one","data","entry",".","sorting",":","str","The","order","to","iterate","the","csv","file",",","from","one","of","the","following","options",":","random",",","original",",","ascending",",","and","descending",".","num_workers",":","int","Number","of","workers","in","the","DataLoader","(","See","PyTorch","DataLoader","docs",")",".","snr_low",":","int","The","low","end","of","the","mixing","ratios",",","in","decibels",".","snr_high",":","int","The","high","end","of","the","mixing","ratios",",","in","decibels",".","pad_noise",":","bool","If","True",",","copy","noise","signals","that","are","shorter","than","their","corresponding","clean","signals","so","as","to","cover","the","whole","clean","signal",".","Otherwise",",","leave","the","noise","un-padded",".","start_index",":","int","The","index","in","the","noise","waveforms","to","start","from",".","By","default",",","chooses","a","random","index","in","[","0",",","len","(","noise",")","-","len","(","waveforms",")","]",".","normalize",":","bool","If","True",",","output","noisy","signals","that","exceed","[","-1,1","]","will","be","normalized","to","[","-1,1","]",".","noise_funct",":","funct","object","function","to","use","to","draw","a","noisy","sample",".","It","is","enabled","if","the","csv","files","containing","the","noisy","sequences","are","not","provided",".","By","default",",","torch.randn_like","is","used","(","to","sample","white","noise",")",".","In","general",",","it","must","be","a","function","that","takes","in","input","the","original","waveform","and","returns","a","tensor","with","the","corresponsing","noise","to","add","(","e.g.",",","see","pink_noise_like",")",".","replacements",":","dict","A","set","of","string","replacements","to","carry","out","in","the","csv","file",".","Each","time","a","key","is","found","in","the","text",",","it","will","be","replaced","with","the","corresponding","value",".","noise_sample_rate",":","int","The","sample","rate","of","the","noise","audio","signals",",","so","noise","can","be","resampled","to","the","clean","sample","rate","if","necessary",".","clean_sample_rate",":","int","The","sample","rate","of","the","clean","audio","signals",",","so","noise","can","be","resampled","to","the","clean","sample","rate","if","necessary",".","Example","--","--","--","-",">",">",">","import","pytest",">",">",">","from","speechbrain.dataio.dataio","import","read_audio",">",">",">","signal","=","read_audio","(","'tests\/samples\/single-mic\/example1.wav","'",")",">",">",">","clean","=","signal.unsqueeze","(","0",")","#","[","batch",",","time",",","channels","]",">",">",">","noisifier","=","AddNoise","(","'tests\/samples\/annotation\/noise.csv","'",",","...","replacements=","{","'noise_folder","'",":","'tests\/samples\/noise","'","}",")",">",">",">","noisy","=","noisifier","(","clean",",","torch.ones","(","1",")",")"]
code: def __init__(
      self,
      csv_file=None,
      csv_keys=None,
      sorting="random",
      num_workers=0,
      snr_low=0,
      snr_high=0,
      pad_noise=False,
      start_index=None,
      normalize=False,
      noise_funct=torch.randn_like,
      replacements={},
      noise_sample_rate=16000,
      clean_sample_rate=16000,
  ):
      super().__init__()
  
      self.csv_file = csv_file
      self.csv_keys = csv_keys
      self.sorting = sorting
      self.num_workers = num_workers
      self.snr_low = snr_low
      self.snr_high = snr_high
      self.pad_noise = pad_noise
      self.start_index = start_index
      self.normalize = normalize
      self.replacements = replacements
      self.noise_funct = noise_funct
      self.noise_sample_rate = noise_sample_rate
      self.clean_sample_rate = clean_sample_rate
  
imports: import math
  import random
  import torch
  import torch.nn.functional
  from speechbrain.dataio.legacy import ExtendedCSVDataset
  from speechbrain.dataio.dataloader import make_dataloader
  from speechbrain.processing.signal_processing import compute_amplitude, dB_to_amplitude, convolve1d, notch_filter, reverberate
label_desc: Use image node_id 1 to create a new AddNoise object from inherited base classes: torch.nn with example: obj = AddNoise(csv_file, csv_keys, sorting, num_workers, snr_low, snr_high, pad_noise, start_index, normalize, noise_funct, replacements, noise_sample_rate, clean_sample_rate)