class_docstr: Constructs a SpeechT5 feature extractor.
  
  This class can pre-process a raw speech signal by (optionally) normalizing to zero-mean unit-variance, for use by
  the SpeechT5 speech encoder prenet.
  
  This class can also extract log-mel filter bank features from raw speech, for use by the SpeechT5 speech decoder
  prenet.
  
  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.
  
  Args:
      feature_size (`int`, *optional*, defaults to 1):
          The feature dimension of the extracted features.
      sampling_rate (`int`, *optional*, defaults to 16000):
          The sampling rate at which the audio files should be digitalized expressed in hertz (Hz).
      padding_value (`float`, *optional*, defaults to 0.0):
          The value that is used to fill the padding values.
      do_normalize (`bool`, *optional*, defaults to `False`):
          Whether or not to zero-mean unit-variance normalize the input. Normalizing can help to significantly
          improve the performance for some models.
      num_mel_bins (`int`, *optional*, defaults to 80):
          The number of mel-frequency bins in the extracted spectrogram features.
      hop_length (`int`, *optional*, defaults to 16):
          Number of ms between windows. Otherwise referred to as "shift" in many papers.
      win_length (`int`, *optional*, defaults to 64):
          Number of ms per window.
      win_function (`str`, *optional*, defaults to `"hann_window"`):
          Name for the window function used for windowing, must be accessible via `torch.{win_function}`
      frame_signal_scale (`float`, *optional*, defaults to 1.0):
          Constant multiplied in creating the frames before applying DFT. This argument is deprecated.
      fmin (`float`, *optional*, defaults to 80):
          Minimum mel frequency in Hz.
      fmax (`float`, *optional*, defaults to 7600):
          Maximum mel frequency in Hz.
      mel_floor (`float`, *optional*, defaults to 1e-10):
          Minimum value of mel frequency banks.
      reduction_factor (`int`, *optional*, defaults to 2):
          Spectrogram length reduction factor. This argument is deprecated.
      return_attention_mask (`bool`, *optional*, defaults to `True`):
          Whether or not [`~SpeechT5FeatureExtractor.__call__`] should return `attention_mask`.
