
    W|hL	                     B    S r SSKJr  SSKJr  SSKJr   " S S\5      rg)zMImplements AudioFileClip, a class for audio clips creation using audio files.    )	AudioClip)FFMPEG_AudioReader)convert_path_to_stringc                   @    \ rS rSrSr\" S5       SS j5       rS rSrg)	AudioFileClip   aH  
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                 n  ^  [         R                  " T 5        UT l        [        UUUUUS9T l        UT l        T R                  R                  T l        T R                  R                  T l        T R                  R                  T l        UT l        U 4S jT l	        T R                  R                  T l
        g )N)decode_filefpsnbytes
buffersizec                 :   > TR                   R                  U 5      $ )N)reader	get_frame)tselfs    X/home/james-whalen/.local/lib/python3.13/site-packages/moviepy/audio/io/AudioFileClip.py<lambda>(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   AudioFileClip.__init__:   s     	4  (#!
 ,,;;''++00 @..r   c                 j    U R                   (       a"  U R                   R                  5         SU l         gg)zClose the internal reader.N)r   close)r   s    r   r   AudioFileClip.closeQ   s%    ;;KKDK r   )r   r   r   r	   r   r   r   r   N)Fi@    iD  )	__name__
__module____qualname____firstlineno____doc__r   r   r   __static_attributes__ 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   