from pydub import AudioSegment

AudioSegment.ffmpeg = "path_to_ffmpeg_executable"
ea=["aa.mp3","ab.mp3","ac.mp3","ad.mp3","ae.mp3","af.mp3","ag.mp3","ah.mp3","ai.mp3","aj.mp3","ak.mp3","al.mp3","am.mp3","an.mp3","ao.mp3","ap.mp3","aq.mp3","ar.mp3","as.mp3","at.mp3","au.mp3","av.mp3","aw.mp3","ax.mp3","ay.mp3","az.mp3","ba.mp3","bb.mp3","bc.mp3","bd.mp3","be.mp3","bf.mp3","bg.mp3","bi.mp3","bj.mp3","bk.mp3","bl.mp3","bm.mp3","bn.mp3","bo.mp3","bp.mp3","bq.mp3","br.mp3","bs.mp3","bt.mp3","bu.mp3","bv.mp3","bw.mp3","bx.mp3","by.mp3","bz.mp3","ca.mp3","cb.mp3","cc.mp3","cd.mp3","ce.mp3","cf.mp3","cg.mp3","ch.mp3","cj.mp3","bh.mp3","ci.mp3"]
audio2 = AudioSegment.from_file(ea[0], format="mp3")
audio3 = AudioSegment.from_file(ea[60], format="mp3")
for eb in range(1,62):
    audio1 = AudioSegment.from_file(ea[eb], format="mp3")
    audio2 = audio2 + audio3 + audio1
audio2.export("db.mp3", format="mp3")

Here, db is the resulting audio, and ea contains the extremely short audios about 50 milliseconds in duration. db.mp3 is 5-6 times greater in duration than if the audios are played in a sequence.

I want to concatenate the short audios such that the resulting audio is about the duration if they are played sequentially.

0

There are 0 best solutions below