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 _process_audio(
      self,
      speech: Union[
          np.ndarray, List[float], List[np.ndarray], List[List[float]]
      ],
      is_target: bool = False,
      padding: Union[bool, str, PaddingStrategy] = False,
      max_length: Optional[int] = None,
      truncation: bool = False,
      pad_to_multiple_of: Optional[int] = None,
      return_attention_mask: Optional[bool] = None,
      return_tensors: Optional[Union[str, TensorType]] = None,
      **kwargs,
  ) -> BatchFeature:
      is_batched_numpy = (
          isinstance(speech, np.ndarray) and len(speech.shape) > 1
      )
      if is_batched_numpy and len(speech.shape) > 2:
          raise ValueError(
              f"Only mono-channel audio is supported for input to {self}"
          )
      is_batched = is_batched_numpy or (
          isinstance(speech, (list, tuple))
          and (isinstance(speech[0], (np.ndarray, tuple, list)))
      )
  
      if is_batched:
          speech = [
              np.asarray(speech, dtype=np.float32) for speech in speech
          ]
      elif not is_batched and not isinstance(speech, np.ndarray):
          speech = np.asarray(speech, dtype=np.float32)
      elif isinstance(speech, np.ndarray) and speech.dtype is np.dtype(
          np.float64
      ):
          speech = speech.astype(np.float32)
  
      # always return batch
      if not is_batched:
          speech = [speech]
  
      # needed to make pad() work on spectrogram inputs
      feature_size_hack = self.feature_size
  
      # convert into correct format for padding
      if is_target:
          features = [
              self._extract_mel_features(waveform)
              for waveform in speech
          ]
          encoded_inputs = BatchFeature({"input_values": features})
          self.feature_size = self.num_mel_bins
      else:
          encoded_inputs = BatchFeature({"input_values": speech})
  
      padded_inputs = self.pad(
          encoded_inputs,
          padding=padding,
          max_length=max_length,
          truncation=truncation,
          pad_to_multiple_of=pad_to_multiple_of,
          return_attention_mask=return_attention_mask,
          **kwargs,
      )
  
      self.feature_size = feature_size_hack
  
      # convert input values to correct format
      input_values = padded_inputs["input_values"]
      if not isinstance(input_values[0], np.ndarray):
          padded_inputs["input_values"] = [
              np.asarray(array, dtype=np.float32)
              for array in input_values
          ]
      elif (
          not isinstance(input_values, np.ndarray)
          and isinstance(input_values[0], np.ndarray)
          and input_values[0].dtype is np.dtype(np.float64)
      ):
          padded_inputs["input_values"] = [
              array.astype(np.float32) for array in input_values
          ]
      elif isinstance(
          input_values, np.ndarray
      ) and input_values.dtype is np.dtype(np.float64):
          padded_inputs["input_values"] = input_values.astype(
              np.float32
          )
  
      # convert attention_mask to correct format
      attention_mask = padded_inputs.get("attention_mask")
      if attention_mask is not None:
          padded_inputs["attention_mask"] = [
              np.asarray(array, dtype=np.int32)
              for array in attention_mask
          ]
  
      # zero-mean and unit-variance normalization
      if not is_target and self.do_normalize:
          attention_mask = (
              attention_mask
              if self._get_padding_strategies(
                  padding, max_length=max_length
              )
              is not PaddingStrategy.DO_NOT_PAD
              else None
          )
          padded_inputs["input_values"] = self.zero_mean_unit_var_norm(
              padded_inputs["input_values"],
              attention_mask=attention_mask,
              padding_value=self.padding_value,
          )
  
      if return_tensors is not None:
          padded_inputs = padded_inputs.convert_to_tensors(
              return_tensors
          )
  
      return padded_inputs
  
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 5 for calling the SpeechT5FeatureExtractor obj's underlying member method code with example usage: obj._process_audio(speech, is_target, padding, max_length, truncation, pad_to_multiple_of, return_attention_mask, return_tensors) and returns: padded_inputs