U
    a+d                     @   s   d dl ZdddZdS )    N皙?   {Gz?c                 C   s   t || j }d| | j }tdd | |D }||  }tj||ddt| d }d|dt || < d|t || d< |t| S )z Finds the period, in seconds of an audioclip.
    
    The beat is then given by bpm = 60/T

    t_min and _tmax are bounds for the returned value, t_res
    is the numerical precision
    g      ?c                 S   s   g | ]}|d    qS )r   )sum).0c r   </tmp/pip-unpacked-wheel-0yp4gafk/moviepy/audio/tools/cuts.py
<listcomp>   s     z%find_audio_period.<locals>.<listcomp>full)modeNr   )	intZfpsnparrayZiter_chunksZmeanZ	correlatelenZargmax)ZaclipZt_minZt_maxZt_res	chunksizeZchunk_durationvZcorrsr   r   r	   find_audio_period   s    
r   )r   r   r   )Znumpyr   r   r   r   r   r	   <module>   s   