Python Convert MP3 to WAV: A Simple Guide – Python Tutorial

By | July 7, 2022

In this tutorial, we will introduce how to convert a mp3 file to wav in python. We will use python pydub to implement it.

How to convert?

It is easy to convert a mp3 to mp4 using python pydub. Here is the example code:

from pydub import AudioSegment

# assign files
input_file = r"D:\1878_2.mp3"
output_file = r"D:\1878_2.wav"

# convert mp3 file to wav file
sound = AudioSegment.from_mp3(input_file)
sound.export(output_file, format="wav")

This example code will convert 1878_2.mp3 to 1878_2.wav

However, if you get this error: Couldn’t find ffmpeg or avconv in pydub

You can read this tutorial to fix:

Fix Couldn’t find ffmpeg or avconv in pydub – Python Tutorial

Leave a Reply