code: def notch_filter(notch_freq, filter_width=101, notch_width=0.05):
      """Returns a notch filter constructed from a high-pass and low-pass filter.
  
      (from https://tomroelandts.com/articles/
      how-to-create-simple-band-pass-and-band-reject-filters)
  
      Arguments
      ---------
      notch_freq : float
          frequency to put notch as a fraction of the
          sampling rate / 2. The range of possible inputs is 0 to 1.
      filter_width : int
          Filter width in samples. Longer filters have
          smaller transition bands, but are more inefficient.
      notch_width : float
          Width of the notch, as a fraction of the sampling_rate / 2.
  
      Example
      -------
      >>> from speechbrain.dataio.dataio import read_audio
      >>> signal = read_audio('tests/samples/single-mic/example1.wav')
      >>> signal = signal.unsqueeze(0).unsqueeze(2)
      >>> kernel = notch_filter(0.25)
      >>> notched_signal = convolve1d(signal, kernel)
      """
  
      # Check inputs
      assert 0 < notch_freq <= 1
      assert filter_width % 2 != 0
      pad = filter_width // 2
      inputs = torch.arange(filter_width) - pad
  
      # Avoid frequencies that are too low
      notch_freq += notch_width
  
      # Define sinc function, avoiding division by zero
      def sinc(x):
          "Computes the sinc function."
  
          def _sinc(x):
              return torch.sin(x) / x
  
          # The zero is at the middle index
          return torch.cat(
              [_sinc(x[:pad]), torch.ones(1), _sinc(x[pad + 1 :])]
          )
  
      # Compute a low-pass filter with cutoff frequency notch_freq.
      hlpf = sinc(3 * (notch_freq - notch_width) * inputs)
      hlpf *= torch.blackman_window(filter_width)
      hlpf /= torch.sum(hlpf)
  
      # Compute a high-pass filter with cutoff frequency notch_freq.
      hhpf = sinc(3 * (notch_freq + notch_width) * inputs)
      hhpf *= torch.blackman_window(filter_width)
      hhpf /= -torch.sum(hhpf)
      hhpf[pad] += 1
  
      # Adding filters creates notch filter
      return (hlpf + hhpf).view(1, -1, 1)
  
file_path: speechbrain/speechbrain/processing/signal_processing.py
imports: import torch
  import math
  from packaging import version
label_desc: Use image node_id 8 for calling a global function with example usage: notch_filter(notch_freq, filter_width, notch_width) and returns: unknown, torch, unknown