class_docstr: Constructs a Pop2Piano feature extractor.
  
  This feature extractor inherits from [`~feature_extraction_sequence_utils.SequenceFeatureExtractor`] which contains
  most of the main methods. Users should refer to this superclass for more information regarding those methods.
  
  This class extracts rhythm and preprocesses the audio before it is passed to the model. First the audio is passed
  to `RhythmExtractor2013` algorithm which extracts the beat_times, beat positions and estimates their confidence as
  well as tempo in bpm, then beat_times is interpolated and to get beatsteps. Later we calculate
  extrapolated_beatsteps from it to be used in tokenizer. On the other hand audio is resampled to self.sampling_rate
  and preprocessed and then log mel spectogram is computed from that to be used in our transformer model.
  
  Args:
      sampling_rate (`int`, *optional*, defaults to 22050):
          Target Sampling rate of audio signal. It's the sampling rate that we forward to the model.
      padding_value (`int`, *optional*, defaults to 0):
          Padding value used to pad the audio. Should correspond to silences.
      window_size (`int`, *optional*, defaults to 4096):
          Length of the window in samples to which the Fourier transform is applied.
      hop_length (`int`, *optional*, defaults to 1024):
          Step size between each window of the waveform, in samples.
      min_frequency (`float`, *optional*, defaults to 10.0):
          Lowest frequency that will be used in the log-mel spectrogram.
      feature_size (`int`, *optional*, defaults to 512):
          The feature dimension of the extracted features.
      num_bars (`int`, *optional*, defaults to 2):
          Determines interval between each sequence.
class_docstr_tok: ["Constructs","a","Pop2Piano","feature","extractor",".","This","feature","extractor","inherits","from","[","`","~feature_extraction_sequence_utils.SequenceFeatureExtractor","`","]","which","contains","most","of","the","main","methods",".","Users","should","refer","to","this","superclass","for","more","information","regarding","those","methods",".","This","class","extracts","rhythm","and","preprocesses","the","audio","before","it","is","passed","to","the","model",".","First","the","audio","is","passed","to","`","RhythmExtractor2013","`","algorithm","which","extracts","the","beat_times",",","beat","positions","and","estimates","their","confidence","as","well","as","tempo","in","bpm",",","then","beat_times","is","interpolated","and","to","get","beatsteps",".","Later","we","calculate","extrapolated_beatsteps","from","it","to","be","used","in","tokenizer",".","On","the","other","hand","audio","is","resampled","to","self.sampling_rate","and","preprocessed","and","then","log","mel","spectogram","is","computed","from","that","to","be","used","in","our","transformer","model",".","Args",":","sampling_rate","(","`","int","`",",","*","optional","*",",","defaults","to","22050",")",":","Target","Sampling","rate","of","audio","signal",".","It","'s","the","sampling","rate","that","we","forward","to","the","model",".","padding_value","(","`","int","`",",","*","optional","*",",","defaults","to","0",")",":","Padding","value","used","to","pad","the","audio",".","Should","correspond","to","silences",".","window_size","(","`","int","`",",","*","optional","*",",","defaults","to","4096",")",":","Length","of","the","window","in","samples","to","which","the","Fourier","transform","is","applied",".","hop_length","(","`","int","`",",","*","optional","*",",","defaults","to","1024",")",":","Step","size","between","each","window","of","the","waveform",",","in","samples",".","min_frequency","(","`","float","`",",","*","optional","*",",","defaults","to","10.0",")",":","Lowest","frequency","that","will","be","used","in","the","log-mel","spectrogram",".","feature_size","(","`","int","`",",","*","optional","*",",","defaults","to","512",")",":","The","feature","dimension","of","the","extracted","features",".","num_bars","(","`","int","`",",","*","optional","*",",","defaults","to","2",")",":","Determines","interval","between","each","sequence","."]
docstr: Generates MelSpectrogram.
  
  Args:
      sequence (`numpy.ndarray`):
          The sequence of which the mel-spectrogram will be computed.
docstr_tok: ["Generates","MelSpectrogram",".","Args",":","sequence","(","`","numpy.ndarray","`",")",":","The","sequence","of","which","the","mel-spectrogram","will","be","computed","."]
code: def mel_spectrogram(self, sequence: np.ndarray):
      """
      Generates MelSpectrogram.
  
      Args:
          sequence (`numpy.ndarray`):
              The sequence of which the mel-spectrogram will be computed.
      """
      mel_specs = []
      for seq in sequence:
          window = np.hanning(self.window_size + 1)[:-1]
          mel_specs.append(
              spectrogram(
                  waveform=seq,
                  window=window,
                  frame_length=self.window_size,
                  hop_length=self.hop_length,
                  power=2.0,
                  mel_filters=self.mel_filters,
              )
          )
      mel_specs = np.array(mel_specs)
  
      return mel_specs
  
file_path: transformers/src/transformers/models/pop2piano/feature_extraction_pop2piano.py
imports: import warnings
  from typing import List, Optional, Union
  import numpy
  import numpy
  from ...audio_utils import mel_filter_bank, spectrogram
  from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
  from ...feature_extraction_utils import BatchFeature
  from ...utils import TensorType, is_essentia_available, is_librosa_available, is_scipy_available, logging, requires_backends
label_desc: Use image node_id 2 for calling the Pop2PianoFeatureExtractor obj's underlying member method code with example usage: obj.mel_spectrogram(sequence) and returns: mel_specs