
    gL	                     B    d Z ddlmZ ddlmZ ddlmZ  G d de      Zy)zMImplements AudioFileClip, a class for audio clips creation using audio files.    )	AudioClip)FFMPEG_AudioReader)convert_path_to_stringc                   6    e Zd ZdZ ed      	 dd       Zd Zy)AudioFileClipa  
    An audio clip read from a sound file, or an array.
    The whole file is not loaded in memory. Instead, only a portion is
    read and stored in memory. this portion includes frames before
    and after the last frames read, so that it is fast to read the sound
    backward and forward.

    Parameters
    ----------

    filename
      Either a soundfile name (of any extension supported by ffmpeg)
      as a string or a path-like object,
      or an array representing a sound. If the soundfile is not a .wav,
      it will be converted to .wav first, using the ``fps`` and
      ``bitrate`` arguments.

    buffersize:
      Size to load in memory (in number of frames)


    Attributes
    ----------

    nbytes
      Number of bits per frame of the original audio file.

    fps
      Number of frames per second in the audio file

    buffersize
      See Parameters.

    Lifetime
    --------

    Note that this creates subprocesses and locks files. If you construct one
    of these instances, you must call close() afterwards, or the subresources
    will not be cleaned up until the process ends.

    Examples
    --------

    .. code:: python

        snd = AudioFileClip("song.wav")
        snd.close()
    filenamec                 p    t        j                          | _        t        |||||       _        | _         j                  j                   _         j                  j                   _         j                  j                   _        | _         fd _	         j                  j                   _
        y )N)decode_filefpsnbytes
buffersizec                 :    j                   j                  |       S )N)reader	get_frame)tselfs    g/var/www/it7/html/youtubeDownloader/venv/lib/python3.12/site-packages/moviepy/audio/io/AudioFileClip.py<lambda>z(AudioFileClip.__init__.<locals>.<lambda>N   s    (=(=a(@     )r   __init__r   r   r   r   durationendr   frame_function	nchannels)r   r   r
   r   r   r   s   `     r   r   zAudioFileClip.__init__:   s     	4  (#!
 ,,;;''++00 @..r   c                 `    | j                   r"| j                   j                          d| _         yy)zClose the internal reader.N)r   close)r   s    r   r   zAudioFileClip.closeQ   s%    ;;KKDK r   N)Fi@    iD  )__name__
__module____qualname____doc__r   r   r    r   r   r   r      s)    /b J'LQ/ (/,r   r   N)r!   moviepy.audio.AudioClipr   moviepy.audio.io.readersr   moviepy.decoratorsr   r   r"   r   r   <module>r&      s    S - 7 5MI Mr   