+
    œ°³jc*  ã                   óŽ   € R t ^ RIt^RIHtHtHt ^RIHt ^RI	H
t
 ^RIHtHt ]P                  ! ]4      t ! R R]4      tR.tR# )z"
Feature extractor class for CLVP
N)Úmel_filter_bankÚspectrogramÚwindow_function)ÚSequenceFeatureExtractor)ÚBatchFeature)Ú
TensorTypeÚloggingc                   ój   a a€ ] tR t^t oRtRR.tR
V 3R lltV3R lR ltRV3R lR lltR	t	Vt
V ;t# )ÚClvpFeatureExtractora­  
Constructs a CLVP 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 log-mel-spectrogram features from raw speech using a custom numpy implementation of the `Short
Time Fourier Transform` which should match pytorch's `torch.stft` equivalent.

Args:
    feature_size (`int`, *optional*, defaults to 80):
        The feature dimension of the extracted features.
    sampling_rate (`int`, *optional*, defaults to 22050):
        The sampling rate at which the audio files should be digitalized expressed in hertz (Hz).
    default_audio_length (`int`, *optional*, defaults to 6):
        The default length of raw audio in seconds. If `max_length` is not set during `__call__` then it will
        automatically be set to default_audio_length * `self.sampling_rate`.
    hop_length (`int`, *optional*, defaults to 256):
        Length of the overlapping windows for the STFT used to obtain the Mel Frequency coefficients.
    chunk_length (`int`, *optional*, defaults to 30):
        The maximum number of chunks of `sampling_rate` samples used to trim and pad longer or shorter audio
        sequences.
    n_fft (`int`, *optional*, defaults to 1024):
        Size of the Fourier transform.
    padding_value (`float`, *optional*, defaults to 0.0):
        Padding value used to pad the audio. Should correspond to silences.
    mel_norms (`list` of length `feature_size`, *optional*):
        If `mel_norms` is provided then it will be used to normalize the log-mel spectrograms along each
        mel-filter.
    return_attention_mask (`bool`, *optional*, defaults to `False`):
        Whether to return the attention mask. If left to the default, it will return the attention mask.

        [What are attention masks?](../glossary#attention-mask)
Úinput_featuresÚattention_maskc
                ó  <€ \         SV `  ! R
R VRVRVRV	/V
B  W`n        W@n        WPn        WR,          V n        V P
                  V,          V n        W n        W0n        W€n	        \        ^V^,          ,           VRRVRRR7      V n        R	# )Úfeature_sizeÚsampling_rateÚpadding_valueÚreturn_attention_maskç        g     @¿@ÚslaneyÚhtk)Únum_frequency_binsÚnum_mel_filtersÚmin_frequencyÚmax_frequencyr   ÚnormÚ	mel_scaleN© )ÚsuperÚ__init__Ún_fftÚ
hop_lengthÚchunk_lengthÚ	n_samplesÚnb_max_framesr   Údefault_audio_lengthÚ	mel_normsr   Úmel_filters)Úselfr   r   r#   r   r    r   r   r$   r   ÚkwargsÚ	__class__s   &&&&&&&&&&,€Úq/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/clvp/feature_extraction_clvp.pyr   ÚClvpFeatureExtractor.__init__D   s©   ø€ ô 	‰Òñ 	
Ø%ð	
à'ð	
ð (ð	
ð #8ð		
ð
 ò	
ð Œ
Ø$ŒØ(ÔØ%Õ5ˆŒØ!Ÿ^™^¨zÕ9ˆÔØ*ÔØ$8Ô!Ø"ŒÜ*Ø  E¨Q¥JÕ/Ø(ØØ Ø'ØØô
ˆÖó    c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# )é   ÚwaveformÚreturn)ÚnpÚndarray)ÚformatÚ__classdict__s   "€r)   Ú__annotate__Ú!ClvpFeatureExtractor.__annotate__j   s#   ø€ ÷ ñ ±2·:±:ð Á"Ç*Á*ñ r+   c           
     ó`  € \        V\        V P                  R4      V P                  V P                  RV P                  RR7      p\
        P                  ! \
        P                  ! VRRR7      4      pV P                  e/   V\
        P                  ! V P                  4      R,          ,          pV# )z 
This method first computes the log-mel spectrogram of the provided audio then applies normalization along the
each mel-filterbank, if `mel_norms` is provided.
Úhanng       @N)Úframe_lengthr   Úpowerr%   Úlog_melgñhãˆµøä>)Úa_minÚa_max):NNNN)
r   r   r   r   r%   r0   ÚlogÚclipr$   Úarray)r&   r.   Úlog_specs   && r)   Ú_np_extract_fbank_featuresÚ/ClvpFeatureExtractor._np_extract_fbank_featuresj   s„   € ô
 ØÜ˜DŸJ™J¨Ó/ØŸ™Ø—‘ØØ×(Ñ(Øô
ˆô —6’6œ"Ÿ'š' (°$¸dÔCÓDˆà�>‰>Ò%Ø¤"§(¢(¨4¯>©>Ó":¸7Õ"CÕCˆHàˆr+   c                óL  <€ V ^8„  d   QhRS[ P                  S[S[,          ,          S[S[ P                  ,          ,          S[S[S[,          ,          ,          RS[R,          RS[RS[R,          RS[S[,          R,          RS[R,          RS[R,          R	S[R,          R
S[/	# )r-   Ú
raw_speechr   NÚ
truncationÚpad_to_multiple_ofÚreturn_tensorsr   ÚpaddingÚ
max_lengthr/   )	r0   r1   ÚlistÚfloatÚintÚboolÚstrr   r   )r2   r3   s   "€r)   r4   r5   €   sÂ   ø€ ÷ j@ñ j@á—J‘J¡¡e¥Õ,©t±B·J±JÕ/?Õ?Á$ÁtÉEÅ{ÕBSÕSðj@ñ ˜T•zðj@ñ ð	j@ñ
   $�Jðj@ñ ™jÕ(¨4Õ/ðj@ñ  $ d�{ðj@ñ �t•ðj@ñ ˜$•Jðj@ñ 
ñj@r+   c	                ó  € VeR   W P                   8w  dA   \        RV P                  P                   RV P                    RV P                    RV R2	4      hM-\        P                  RV P                  P                   R24       \        V\        P                  4      ;'       d    \        VP                  4      ^8„  p
V
'       d)   \        VP                  4      ^8”  d   \        RV  24      hT
;'       gK    \        V\        \        34      ;'       d-    \        V^ ,          \        P                  \        \        34      pV'       dB   V Uu. uF4  p\        P                  ! V.\        P                  R	7      P                  NK6  	  ppMÀV'       gH   \        V\        P                  4      '       g(   \        P                  ! V\        P                  R	7      pMq\        V\        P                  4      '       dR   VP                   \        P                   ! \        P"                  4      J d    VP%                  \        P                  4      pV'       g#   \        P                  ! V.4      P                  .p\'        R
V/4      pVf   V P(                  V P                   ,          MTpV P+                  VVVVVVR7      pVP-                  R
4      P/                  ^^ ^4      pV^ ,           Uu. uF1  pV P1                  V4      P%                  \        P                  4      NK3  	  pp\        V^ ,          \        4      '       d+   V Uu. uF  p\        P                  ! V4      NK  	  upVR
&   MWþR
&   VP3                  V4      # u upi u upi u upi )a¹  
`ClvpFeatureExtractor` is used to extract various voice specific properties such as the pitch and tone of the
voice, speaking speed, and even speaking defects like a lisp or stuttering from a sample voice or `raw_speech`.

First the voice is padded or truncated in a way such that it becomes a waveform of `self.default_audio_length`
seconds long and then the log-mel spectrogram is extracted from it.

Args:
    raw_speech (`np.ndarray`, `list[float]`, `list[np.ndarray]`, `list[list[float]]`):
        The sequence or batch of sequences to be padded. Each sequence can be a numpy array, a list of float
        values, a list of numpy arrays or a list of list of float values. Must be mono channel audio, not
        stereo, i.e. single float per timestep.
    sampling_rate (`int`, *optional*):
        The sampling rate at which the `raw_speech` input was sampled. It is strongly recommended to pass
        `sampling_rate` at the forward call to prevent silent errors and allow automatic speech recognition
        pipeline.
    truncation (`bool`, *optional*, default to `True`):
        Activates truncation to cut input sequences longer than *max_length* to *max_length*.
    pad_to_multiple_of (`int`, *optional*):
        If set will pad the sequence to a multiple of the provided value.

        This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability
        `>= 7.5` (Volta), or on TPUs which benefit from having sequence lengths be a multiple of 128.
    return_attention_mask (`bool`, *optional*, defaults to `True`):
        Whether to return the attention mask. If left to the default, it will return the attention mask.

        [What are attention masks?](../glossary#attention-mask)
    return_tensors (`str` or [`~utils.TensorType`], *optional*):
        If set, will return tensors instead of list of python integers. Acceptable values are:

        - `'pt'`: Return PyTorch `torch.Tensor` objects.
        - `'np'`: Return Numpy `np.ndarray` objects.
    padding_value (`float`, *optional*, defaults to 0.0):
        The value that is used to fill the padding values / vectors.
    max_length (`int`, *optional*):
        The maximum input length of the inputs.
z3The model corresponding to this feature extractor: z& was trained using a sampling rate of zI. Please make sure that the provided `raw_speech` input was sampled with z	 and not Ú.zDIt is strongly recommended to pass the `sampling_rate` argument to `zN()`. Failing to do so can result in silent errors that might be hard to debug.z2Only mono-channel audio is supported for input to )Údtyper   )rH   rI   rE   rF   r   )r   Ú
ValueErrorr(   Ú__name__ÚloggerÚwarningÚ
isinstancer0   r1   ÚlenÚshaperJ   ÚtupleÚasarrayÚfloat32ÚTrQ   Úfloat64Úastyper   r#   ÚpadÚgetÚ	transposerA   Úconvert_to_tensors)r&   rD   r   rE   rF   rG   r   rH   rI   r'   Úis_batched_numpyÚ
is_batchedÚspeechÚbatched_speechÚpadded_inputsr   r.   Úfeatures   &&&&&&&&&,        r)   Ú__call__ÚClvpFeatureExtractor.__call__€   s  € ðd Ò$Ø× 2Ñ 2Ô2Ü ØIÈ$Ï.É.×JaÑJaÐIbð c)Ø)-×);Ñ);Ð(<ð =)Ø)-×);Ñ);Ð(<¸IÀmÀ_ÐTUðWóð ð 3ô �N‰NØVÐW[×WeÑWe×WnÑWnÐVoð p\ð \ôô
 & j´"·*±*Ó=×[Ð[Ä#Àj×FVÑFVÓBWÐZ[ÑB[Ðß¤ J×$4Ñ$4Ó 5¸Ô 9ÜÐQÐRVÐQWÐXÓYÐYØ%÷ 
ð 
Ü�z¤D¬% =Ó1×lÐl´zÀ*ÈQÅ-ÔRT×R\ÑR\Ô^cÔeiÐQjÓ7kð 	÷ ÙQ[Ó\ÑQ[Àvœ"Ÿ*š* f X´R·Z±ZÔ@×BÔBÑQ[ˆJÐ\ˆJß¤J¨z¼2¿:¹:×$FÒ$FÜŸš J´b·j±jÔA‰JÜ˜
¤B§J¡J×/Ò/°J×4DÑ4DÌÏÊÔQS×Q[ÑQ[ÓH\Ó4\Ø#×*Ñ*¬2¯:©:Ó6ˆJ÷ ÜŸ*š* j \Ó2×4Ñ4Ð5ˆJä%Ð'7¸Ð&DÓEˆàGQÒGY�T×.Ñ.°×1CÑ1CÖCÐ_iˆ
àŸ™ØØØ!Ø!Ø1Ø"7ð !ó 
ˆð '×*Ñ*Ð+;Ó<×FÑFÀqÈ!ÈQÓOˆð ZhÐhiÖYjó
ÙYjÈXˆD×+Ñ+¨HÓ5×<Ñ<¼R¿Z¹ZÖHÑYjð 	ð 
ô �n QÕ'¬×.Ò.ÙR`Ó.aÑR`Àw¬r¯zªz¸'Ö/BÑR`Ñ.aˆMÐ*Ò+à.<Ð*Ñ+à×/Ñ/°Ó?Ð?ùòG ]ùò4
ùò
 /bs   Å:M=Ë(7NÍN)	r    r#   r   r%   r$   r   r!   r"   r   )	éP   i"V  é   é   é   i   r   NF)NTNNTrI   N)rS   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úmodel_input_namesr   rA   ri   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r(   r3   s   @@r)   r
   r
      s>   ù‡ € ñ!ðF *Ð+;Ð<Ð÷$
÷Lð ÷,j@÷ j@ò j@r+   r
   )rr   Únumpyr0   Úaudio_utilsr   r   r   Ú!feature_extraction_sequence_utilsr   Úfeature_extraction_utilsr   Úutilsr   r   Ú
get_loggerrS   rT   r
   Ú__all__r   r+   r)   Ú<module>r~      sL   ðñó ç HÑ HÝ IÝ 4ß (ð 
×	Ò	˜HÓ	%€ôL@Ð3ô L@ð^ "Ð
"‚r+   