
    -i;                     v    d dl mZ d dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZ e G d de	                      ZdS )	    )	dataclassN)Clip)audio_video_effect)Effect)convert_to_secondsc                   P    e Zd ZU dZeed<   d Zd Zd Ze	de
de
fd            Zd	S )
AudioFadeIna  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    t          | j                  | _        d S N)r   r
   selfs    Z/var/www/html/speakWrite/venv/lib/python3.11/site-packages/moviepy/audio/fx/AudioFadeIn.py__post_init__zAudioFadeIn.__post_init__!   s    *4=99    c                     d S )Nc                 2    t          j        | |z  d          S )N   )npminimum)tr
   s     r   <lambda>z1AudioFadeIn._mono_factor_getter.<locals>.<lambda>%   s    2:a(lA#>#> r    r   s    r   _mono_factor_getterzAudioFadeIn._mono_factor_getter$   s    >>>r   c                     fd}|S )Nc                     t          j        | |z  d          t          j        fdt                    D                       j        S )Nr   c                     g | ]}S r   r   ).0_factors     r   
<listcomp>zEAudioFadeIn._stereo_factor_getter.<locals>.getter.<locals>.<listcomp>*   s    >>>V>>>r   )r   r   arrayrangeT)r   r
   r    	nchannelss     @r   getterz1AudioFadeIn._stereo_factor_getter.<locals>.getter(   sI    ZHa00F8>>>>U9-=-=>>>??AAr   r   )r   r%   r&   s    ` r   _stereo_factor_getterz!AudioFadeIn._stereo_factor_getter'   s(    	B 	B 	B 	B 	B r   clipreturnc                      |j         t          d          |j        dk    r                                 n                     |j                  |                     fd          S )zApply the effect to the clip.NzAttribute 'duration' not setr   c                 >     |j                    | |          z  S r   )r
   )	get_framer   
get_factorr   s     r   r   z#AudioFadeIn.apply.<locals>.<lambda>;   s"    At}!=!=		!!L r   )r
   
ValueErrorr%   r   r'   	transform)r   r(   r-   s   ` @r   applyzAudioFadeIn.apply.   s     = ;<<< ~"" $$&&&++DN;; 	 ~~LLLLL
 
 	
r   N)__name__
__module____qualname____doc__float__annotations__r   r   r'   r   r   r0   r   r   r   r	   r	      s          $ OOO: : :? ? ?   
$ 
4 
 
 
 
 
 
r   r	   )dataclassesr   numpyr   moviepy.Clipr   moviepy.decoratorsr   moviepy.Effectr   moviepy.toolsr   r	   r   r   r   <module>r=      s    ! ! ! ! ! !           1 1 1 1 1 1 ! ! ! ! ! ! , , , , , , 0
 0
 0
 0
 0
& 0
 0
 0
 0
 0
r   