forked from Zulko/moviepy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add audio normalization function (Zulko#609)
Issue: Zulko#32
- Loading branch information
1 parent
3d86a2c
commit 9664b38
Showing
5 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
moviepy.audio.fx.all.audio_normalize | ||
================================== | ||
|
||
.. currentmodule:: moviepy.audio.fx.all | ||
|
||
.. autofunction:: audio_normalize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from moviepy.decorators import audio_video_fx | ||
|
||
@audio_video_fx | ||
def audio_normalize(clip): | ||
""" Return an audio (or video) clip whose volume is normalized | ||
to 0db.""" | ||
|
||
mv = clip.max_volume() | ||
return clip.volumex(1 / mv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters