我想使用 python 3 将多个音频文件格式从一个文件夹(名为“aud_test”)转换为唯一的 WAV 格式。在此之后,将所有文件保存在另一个文件夹(名为“re_test”)中,如下面的代码中所述。
import os
from pydub import AudioSegment
wrong_folder_path = "/output/aud_test"
right_folder_path = "/output/re_test"
def make_wav(wrong_folder_path, right_folder_path):
for file in os.scandir(wrong_folder_path):
if (ext == ".mp3" or ext == ".m4a" or ext == ".aac" or ext == ".opus" or ext == ".ogg" or ext == ".wma"):
out_file=right_folder_path+'/'+os.path.splitext(os.path.basename(file.path))[0]+".wav"
AudioSegment.from_file(file.path).export(out_file, format="wav")
print(f"{out_file}")
收到如下所述的错误消息:
TypeError: Traceback (most recent call last) <ipython-input-4-ad47c4ef00c8> in <module> ----> 1 "".join(1,2,3) TypeError: join() takes exactly one argument (3 given)