Normalize all audio sources before applying effects

This commit is contained in:
Chev 2026-01-26 17:15:46 -08:00
parent 1f75d0189b
commit 2acdf266d6
Signed by: chev2
GPG key ID: 0B212D6AED495EC9

View file

@ -4,7 +4,7 @@ from sys import maxsize
from os import listdir, mkdir, path
# MoviePy modules
from moviepy import VideoFileClip, AudioFileClip, CompositeAudioClip, CompositeVideoClip, ImageClip, concatenate_videoclips, vfx, VideoClip
from moviepy import VideoFileClip, AudioFileClip, CompositeAudioClip, CompositeVideoClip, ImageClip, concatenate_videoclips, vfx, afx, VideoClip
from src import custom_effects
@ -163,6 +163,10 @@ copiedSoundAmount = 0
with tqdm(desc="Compiling sounds", total=len(randomSounds)) as pbar:
for index, audio in enumerate(randomSounds):
newClip = AudioFileClip(audio)
# Normalize the audio volume first
newClip = newClip.with_effects([afx.AudioNormalize()])
# Modify the volume of audio clips so that they (hopefully) won't drown out
# the audio coming from the video clips
newClip = newClip.with_volume_scaled(0.6)