How to convert MP3 to WAV in Python

How to convert MP3 to WAV in Python

I maintain an open source library, pydub, which can help you out with that.

from pydub import AudioSegment
sound = AudioSegment.from_mp3(/path/to/file.mp3)
sound.export(/output/path/file.wav, format=wav)

One caveat: it uses ffmpeg to handle audio format conversions (except for wav files, which python handles natively).

note: you probably shouldnt do this conversion on GAE :/ even if it did support ffmpeg. EC2 would be a good match for the job though

This is working for me:

import subprocess[ffmpeg, -i, audio.mp3,

How to convert MP3 to WAV in Python

I think I am right person to answer this question because I am student who tried hard to get answer for this question. I am giving answer for Windows users but I think this may work with MAC OS too. But apt for windows.

Lets discuss answers in steps:

first check for pydub and ffmpeg package. If you computer dont have these packages then install pydub in you command prompt

                    pip install pydub

Next and imp thing is ffmpeg package which converts images to different formats. For this you should manually install this package. Let me give you reason why when we can use pip for installing package. First pip installs the package but it will not stores the path to the system. So computer cant recognize this package path. For this I suggest you to install manually but how…. dont worry will give you steps.


#Present link

This first link that you have paste it in google

#Use for future students

But people will have question now this link might work what about future. For that simple answer is

After typing this in google go to releases and download zip folder always dont download thus is only when my first link will not work for future is any student search for answer.

STEP 2: After downloading the zip file from first step first link. Now make a folder in C drive. For this just click on my My PC, then OS(C:),make a new folder. Copy paste the zip file downloaded to this folder. Extract the zip file in this new folder. Now go into the folder and copy path of bin present in this folder from properties.

STEP 3:This is final step and imp one where you will set path. In search bar in your laptop search for Edit the system environmental variables. Then click on environmental variables at bottom for path. Here they are two parts in screen system variables and user variables. Now you have to search for path Path in system variable is you want to use for whole system. Double click on Path in system variables. A window appears where you have to choose New. Here copy paste the path of bin folder. Then click on Ok in all and close all tabs.

Step 4:Check for correct installation of ffmpeg. In command prompt type ffmpeg now you will get the list of paths and its features. This shows you have finished your installation.

Step 5 : Download a mp3 file. If your have downloaded python then open IDLE prompt. The click on new in File a note pad appears. One imp point to remember here is copy paste the mp3 file where you python code is stored. Example If I want to save the python file in Desktop the mp3 file should be stored in desktop. I think you go an idea. Now copy paste the code which I am using

                import subprocess
      [ffmpeg, -i, ind.mp3,ind1.wav])

then click on run module

you will get the conversion.

Thank you

This answer might help you. If you want code and method for converting speech to text code and method you can post me. I wish this answer for 10 min may save you hours.

use this video for path configuration or step 3 for reference but copy path to system variables not user because whole system can use this package then. If my language is bad dont mind I think it is understandable.

Leave a Reply

Your email address will not be published. Required fields are marked *