code: def create_fourier_kernels(
      n_fft,
      win_length=None,
      freq_bins=None,
      fmin=50,
      fmax=6000,
      sr=44100,
      freq_scale="linear",
      window="hann",
      verbose=True,
  ):
      """This function creates the Fourier Kernel for STFT, Melspectrogram and CQT.
      Most of the parameters follow librosa conventions. Part of the code comes from
      pytorch_musicnet. https://github.com/jthickstun/pytorch_musicnet
  
      Parameters
      ----------
      n_fft : int
          The window size
  
      freq_bins : int
          Number of frequency bins. Default is ``None``, which means ``n_fft//2+1`` bins
  
      fmin : int
          The starting frequency for the lowest frequency bin.
          If freq_scale is ``no``, this argument does nothing.
  
      fmax : int
          The ending frequency for the highest frequency bin.
          If freq_scale is ``no``, this argument does nothing.
  
      sr : int
          The sampling rate for the input audio. It is used to calculate the correct ``fmin`` and ``fmax``.
          Setting the correct sampling rate is very important for calculating the correct frequency.
  
      freq_scale: 'linear', 'log', 'log2', or 'no'
          Determine the spacing between each frequency bin.
          When 'linear', 'log' or 'log2' is used, the bin spacing can be controlled by ``fmin`` and ``fmax``.
          If 'no' is used, the bin will start at 0Hz and end at Nyquist frequency with linear spacing.
  
      Returns
      -------
      wsin : numpy.array
          Imaginary Fourier Kernel with the shape ``(freq_bins, 1, n_fft)``
  
      wcos : numpy.array
          Real Fourier Kernel with the shape ``(freq_bins, 1, n_fft)``
  
      bins2freq : list
          Mapping each frequency bin to frequency in Hz.
  
      binslist : list
          The normalized frequency ``k`` in digital domain.
          This ``k`` is in the Discrete Fourier Transform equation $$
  
      """
  
      if freq_bins == None:
          freq_bins = n_fft // 2 + 1
      if win_length == None:
          win_length = n_fft
  
      s = np.arange(0, n_fft, 1.0)
      wsin = np.empty((freq_bins, 1, n_fft))
      wcos = np.empty((freq_bins, 1, n_fft))
      start_freq = fmin
      end_freq = fmax
      bins2freq = []
      binslist = []
  
      # num_cycles = start_freq*d/44000.
      # scaling_ind = np.log(end_freq/start_freq)/k
  
      # Choosing window shape
  
      window_mask = get_window(window, int(win_length), fftbins=True)
      window_mask = pad_center(window_mask, n_fft)
  
      if freq_scale == "linear":
          if verbose == True:
              print(
                  f"sampling rate = {sr}. Please make sure the sampling rate is correct in order to"
                  f"get a valid freq range"
              )
          start_bin = start_freq * n_fft / sr
          scaling_ind = (
              (end_freq - start_freq) * (n_fft / sr) / freq_bins
          )
  
          for k in range(
              freq_bins
          ):  # Only half of the bins contain useful info
              # print("linear freq = {}".format((k*scaling_ind+start_bin)*sr/n_fft))
              bins2freq.append(
                  (k * scaling_ind + start_bin) * sr / n_fft
              )
              binslist.append((k * scaling_ind + start_bin))
              wsin[k, 0, :] = np.sin(
                  2 * np.pi * (k * scaling_ind + start_bin) * s / n_fft
              )
              wcos[k, 0, :] = np.cos(
                  2 * np.pi * (k * scaling_ind + start_bin) * s / n_fft
              )
  
      elif freq_scale == "log":
          if verbose == True:
              print(
                  f"sampling rate = {sr}. Please make sure the sampling rate is correct in order to"
                  f"get a valid freq range"
              )
          start_bin = start_freq * n_fft / sr
          scaling_ind = np.log(end_freq / start_freq) / freq_bins
  
          for k in range(
              freq_bins
          ):  # Only half of the bins contain useful info
              # print("log freq = {}".format(np.exp(k*scaling_ind)*start_bin*sr/n_fft))
              bins2freq.append(
                  np.exp(k * scaling_ind) * start_bin * sr / n_fft
              )
              binslist.append((np.exp(k * scaling_ind) * start_bin))
              wsin[k, 0, :] = np.sin(
                  2
                  * np.pi
                  * (np.exp(k * scaling_ind) * start_bin)
                  * s
                  / n_fft
              )
              wcos[k, 0, :] = np.cos(
                  2
                  * np.pi
                  * (np.exp(k * scaling_ind) * start_bin)
                  * s
                  / n_fft
              )
  
      elif freq_scale == "log2":
          if verbose == True:
              print(
                  f"sampling rate = {sr}. Please make sure the sampling rate is correct in order to"
                  f"get a valid freq range"
              )
          start_bin = start_freq * n_fft / sr
          scaling_ind = np.log2(end_freq / start_freq) / freq_bins
  
          for k in range(
              freq_bins
          ):  # Only half of the bins contain useful info
              # print("log freq = {}".format(np.exp(k*scaling_ind)*start_bin*sr/n_fft))
              bins2freq.append(
                  2 ** (k * scaling_ind) * start_bin * sr / n_fft
              )
              binslist.append((2 ** (k * scaling_ind) * start_bin))
              wsin[k, 0, :] = np.sin(
                  2
                  * np.pi
                  * (2 ** (k * scaling_ind) * start_bin)
                  * s
                  / n_fft
              )
              wcos[k, 0, :] = np.cos(
                  2
                  * np.pi
                  * (2 ** (k * scaling_ind) * start_bin)
                  * s
                  / n_fft
              )
  
      elif freq_scale == "no":
          for k in range(
              freq_bins
          ):  # Only half of the bins contain useful info
              bins2freq.append(k * sr / n_fft)
              binslist.append(k)
              wsin[k, 0, :] = np.sin(2 * np.pi * k * s / n_fft)
              wcos[k, 0, :] = np.cos(2 * np.pi * k * s / n_fft)
      else:
          print(
              "Please select the correct frequency scale, 'linear' or 'log'"
          )
      return (
          wsin.astype(np.float32),
          wcos.astype(np.float32),
          bins2freq,
          binslist,
          window_mask.astype(np.float32),
      )
  
imports: import sys
  import torch
  from torch.nn.functional import conv1d, fold
  import numpy
  from time import time
  import math
  from scipy.signal import get_window
  from scipy import signal
  from scipy.fftpack import fft
  import warnings
  from nnAudio.librosa_functions import *
label_desc: Use image node_id 13 for calling a global function with example usage: create_fourier_kernels(n_fft, win_length, freq_bins, fmin, fmax, sr, freq_scale, window, verbose) and returns: wsin,  wcos,  bins2freq,  binslist,  window_mask