I have been trying to create a desktop application that converts mp3 files to wav. However, when ever I choose a file I always receive the a filename error. Can someone help me?
file_path = askopenfilenames()
p = str(file_path)
os.path.normpath(p)
os.chdir(p)
audio_files = os.listdir()
for file in audio_files:
#spliting the file into the name and the extension
name, ext = os.path.splitext(file)
if ext == ".mp3":
mp3_sound = AudioSegment.from_mp3(file)
mp3_sound = mp3_sound.set_channels(1)
mp3_sound = mp3_sound.set_frame_rate(8000)
#rename them using the old name + ".wav"
mp3_sound.export("{0}.wav".format(name), format="wav",codec='pcm_mulaw')
print("Completed!")