I have code in Python that loops through and merges a series of audio files to play a customized sound as follows:
from pydub import AudioSegment
from pydub.playback import play
sounds = []
sounds.append(AudioSegment.from_file("Downloads/my_file.mp3"))
for i in range(4):
sounds.append(sounds[i].overlay(sounds[0], position=delays[i+1]))
for i in range(len(sounds)):
counter = 0
while counter <= 2:
play(sounds[i])
time.sleep(delays[i])
counter = counter + 1
How can I export the final sound that is played on my computer through this Python code?
I know it's possible to do something like:
my_custom_sound.export("/path/to/new/my_custom_sound.mp4", format="mp4")
But how can I save the custom sound that's outputted through my loops?