Convert audio file formats using Python

I work closely with auditory stimuli. Sometimes I need to convert a large number of audio files from one format to another, usually because different experiment software works better with different audio formats. Here I share my Python script that converts all audio files in a folder from one format to another.

Step 1: Preparation

Install ffmpeg. Remember to put ffmpeg in your PATH.

Install Python (obviously) and pydub: pip install pydub.

Download the Python script. Gather all your files in a folder.

Step 2: Run the script

Open convert_audio.py in an IDLE. Modify these variables:

Run the script. Pydub is going to call ffmpeg to convert all files in your chosen folder with the original extension to the output format.

Back to Top ↑