class_docstr: This function multiples the signal by a random amplitude. Firist, the
  signal is normalized to have amplitude between -1 and 1. Then it is
  multiplied with a random number.
  
  Arguments
  ---------
  amp_low : float
      The minumum amplitude multiplication factor.
  amp_high : float
      The maximum amplitude multiplication factor.
  
  Example
  -------
  >>> from speechbrain.dataio.dataio import read_audio
  >>> rand_amp = RandAmp(amp_low=0.25, amp_high=1.75)
  >>> signal = read_audio('tests/samples/single-mic/example1.wav')
  >>> output_signal = rand_amp(signal.unsqueeze(0))
class_docstr_tok: ["This","function","multiples","the","signal","by","a","random","amplitude",".","Firist",",","the","signal","is","normalized","to","have","amplitude","between","-1","and","1",".","Then","it","is","multiplied","with","a","random","number",".","Arguments","--","--","--","--","-","amp_low",":","float","The","minumum","amplitude","multiplication","factor",".","amp_high",":","float","The","maximum","amplitude","multiplication","factor",".","Example","--","--","--","-",">",">",">","from","speechbrain.dataio.dataio","import","read_audio",">",">",">","rand_amp","=","RandAmp","(","amp_low=0.25",",","amp_high=1.75",")",">",">",">","signal","=","read_audio","(","'tests\/samples\/single-mic\/example1.wav","'",")",">",">",">","output_signal","=","rand_amp","(","signal.unsqueeze","(","0",")",")"]
docstr: Arguments
  ---------
  waveforms : tensor
      Shape should be `[batch, time]` or `[batch, time, channels]`.
  
  Returns
  -------
  Tensor of shape `[batch, time]` or `[batch, time, channels]`
docstr_tok: ["Arguments","--","--","--","--","-","waveforms",":","tensor","Shape","should","be","`","[","batch",",","time","]","`","or","`","[","batch",",","time",",","channels","]","`",".","Returns","--","--","--","-","Tensor","of","shape","`","[","batch",",","time","]","`","or","`","[","batch",",","time",",","channels","]","`"]
code: def forward(self, waveforms):
      """
      Arguments
      ---------
      waveforms : tensor
          Shape should be `[batch, time]` or `[batch, time, channels]`.
  
      Returns
      -------
      Tensor of shape `[batch, time]` or `[batch, time, channels]`
      """
  
      # Normalize the signal
      abs_max, _ = torch.max(torch.abs(waveforms), dim=1, keepdim=True)
      waveforms = waveforms / abs_max
  
      # Pick a frequency to drop
      rand_range = self.amp_high - self.amp_low
      amp = (
          torch.rand(waveforms.shape[0], device=waveforms.device)
          * rand_range
          + self.amp_low
      )
      amp = amp.unsqueeze(1)
      if len(waveforms.shape) == 3:
          amp = amp.unsqueeze(2)
      waveforms = waveforms * amp
  
      return waveforms
  
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 2 for calling the RandAmp obj's underlying member method code with example usage: obj.forward(waveforms) and returns: waveforms