§
    
@Äj’  ã                   óÞ  — d dl Z d dlmZmZmZmZ d dlZddlmZ ddlm	Z	m
Z
mZmZmZmZmZ ddlmZmZ 	 ddlmZmZ n# e$ r Y nw xY w	 	 	 	 	 	 	 ddeeee j        f         dededededee         dedee         deej        ef         fd„Z	 	 	 	 	 	 	 ddeee j        f         dej        dededee         dee         dee         dedee         deeeef                  ddfd„Zg d¢ZdS )é    N)ÚBinaryIOÚOptionalÚTupleÚUnioné   )Ú
_extension)Ú
complianceÚdatasetsÚ
functionalÚmodelsÚ	pipelinesÚ
transformsÚutils)Úload_with_torchcodecÚsave_with_torchcodec)Ú__version__Úgit_versionéÿÿÿÿTé   ÚuriÚframe_offsetÚ
num_framesÚ	normalizeÚchannels_firstÚformatÚbuffer_sizeÚbackendÚreturnc           
      ó0   — t          | |||||||¬¦  «        S )aé
  Load audio data from source using TorchCodec's AudioDecoder.

    .. note::

        As of TorchAudio 2.9, this function relies on TorchCodec's decoding capabilities under the hood. It is
        provided for convenience, but we do recommend that you port your code to
        natively use ``torchcodec``'s ``AudioDecoder`` class for better
        performance:
        https://docs.pytorch.org/torchcodec/stable/generated/torchcodec.decoders.AudioDecoder.
        Because of the reliance on Torchcodec, the parameters ``normalize``, ``buffer_size``, and
        ``backend`` are ignored and accepted only for backwards compatibility.
        To install torchcodec, follow the instructions at https://github.com/pytorch/torchcodec#installing-torchcodec.


    Args:
        uri (path-like object or file-like object):
            Source of audio data. The following types are accepted:

            * ``path-like``: File path or URL.
            * ``file-like``: Object with ``read(size: int) -> bytes`` method.

        frame_offset (int, optional):
            Number of samples to skip before start reading data.
        num_frames (int, optional):
            Maximum number of samples to read. ``-1`` reads all the remaining samples,
            starting from ``frame_offset``.
        normalize (bool, optional):
            TorchCodec always returns normalized float32 samples. This parameter
            is ignored and a warning is issued if set to False.
            Default: ``True``.
        channels_first (bool, optional):
            When True, the returned Tensor has dimension `[channel, time]`.
            Otherwise, the returned Tensor's dimension is `[time, channel]`.
        format (str or None, optional):
            Format hint for the decoder. May not be supported by all TorchCodec
            decoders. (Default: ``None``)
        buffer_size (int, optional):
            Not used by TorchCodec AudioDecoder. Provided for API compatibility.
        backend (str or None, optional):
            Not used by TorchCodec AudioDecoder. Provided for API compatibility.

    Returns:
        (torch.Tensor, int): Resulting Tensor and sample rate.
        Always returns float32 tensors. If ``channels_first=True``, shape is
        `[channel, time]`, otherwise `[time, channel]`.

    Raises:
        ImportError: If torchcodec is not available.
        ValueError: If unsupported parameters are used.
        RuntimeError: If TorchCodec fails to decode the audio.

    Note:
        - TorchCodec always returns normalized float32 samples, so the ``normalize``
        parameter has no effect.
        - The ``buffer_size`` and ``backend`` parameters are ignored.
        - Not all audio formats supported by torchaudio backends may be supported
        by TorchCodec.
    )r   r   r   r   r   r   r   )r   )r   r   r   r   r   r   r   r   s           úDC:\Projects\Historical\venv\Lib\site-packages\torchaudio/__init__.pyÚloadr!      s4   € õH  ØØ!ØØØ%ØØØð	ñ 	ô 	ð 	ó    ÚsrcÚsample_rateÚencodingÚbits_per_sampleÚcompressionc
                 ó4   — t          | |||||||||	¬¦
  «
        S )an  Save audio data to file using TorchCodec's AudioEncoder.

    .. note::

        As of TorchAudio 2.9, this function relies on TorchCodec's encoding capabilities under the hood.
        It is provided for convenience, but we do recommend that you port your code to
        natively use ``torchcodec``'s ``AudioEncoder`` class for better
        performance:
        https://docs.pytorch.org/torchcodec/stable/generated/torchcodec.encoders.AudioEncoder.
        Because of the reliance on Torchcodec, the parameters ``format``, ``encoding``,
        ``bits_per_sample``, ``buffer_size``, and ``backend``, are ignored and accepted only for
        backwards compatibility.
        To install torchcodec, follow the instructions at https://github.com/pytorch/torchcodec#installing-torchcodec.

    Args:
        uri (path-like object):
            Path to save the audio file. The file extension determines the format.

        src (torch.Tensor):
            Audio data to save. Must be a 1D or 2D tensor with float32 values
            in the range [-1, 1]. If 2D, shape should be [channel, time] when
            channels_first=True, or [time, channel] when channels_first=False.

        sample_rate (int):
            Sample rate of the audio data.

        channels_first (bool, optional):
            Indicates whether the input tensor has channels as the first dimension.
            If True, expects [channel, time]. If False, expects [time, channel].
            Default: True.

        format (str or None, optional):
            Audio format hint. Not used by TorchCodec (format is determined by
            file extension). A warning is issued if provided.
            Default: None.

        encoding (str or None, optional):
            Audio encoding. Not fully supported by TorchCodec AudioEncoder.
            A warning is issued if provided. Default: None.

        bits_per_sample (int or None, optional):
            Bits per sample. Not directly supported by TorchCodec AudioEncoder.
            A warning is issued if provided. Default: None.

        buffer_size (int, optional):
            Not used by TorchCodec AudioEncoder. Provided for API compatibility.
            A warning is issued if not default value. Default: 4096.

        backend (str or None, optional):
            Not used by TorchCodec AudioEncoder. Provided for API compatibility.
            A warning is issued if provided. Default: None.

        compression (float, int or None, optional):
            Compression level or bit rate. Maps to bit_rate parameter in
            TorchCodec AudioEncoder. Default: None.

    Raises:
        ImportError: If torchcodec is not available.
        ValueError: If input parameters are invalid.
        RuntimeError: If TorchCodec fails to encode the audio.

    Note:
        - TorchCodec AudioEncoder expects float32 samples in [-1, 1] range.
        - Some parameters (format, encoding, bits_per_sample, buffer_size, backend)
        are not used by TorchCodec but are provided for API compatibility.
        - The output format is determined by the file extension in the uri.
        - TorchCodec uses FFmpeg under the hood for encoding.
    )r   r   r%   r&   r   r   r'   )r   )
