moviepy.audio.fx.AudioDelay#
- class moviepy.audio.fx.AudioDelay.AudioDelay(offset: float = 0.2, n_repeats: int = 8, decay: float = 1)[source]#
Repeats audio certain number of times at constant intervals multiplying their volume levels using a linear space in the range 1 to
decayargument 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
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)])
- copy()#
Return a shallow copy of an Effect.
You must always copy an
Effectbefore applying, because some of them will modify their own attributes when applied. For example, setting a previously unset property by using target clip property.If we was to use the original effect, calling the same effect multiple times could lead to different properties, and different results for equivalent clips.
By using copy, we ensure we can use the same effect object multiple times while maintaining the same behavior/result.
In a way, copy makes the effect himself being kind of idempotent.