I'm trying to create a mix out of two audio tracks (vocal and instrumental) that are of the same duration (3.:30). However, when I try to use the overlay function, my vocal starts too soon.
from pydub import AudioSegment
sound1 = AudioSegment.from_file("vocals.mp3")
sound2 = AudioSegment.from_file("instrumental.mp3")
combined = sound1.overlay(sound2)
combined.export("mix.mp3", format='mp3')
I believe you can play with the position of
overlaywheredef overlay(self, seg, position=0, loop=False, times=None, gain_during_overlay=None)the position parameter means where on the original sound do you wish to start.Note that this will make your total song be as long as
sound1, to fix that you can add the rest of the song: