Batch Convert Stereo Audio to Mono Audio

Occasionally I find myself needing to mix down a bunch of Stereo audio files into a mono audio file because of gear restrictions or upload restrictions. While it’s not too bad to do with tools like Audacity, I’d much, much rather have a programmatic way to go about this.

Here’s a quick little bash script that will mix down every .wav file in a directory and append the word “.mono” onto the filename.


#!/bin/bash
for file in *.wav
do
ffmpeg -i "$file" -ac 1 "${file%wav}mono.wav"
done

If you’re using different audio files formats, just swap out the ‘wav’s with whatever you’re using. Save that as a .sh file and execute it with your favorite shell. After, if you want to clean up the directory, just run:


find . -type f ! -name '*.mono.wav' -delete

This will wipe every file (including itself) except the down mixed mono files out of the directory, leaving you with a clean working space.