code: def filterbank_log(
      sample_rate,
      n_freq,
      n_bins=84,
      bins_per_octave=12,
      f_min=None,
      spread=0.125,
  ):
      """A function that returns a approximation of constant-Q filter banks for a fixed-window STFT.
      Each filter is a log-normal window centered at the corresponding frequency.
  
      Args:
          sample_rate (`int`): audio sampling rate
          n_freq (`int`): number of the input frequency bins. E.g., `n_fft / 2 + 1`
          n_bins (`int`): number of the resulting log-frequency bins.  Defaults to 84 (7 octaves).
          bins_per_octave (`int`): number of bins per octave. Defaults to 12 (semitones).
          f_min (`float`): lowest frequency that is going to be included in the log filterbank. Defaults to `C1 ~= 32.70`
          spread (`float`): spread of each filter, as a fraction of a bin.
  
      Returns:
          (`Tensor`): log-frequency filterbanks. Shape=`(n_freq, n_bins)`
  
      Note:
          The code is originally from `logfrequency` in librosa 0.4 (deprecated) and copy-and-pasted.
          `tuning` parameter was removed and we use `n_freq` instead of `n_fft`.
      """
  
      if f_min is None:
          f_min = 32.70319566
  
      f_max = f_min * 2 ** (n_bins / bins_per_octave)
      if f_max > sample_rate // 2:
          raise RuntimeError(
              "Maximum frequency of log filterbank should be lower or equal to the maximum"
              "frequency of the input (defined by its sample rate), "
              "but f_max=%f and maximum frequency is %f. \n"
              "Fix it by reducing n_bins, increasing bins_per_octave and/or reducing f_min.\n"
              "You can also do it by increasing sample_rate but it means you need to upsample"
              "the input audio data, too." % (f_max, sample_rate)
          )
  
      # What's the shape parameter for our log-normal filters?
      sigma = float(spread) / bins_per_octave
  
      # Construct the output matrix
      basis = np.zeros((n_bins, n_freq))
  
      # Get log frequencies of bins
      log_freqs = np.log2(
          librosa.fft_frequencies(sample_rate, (n_freq - 1) * 2)[1:]
      )
  
      for i in range(n_bins):
          # What's the center (median) frequency of this filter?
          c_freq = f_min * (2.0 ** (float(i) / bins_per_octave))
  
          # Place a log-normal window around c_freq
          basis[i, 1:] = np.exp(
              -0.5 * ((log_freqs - np.log2(c_freq)) / sigma) ** 2
              - np.log2(sigma)
              - log_freqs
          )
  
      # Normalize the filters
      basis = librosa.util.normalize(basis, norm=1, axis=1)
      basis = basis.astype(K.floatx())
  
      return tf.convert_to_tensor(basis.T)
  
file_path: kapre/kapre/backend.py
imports: from tensorflow.keras import backend
  import tensorflow
  import numpy
  import librosa
label_desc: Use image node_id 5 for calling a global function with example usage: filterbank_log(sample_rate, n_freq, n_bins, bins_per_octave, f_min, spread) and returns: tf