
    g                     t    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 d dlmZ e G d d	e             Zy)
    )	dataclassN)CompositeAudioClip)MultiplyVolume)Clip)audio_video_effect)Effectc                   V    e Zd ZU dZdZeed<   dZeed<   dZ	eed<   e
ded	efd
       Zy)
AudioDelaya  Repeats audio certain number of times at constant intervals multiplying
    their volume levels using a linear space in the range 1 to ``decay`` argument
    value.

    Parameters
    ----------

    offset : float, optional
      Gap between repetitions start times, in seconds.

    n_repeats : int, optional
      Number of repetitions (without including the clip itself).

    decay : float, optional
      Multiplication factor for the volume level of the last repetition. Each
      repetition will have a value in the linear function between 1 and this value,
      increasing or decreasing constantly. Keep in mind that the last repetition
      will be muted if this is 0, and if is greater than 1, the volume will increase
      for each repetition.

    Examples
    --------

    .. code:: python

        from moviepy import *
        videoclip = AudioFileClip('myaudio.wav').with_effects([
            afx.AudioDelay(offset=.2, n_repeats=10, decayment=.2)
        ])

        # stereo A note
        frame_function = lambda t: np.array(
            [np.sin(440 * 2 * np.pi * t), np.sin(880 * 2 * np.pi * t)]
        ).T
        clip = AudioClip(frame_function=frame_function, duration=0.1, fps=44100)
        clip = clip.with_effects([afx.AudioDelay(offset=.2, n_repeats=11, decay=0)])
    g?offset   	n_repeats   decayclipreturnc                 r   t        j                  dt        d| j                        | j                  dz         }t        |j                         gt        | j                        D cg c]B  }|j                  |dz   | j                  z        j                  t        ||dz            g      D c}      S c c}w )zApply the effect to the clip.r   r   )nplinspacemaxr   r   r   copyrange
with_startr   with_effectsr   )selfr   
decaymentsreps       d/var/www/it7/html/youtubeDownloader/venv/lib/python3.12/site-packages/moviepy/audio/fx/AudioDelay.pyapplyzAudioDelay.apply8   s     [[C4::$68JK
!		  %T^^4	  OOS1W$;<II'
37(;<=

 
	
s   %AB4
N)__name__
__module____qualname____doc__r   float__annotations__r   intr   r   r   r        r   r
   r
      sH    $L FEIsE5
$ 
4 
 
r'   r
   )dataclassesr   numpyr   moviepy.audio.AudioClipr   moviepy.audio.fx.MultiplyVolumer   moviepy.Clipr   moviepy.decoratorsr   moviepy.Effectr   r
   r&   r'   r   <module>r/      s5    !  6 :  1 ! 9
 9
 9
r'   