r   r#   r$   r   r   r%   r&   r   r   r'   s
             r    Úsaver)   b   s:   € õ`  ØØØØ%ØØØ'ØØØðñ ô ð r"   )r!   r   r   r)   r	   r
   r   r   r   r   r   )r   r   TTNr   N)TNNNr   NN) ÚosÚtypingr   r   r   r   ÚtorchÚ r   r	   r
   r   r   r   r   r   Ú_torchcodecr   r   Úversionr   r   ÚImportErrorÚstrÚPathLikeÚintÚboolÚTensorr!   Úfloatr)   Ú__all__© r"   r    ú<module>r9      s€  ðØ 	€	€	€	Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3à €€€ð Ð Ð Ð Ð Ð Ø TÐ TÐ TÐ TÐ TÐ TÐ TÐ TÐ TÐ TÐ TÐ TÐ TÐ TÐ TÐ TÐ TÐ TØ CÐ CÐ CÐ CÐ CÐ CÐ CÐ Cð	Ø1Ð1Ð1Ð1Ð1Ð1Ð1Ð1Ð1øØð 	ð 	ð 	Ø€Dð	øøøð ØØØØ ØØ!ðMð MØ	ˆx˜˜bœkÐ)Ô	*ðMàðMð ðMð ð	Mð
 ðMð �SŒMðMð ðMð �cŒ]ðMð ˆ5Œ<˜ÐÔðMð Mð Mð Mðh  Ø Ø"Ø%)ØØ!Ø/3ð[ð [Ø	ˆs�B”KÐÔ	 ð[à	Œð[ð ð[ð ð	[ð
 �SŒMð[ð �sŒmð[ð ˜c”]ð[ð ð[ð �cŒ]ð[ð ˜%  s 
Ô+Ô,ð[ð 
ð[ð [ð [ð [ð|ð ð €€€s   ¶? ¿AÁA