code: def melspectrogram(
      filename,
      npy_file=None,
      force=False,
      verbose=False,
      sample_rate=SAMPLE_RATE,
      frame_size=FRAME_SIZE,
      hop_size=HOP_SIZE,
      window_type=WINDOW_TYPE,
      zero_padding=ZERO_PADDING,
      low_frequency_bound=LOW_FREQUENCY_BOUND,
      high_frequency_bound=HIGH_FREQUENCY_BOUND,
      number_bands=NUMBER_BANDS,
      warping_formula=WARPING_FORMULA,
      weighting=WEIGHTING,
      normalize=NORMALIZE,
      bands_type=BANDS_TYPE,
      compression_type=COMPRESSION_TYPE,
  ):
      """Computes the mel spectrogram given the audio filename.
      When the parameter `npy_file` is specified, the data is saved to disk as a numpy array (.npy).
      Use the parameter `force` to overwrite the numpy array in case it already exists.
      The rest of parameters are directly mapped to Essentia algorithms as explained below.
  
      Note: this functionality is also available as a command line script.
  
      Parameters:
          sample_rate:
          real ∈ (0,inf) (default = 44100)
          the desired output sampling rate [Hz]
  
          frame_size:
          integer ∈ [1,inf) (default = 1024)
          the output frame size
  
          hop_size:
          integer ∈ [1,inf) (default = 512)
          the hop size between frames
  
          window_type:
          string ∈ {hamming,hann,hannnsgcq,triangular,square,blackmanharris62,blackmanharris70,blackmanharris74,blackmanharris92} (default = "hann")
          the window type, which can be 'hamming', 'hann', 'triangular', 'square' or 'blackmanharrisXX'
  
          zero_padding:
          integer ∈ [0,inf) (default = 0)
          the size of the zero-padding
  
          low_frequency_bound:
          real ∈ [0,inf) (default = 0)
          a lower-bound limit for the frequencies to be included in the bands
  
          high_frequency_bound:
          real ∈ [0,inf) (default = 22050)
          an upper-bound limit for the frequencies to be included in the bands
  
          number_bands:
          integer ∈ (1,inf) (default = 24)
          the number of output bands
  
          warping_formula:
          string ∈ {slaneyMel,htkMel} (default = "htkMel")
          The scale implementation type: 'htkMel' scale from the HTK toolkit [2, 3]
          (default) or 'slaneyMel' scale from the Auditory toolbox [4]
  
          weighting:
          string ∈ {warping,linear} (default = "warping")
          type of weighting function for determining triangle area
  
          normalize:
          string ∈ {unit_sum,unit_tri,unit_max} (default = "unit_sum")
          spectrum bin weights to use for each mel band: 'unit_max' to make each mel
          band vertex equal to 1, 'unit_sum' to make each mel band area equal to 1
          summing the actual weights of spectrum bins, 'unit_area' to make each
          triangle mel band area equal to 1 normalizing the weights of each triangle
          by its bandwidth
  
          bands_type:
          string ∈ {magnitude,power} (default = "power")
          'power' to output squared units, 'magnitude' to keep it as the input
  
          compression_type:
          string ∈ {dB,shift_scale_log,none} (default = "shift_scale_log")
          the compression type to use.
          'shift_scale_log' is log10(10000 * x + 1)
          'dB' is 10 * log10(x)
  
      Returns:
          (2D array): The mel-spectrogram.
      """
  
      padded_size = frame_size + zero_padding
      spectrum_size = (padded_size) // 2 + 1
  
      # In case we want to save the melbands to a file
      # check if the file already exists
      if npy_file:
          if not npy_file.endswith(".npy"):
              npy_file += ".npy"
  
          if not force:
              if os.path.exists(npy_file):
                  if verbose:
                      print('Skipping "{}"'.format(npy_file))
                  return
  
      pool = Pool()
  
      loader = MonoLoader(filename=filename, sampleRate=sample_rate)
      frameCutter = FrameCutter(frameSize=frame_size, hopSize=hop_size)
      w = Windowing(
          zeroPadding=zero_padding, type=window_type, normalized=False
      )  # None of the mel bands extraction methods
      # we have seen requires window-level normalization.
      spec = Spectrum(size=padded_size)
      mels = MelBands(
          inputSize=spectrum_size,
          numberBands=number_bands,
          sampleRate=sample_rate,
          lowFrequencyBound=low_frequency_bound,
          highFrequencyBound=high_frequency_bound,
          warpingFormula=warping_formula,
          weighting=weighting,
          normalize=normalize,
          type=bands_type,
          log=False,
      )  # Do not compute any compression here.
      # Use the `UnaryOperator`s methods before
      # in case a new compression type is required.
  
      if compression_type.lower() == "db":
          shift = UnaryOperator(type="identity")
          compressor = UnaryOperator(type="lin2db")
  
      elif compression_type.lower() == "shift_scale_log":
          shift = UnaryOperator(type="identity", scale=1e4, shift=1)
          compressor = UnaryOperator(type="log10")
  
      elif compression_type.lower() == "none":
          shift = UnaryOperator(type="identity")
          compressor = UnaryOperator(type="identity")
  
      loader.audio >> frameCutter.signal
      frameCutter.frame >> w.frame >> spec.frame
      spec.spectrum >> mels.spectrum
      (
          mels.bands
          >> shift.array
          >> compressor.array
          >> (pool, "mel_bands")
      )
  
      run(loader)
  
      mel_bands = np.array(pool["mel_bands"])
  
      if npy_file:
          np.save(npy_file, mel_bands)
  
      if verbose:
          print('Done for "{}"'.format(npy_file))
  
      return mel_bands
  
imports: import argparse
  import os
  import numpy
  from essentia import Pool
  from essentia import run
  from essentia.streaming import MonoLoader, FrameCutter, Windowing, Spectrum, MelBands, UnaryOperator
label_desc: Use image node_id 1 for calling a global function with example usage: melspectrogram(filename, npy_file, force, verbose, sample_rate, frame_size, hop_size, window_type, zero_padding, low_frequency_bound, high_frequency_bound, number_bands, warping_formula, weighting, normalize, bands_type, compression_type) and returns: mel_bands