gpt4 book ai didi

python - 连接音频文件 [Python 2.7]

转载 作者:行者123 更新时间:2023-12-03 00:14:59 24 4
gpt4 key购买 nike

有什么方法可以将两个音频文件连接或合并为一个?

要求 :必须只使用内置模块[可以使用 PyGame]

音频文件格式 : .wma 或 .wav 或 .mp3

我现在查看了许多问题,并找到了涉及下载模块的解决方案(我不喜欢)。

欢迎任何帮助。

最佳答案

我做了一些研究,发现了这一点。

#import libraries
from glob import iglob
import shutil
import os
#create path variable
PATH = r'C:\music'
#create everything.mp3
destination = open('everything.mp3', 'wb')
for filename in iglob(os.path.join(PATH, '*.mp3')):
shutil.copyfileobj(open(filename, 'rb'), destination)
#make them all together with for
destination.close()
#close file

来自 here .

关于python - 连接音频文件 [Python 2.7],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35825680/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com