Skip to content

Video editing with Python

Add AudioClip stereo example (#1459)

Álvaro Mondéjar7c3dc0af5d34
diff --git a/moviepy/audio/AudioClip.py b/moviepy/audio/AudioClip.py
index db837ccb..1392c4b8 100644
--- a/moviepy/audio/AudioClip.py
+++ b/moviepy/audio/AudioClip.py
@@ -39,12 +39,20 @@ class AudioClip(Clip):
Examples
---------
- >>> # Plays the note A (a sine wave of frequency 440HZ)
+ >>> # Plays the note A in mono (a sine wave of frequency 440 Hz)
>>> import numpy as np
>>> make_frame = lambda t: np.sin(440 * 2 * np.pi * t)
>>> clip = AudioClip(make_frame, duration=5, fps=44100)
>>> clip.preview()
+ >>> # Plays the note A in stereo (two sine waves of frequencies 440 and 880 Hz)
+ >>> make_frame = lambda t: np.array([
+ ... np.sin(440 * 2 * np.pi * t),
+ ... np.sin(880 * 2 * np.pi * t)
+ ... ]).T.copy(order="C")
+ >>> clip = AudioClip(make_frame, duration=3, fps=44100)
+ >>> clip.preview()
+
"""
def __init__(self, make_frame=None, duration=None, fps=None):