
    ͑iy                        S SK Jr  S SKJrJr  \(       a  S SKJr  S SKJr   " S S5      r	SS jr
    S           SS jjr   S             SS
 jjrg	)    )annotations)TYPE_CHECKINGBinaryIO)Path)Tensorc                  n    \ rS rSr% SrS\S'   S\S'   S\S'   S\S'   S\S	'               SS
 jrSrg)	AudioInfo   z0Audio info, return type of backend info functionintsample_ratenum_samplesnum_channelsbits_per_samplestrencodingc                @    Xl         X l        X0l        X@l        XPl        g )N)r   r   r   r   r   )selfr   r   r   r   r   s         ]/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/paddle/audio/backends/backend.py__init__AudioInfo.__init__"   s!     '&(.     )r   r   r   r   r   N)r   r   r   r   r   r   r   r   r   r   returnNone)__name__
__module____qualname____firstlineno____doc____annotations__r   __static_attributes__ r   r   r	   r	      sa    :M!! ! 	!
 ! ! 
!r   r	   c                    [        S5      e)a  Get signal information of input audio file.

Args:
    filepath: audio path or file object.

Returns:
    AudioInfo: info of the given audio.

Example:
    .. code-block:: python

        >>> import os
        >>> import paddle

        >>> sample_rate = 16000
        >>> wav_duration = 0.5
        >>> num_channels = 1
        >>> num_frames = sample_rate * wav_duration
        >>> wav_data = paddle.linspace(-1.0, 1.0, int(num_frames)) * 0.1
        >>> waveform = wav_data.tile([num_channels, 1])
        >>> base_dir = os.getcwd()
        >>> filepath = os.path.join(base_dir, "test.wav")

        >>> paddle.audio.save(filepath, waveform, sample_rate)
        >>> wav_info = paddle.audio.info(filepath)
please set audio backendNotImplementedError)filepaths    r   infor'   1   s    8 8
99r   c                    [        S5      e)aC  Load audio data from file.Load the audio content start form frame_offset, and get num_frames.

Args:
    frame_offset: from 0 to total frames,
    num_frames: from -1 (means total frames) or number frames which want to read,
    normalize:
        if True: return audio which norm to (-1, 1), dtype=float32
        if False: return audio with raw data, dtype=int16

    channels_first:
        if True: return audio with shape (channels, time)

Return:
    Tuple[paddle.Tensor, int]: (audio_content, sample rate)

Examples:
    .. code-block:: python

        >>> import os
        >>> import paddle

        >>> sample_rate = 16000
        >>> wav_duration = 0.5
        >>> num_channels = 1
        >>> num_frames = sample_rate * wav_duration
        >>> wav_data = paddle.linspace(-1.0, 1.0, int(num_frames)) * 0.1
        >>> waveform = wav_data.tile([num_channels, 1])
        >>> base_dir = os.getcwd()
        >>> filepath = os.path.join(base_dir, "test.wav")

        >>> paddle.audio.save(filepath, waveform, sample_rate)
        >>> wav_data_read, sr = paddle.audio.load(filepath)
r#   r$   )r&   frame_offset
num_frames	normalizechannels_firsts        r   loadr-   P   s    R 8
99r   Nc                    [        S5      e)a  
Save audio tensor to file.

Args:
    filepath: saved path
    src: the audio tensor
    sample_rate: the number of samples of audio per second.
    channels_first: src channel information
        if True, means input tensor is (channels, time)
        if False, means input tensor is (time, channels)
    encoding:encoding format, wave_backend only support PCM16 now.
    bits_per_sample: bits per sample, wave_backend only support 16 bits now.

Returns:
    None

Examples:
    .. code-block:: python

        >>> import paddle

        >>> sample_rate = 16000
        >>> wav_duration = 0.5
        >>> num_channels = 1
        >>> num_frames = sample_rate * wav_duration
        >>> wav_data = paddle.linspace(-1.0, 1.0, int(num_frames)) * 0.1
        >>> waveform = wav_data.tile([num_channels, 1])
        >>> filepath = "./test.wav"

        >>> paddle.audio.save(filepath, waveform, sample_rate)
r#   r$   )r&   srcr   r,   r   r   s         r   saver0   |   s    P 8
99r   )r&   zstr | BinaryIOr   r	   )r   TT)r&   z
str | Pathr)   r   r*   r   r+   boolr,   r2   r   ztuple[Tensor, int])TN   )r&   r   r/   r   r   r   r,   r2   r   z
str | Noner   z
int | Noner   r   )
__future__r   typingr   r   pathlibr   paddler   r	   r'   r-   r0   r!   r   r   <module>r8      s    # *! !0:B ):):): ): 	):
 ): ):`  "$(:(:	(: (: 	(:
 (:  (: 
(:r   