混音是指多个音频同时播放,不是指一段音频播放完以后接着播放另一段
from pydub import AudioSegment
sound1 = AudioSegment.from_mp3("source-02.wav")
sound2 = AudioSegment.from_mp3("source-01.wav")
# mix sound2 with sound1, starting at 0ms into sound1)
output = sound1.overlay(sound2)
# save the result
output.export("mixed_sounds.wav", format="wav")
如果想在某个位置开始再混音,需设置position
# mix sound2 with sound1, starting at 5000ms into sound1)
output = sound1.overlay(sound2,position=5000)