create python file
This commit is contained in:
14
audio-combine.py
Normal file
14
audio-combine.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from pydub import AudioSegment
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
date=datetime.today().strftime("%Y%m%d") #生成日期
|
||||
files=[file for file in Path("sounds").iterdir() if file.name.endswith(".mp3")] #遍历sounds目录下的文件
|
||||
def merge_mp3(files):
|
||||
song= AudioSegment.silent(duration=100)
|
||||
for file in sorted(files,reverse=True):
|
||||
songclip=AudioSegment.from_file(file)
|
||||
song = songclip + song
|
||||
song= AudioSegment.silent(duration=2000)+song
|
||||
return song
|
||||
sound=merge_mp3(files) #合并mp3
|
||||
sound.export(f'{date}.mp3', format("mp3")) #把合并合的mp3进行合成然后重命名。
|
||||
0
download-audio.py
Normal file
0
download-audio.py
Normal file
0
download-no-audio.py
Normal file
0
download-no-audio.py
Normal file
0
dt-audio.py
Normal file
0
dt-audio.py
Normal file
0
parse-json-file.py
Normal file
0
parse-json-file.py
Normal file
Reference in New Issue
Block a user