create python file

This commit is contained in:
Lostecho
2023-06-14 21:17:11 +08:00
parent 7287addda5
commit 8c4caf239f
5 changed files with 14 additions and 0 deletions

14
audio-combine.py Normal file
View 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
View File

0
download-no-audio.py Normal file
View File

0
dt-audio.py Normal file
View File

0
parse-json-file.py Normal file
View File