
    W|h;                     h    S SK Jr  S SKrS SKJr  S SKJr  S SKJ	r	  S SK
Jr  \ " S S\	5      5       rg)	    )	dataclassN)Clip)audio_video_effect)Effect)convert_to_secondsc                   R    \ rS rSr% Sr\\S'   S rS rS r	\
S\S\4S	 j5       rS
rg)AudioFadeIn   am  Return an audio (or video) clip that is first mute, then the
sound arrives progressively over ``duration`` seconds.

Parameters
----------

duration : float
    How long does it take for the sound to return to its normal level.

Examples
--------

.. code:: python

    clip = VideoFileClip("media/chaplin.mp4")
    clip.with_effects([afx.AudioFadeIn("00:00:06")])
durationc                 8    [        U R                  5      U l        g N)r   r   selfs    V/home/james-whalen/.local/lib/python3.13/site-packages/moviepy/audio/fx/AudioFadeIn.py__post_init__AudioFadeIn.__post_init__!   s    *4==9    c                     S $ )Nc                 4    [         R                  " X-  S5      $ N   )npminimum)tr   s     r   <lambda>1AudioFadeIn._mono_factor_getter.<locals>.<lambda>%   s    2::alA#>r    r   s    r   _mono_factor_getterAudioFadeIn._mono_factor_getter$   s    >>r   c                    ^ U4S jnU$ )Nc                    > [         R                  " X-  S5      n[         R                  " [        T5       Vs/ s H  o2PM     sn5      R                  $ s  snf r   )r   r   arrayrangeT)r   r   factor_	nchannelss       r   getter1AudioFadeIn._stereo_factor_getter.<locals>.getter(   sC    ZZa0F88U9-=>-=V-=>?AAA>s   Ar   )r   r'   r(   s    ` r   _stereo_factor_getter!AudioFadeIn._stereo_factor_getter'   s    	B r   clipreturnc                    ^ ^ UR                   c  [        S5      eUR                  S:X  a  T R                  5       OT R	                  UR                  5      mUR                  UU 4S j5      $ )zApply the effect to the clip.zAttribute 'duration' not setr   c                 <   > T" UTR                   5      U " U5      -  $ r   r   )	get_framer   
get_factorr   s     r   r   #AudioFadeIn.apply.<locals>.<lambda>;   s    At}}!=	!!Lr   )r   
ValueErrorr'   r   r*   	transform)r   r,   r2   s   ` @r   applyAudioFadeIn.apply.   sd     == ;<< ~~" $$&++DNN; 	 ~~L
 	
r   r0   N)__name__
__module____qualname____firstlineno____doc__float__annotations__r   r   r*   r   r   r6   __static_attributes__r   r   r   r	   r	      s?    $ O:? 
$ 
4 
 
r   r	   )dataclassesr   numpyr   moviepy.Clipr   moviepy.decoratorsr   moviepy.Effectr   moviepy.toolsr   r	   r   r   r   <module>rF      s2    !   1 ! , 0
& 0
 0
r   