class_docstr_tok: ["Constructs","a","SpeechT5","feature","extractor",".","This","class","can","pre-process","a","raw","speech","signal","by","(","optionally",")","normalizing","to","zero-mean","unit-variance",",","for","use","by","the","SpeechT5","speech","encoder","prenet",".","This","class","can","also","extract","log-mel","filter","bank","features","from","raw","speech",",","for","use","by","the","SpeechT5","speech","decoder","prenet",".","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",".","Args",":","feature_size","(","`","int","`",",","*","optional","*",",","defaults","to","1",")",":","The","feature","dimension","of","the","extracted","features",".","sampling_rate","(","`","int","`",",","*","optional","*",",","defaults","to","16000",")",":","The","sampling","rate","at","which","the","audio","files","should","be","digitalized","expressed","in","hertz","(","Hz",")",".","padding_value","(","`","float","`",",","*","optional","*",",","defaults","to","0.0",")",":","The","value","that","is","used","to","fill","the","padding","values",".","do_normalize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","or","not","to","zero-mean","unit-variance","normalize","the","input",".","Normalizing","can","help","to","significantly","improve","the","performance","for","some","models",".","num_mel_bins","(","`","int","`",",","*","optional","*",",","defaults","to","80",")",":","The","number","of","mel-frequency","bins","in","the","extracted","spectrogram","features",".","hop_length","(","`","int","`",",","*","optional","*",",","defaults","to","16",")",":","Number","of","ms","between","windows",".","Otherwise","referred","to","as","``","shift","''","in","many","papers",".","win_length","(","`","int","`",",","*","optional","*",",","defaults","to","64",")",":","Number","of","ms","per","window",".","win_function","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","hann_window","''","`",")",":","Name","for","the","window","function","used","for","windowing",",","must","be","accessible","via","`","torch",".","{","win_function","}","`","frame_signal_scale","(","`","float","`",",","*","optional","*",",","defaults","to","1.0",")",":","Constant","multiplied","in","creating","the","frames","before","applying","DFT",".","This","argument","is","deprecated",".","fmin","(","`","float","`",",","*","optional","*",",","defaults","to","80",")",":","Minimum","mel","frequency","in","Hz",".","fmax","(","`","float","`",",","*","optional","*",",","defaults","to","7600",")",":","Maximum","mel","frequency","in","Hz",".","mel_floor","(","`","float","`",",","*","optional","*",",","defaults","to","1e-10",")",":","Minimum","value","of","mel","frequency","banks",".","reduction_factor","(","`","int","`",",","*","optional","*",",","defaults","to","2",")",":","Spectrogram","length","reduction","factor",".","This","argument","is","deprecated",".","return_attention_mask","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","or","not","[","`","~SpeechT5FeatureExtractor.__call__","`","]","should","return","`","attention_mask","`","."]
code: def __init__(
      self,
      feature_size: int = 1,
      sampling_rate: int = 16000,
      padding_value: float = 0.0,
      do_normalize: bool = False,
      num_mel_bins: int = 80,
      hop_length: int = 16,
      win_length: int = 64,
      win_function: str = "hann_window",
      frame_signal_scale: float = 1.0,
      fmin: float = 80,
      fmax: float = 7600,
      mel_floor: float = 1e-10,
      reduction_factor: int = 2,
      return_attention_mask: bool = True,
      **kwargs,
  ):
      super().__init__(
          feature_size=feature_size,
          sampling_rate=sampling_rate,
          padding_value=padding_value,
          **kwargs,
      )
      self.do_normalize = do_normalize
      self.return_attention_mask = return_attention_mask
  
      self.num_mel_bins = num_mel_bins
      self.hop_length = hop_length
      self.win_length = win_length
      self.win_function = win_function
      self.frame_signal_scale = frame_signal_scale
      self.fmin = fmin
      self.fmax = fmax
      self.mel_floor = mel_floor
      self.reduction_factor = reduction_factor
  
      self.sample_size = win_length * sampling_rate // 1000
      self.sample_stride = hop_length * sampling_rate // 1000
      self.n_fft = optimal_fft_length(self.sample_size)
      self.n_freqs = (self.n_fft // 2) + 1
  
      self.window = window_function(
          window_length=self.sample_size,
          name=self.win_function,
          periodic=True,
      )
  
      self.mel_filters = mel_filter_bank(
          num_frequency_bins=self.n_freqs,
          num_mel_filters=self.num_mel_bins,
          min_frequency=self.fmin,
          max_frequency=self.fmax,
          sampling_rate=self.sampling_rate,
          norm="slaney",
          mel_scale="slaney",
      )
  
      if frame_signal_scale != 1.0:
          warnings.warn(
              "The argument `frame_signal_scale` is deprecated and will be removed in version 4.30.0 of Transformers",
              FutureWarning,
          )
      if reduction_factor != 2.0:
          warnings.warn(
              "The argument `reduction_factor` is deprecated and will be removed in version 4.30.0 of Transformers",
              FutureWarning,
          )
  
file_path: transformers/src/transformers/models/speecht5/feature_extraction_speecht5.py
imports: import warnings
  from typing import Any, Dict, List, Optional, Union
  import numpy
  from ...audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function
  from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
  from ...feature_extraction_utils import BatchFeature
  from ...utils import PaddingStrategy, TensorType, logging
label_desc: Use image node_id 1 to create a new SpeechT5FeatureExtractor object from inherited base classes: SequenceFeatureExtractor with example: obj = SpeechT5FeatureExtractor(feature_size, sampling_rate, padding_value, do_normalize, num_mel_bins, hop_length, win_length, win_function, frame_signal_scale, fmin, fmax, mel_floor, reduction_factor, return_attention_mask)