将mp3文件转换为wav文件
trans_mp3_to_wav.py
from pydub import AudioSegment
# 这里filepath填的是.mp3文件的名字(也可加上路径)
def trans_mp3_to_wav(filepath):
song = AudioSegment.from_mp3(filepath)
song.export("test.wav", format="wav")
trans_mp3_to_wav('test.mp3')
播放
play_wav.py
from pydub import AudioSegment
from pydub.playback import play
song = AudioSegment.from_wav("test.wav")
play(song)
标签:song,python,filepath,音频文件,pydub,mp3,wav,播放,AudioSegment
From: https://www.cnblogs.com/bitterteaer/p/17053606.html