1、首先你要知道pydub需要依赖 libav或者ffmpeg。

2、然后呢安装pydub: pip install pydub。

3、然后呢enPath = "%s%s/%s"%(enDir,file,enfile) #英文文件的路径
cnPath = "%s%s/%s"%(cnDir,file,enfile.replace("en_w","cn_w"))#中文文件的路径
targetPath = "%s%s/%s"%(toDir,file,enfile.replace("en_w","all")) #合并文件的路径
加载MP3文件。

4、然后呢把ong1 = AudioSegment.from_mp3(enPath)
song2 = AudioSegment.from_mp3(cnPath)。

5、然后呢取得两个MP3文件的声音分贝
db1 = song1.dBFS
db2 = song2.dBFS。

6、最后把导出音频文件
song.export(targetPath, format="mp3") #导出为MP3格式。
