class_docstr: This class resamples an audio signal using sinc-based interpolation.
  
  It is a modification of the `resample` function from torchaudio
  (https://pytorch.org/audio/stable/tutorials/audio_resampling_tutorial.html)
  
  Arguments
  ---------
  orig_freq : int
      the sampling frequency of the input signal.
  new_freq : int
      the new sampling frequency after this operation is performed.
  lowpass_filter_width : int
      Controls the sharpness of the filter, larger numbers result in a
      sharper filter, but they are less efficient. Values from 4 to 10 are
      allowed.
  
  Example
  -------
  >>> from speechbrain.dataio.dataio import read_audio
  >>> signal = read_audio('tests/samples/single-mic/example1.wav')
  >>> signal = signal.unsqueeze(0) # [batch, time, channels]
  >>> resampler = Resample(orig_freq=16000, new_freq=8000)
  >>> resampled = resampler(signal)
  >>> signal.shape
  torch.Size([1, 52173])
  >>> resampled.shape
  torch.Size([1, 26087])
class_docstr_tok: ["This","class","resamples","an","audio","signal","using","sinc-based","interpolation",".","It","is","a","modification","of","the","`","resample","`","function","from","torchaudio","(","https",":","\/\/pytorch.org\/audio\/stable\/tutorials\/audio_resampling_tutorial.html",")","Arguments","--","--","--","--","-","orig_freq",":","int","the","sampling","frequency","of","the","input","signal",".","new_freq",":","int","the","new","sampling","frequency","after","this","operation","is","performed",".","lowpass_filter_width",":","int","Controls","the","sharpness","of","the","filter",",","larger","numbers","result","in","a","sharper","filter",",","but","they","are","less","efficient",".","Values","from","4","to","10","are","allowed",".","Example","--","--","--","-",">",">",">","from","speechbrain.dataio.dataio","import","read_audio",">",">",">","signal","=","read_audio","(","'tests\/samples\/single-mic\/example1.wav","'",")",">",">",">","signal","=","signal.unsqueeze","(","0",")","#","[","batch",",","time",",","channels","]",">",">",">","resampler","=","Resample","(","orig_freq=16000",",","new_freq=8000",")",">",">",">","resampled","=","resampler","(","signal",")",">",">",">","signal.shape","torch.Size","(","[","1",",","52173","]",")",">",">",">","resampled.shape","torch.Size","(","[","1",",","26087","]",")"]
docstr: Based on LinearResample::GetNumOutputSamples.
  
  LinearResample (LR) means that the output signal is at
  linearly spaced intervals (i.e the output signal has a
  frequency of ``new_freq``). It uses sinc/bandlimited
  interpolation to upsample/downsample the signal.
  
  (almost directly from torchaudio.compliance.kaldi)
  
  Arguments
  ---------
  input_num_samp : int
      The number of samples in each example in the batch.
  
  Returns
  -------
  Number of samples in the output waveform.
docstr_tok: ["Based","on","LinearResample",":",":GetNumOutputSamples",".","LinearResample","(","LR",")","means","that","the","output","signal","is","at","linearly","spaced","intervals","(","i.e","the","output","signal","has","a","frequency","of","``","new_freq","``",")",".","It","uses","sinc\/bandlimited","interpolation","to","upsample\/downsample","the","signal",".","(","almost","directly","from","torchaudio.compliance.kaldi",")","Arguments","--","--","--","--","-","input_num_samp",":","int","The","number","of","samples","in","each","example","in","the","batch",".","Returns","--","--","--","-","Number","of","samples","in","the","output","waveform","."]
code: def _output_samples(self, input_num_samp):
      """Based on LinearResample::GetNumOutputSamples.
  
      LinearResample (LR) means that the output signal is at
      linearly spaced intervals (i.e the output signal has a
      frequency of ``new_freq``). It uses sinc/bandlimited
      interpolation to upsample/downsample the signal.
  
      (almost directly from torchaudio.compliance.kaldi)
  
      Arguments
      ---------
      input_num_samp : int
          The number of samples in each example in the batch.
  
      Returns
      -------
      Number of samples in the output waveform.
      """
  
      # For exact computation, we measure time in "ticks" of 1.0 / tick_freq,
      # where tick_freq is the least common multiple of samp_in and
      # samp_out.
      samp_in = int(self.orig_freq)
      samp_out = int(self.new_freq)
  
      tick_freq = abs(samp_in * samp_out) // math.gcd(samp_in, samp_out)
      ticks_per_input_period = tick_freq // samp_in
  
      # work out the number of ticks in the time interval
      # [ 0, input_num_samp/samp_in ).
      interval_length = input_num_samp * ticks_per_input_period
      if interval_length <= 0:
          return 0
      ticks_per_output_period = tick_freq // samp_out
  
      # Get the last output-sample in the closed interval,
      # i.e. replacing [ ) with [ ]. Note: integer division rounds down.
      # See http://en.wikipedia.org/wiki/Interval_(mathematics) for an
      # explanation of the notation.
      last_output_samp = interval_length // ticks_per_output_period
  
      # We need the last output-sample in the open interval, so if it
      # takes us to the end of the interval exactly, subtract one.
      if last_output_samp * ticks_per_output_period == interval_length:
          last_output_samp -= 1
  
      # First output-sample index is zero, so the number of output samples
      # is the last output-sample plus one.
      num_output_samp = last_output_samp + 1
  
      return num_output_samp
  
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 5 for calling the Resample obj's underlying member method code with example usage: obj._output_samples(input_num_samp) and returns: num_output_samp, int