Batch finding/converting stereo audio files that are actually mono.

Sampler and Sampling discussion (techniques, tips and tricks, etc.)
Post Reply New Topic
RELATED
PRODUCTS

Post

Is there an application that can search for stereo 2 channel .WAV files that are actually mono (left and right channels are the same) and convert them to a single channel mono .WAV file? I'm looking to save HD space but don't have the time to do it manually.

Maybe even with a threshold since the noise floor can be stereo.

Post

I'd look at SoX or ffmpeg. A command line tool would facilitate automating such a task inside a script.

https://superuser.com/questions/1635775 ... -in-stereo
https://trac.ffmpeg.org/wiki/AudioChannelManipulation

Look at the examples for SoX in that superuser link. With some google-fu might even be able to find a script that does exactly what you want.

Seems like you need the following steps:
  1. recursively scan a directory tree of audio files
  2. for each audio file found:
    1. compare L and R to see if they match
    2. if they do match, convert to single-channel mono
  3. move to the next found file

Post

If you know some Python you could use the os.walk() function to find the files (IIRC that function does all the recursion for you), then scipy.io.wavfile.read() to read the files. After comparing L and R and checking if they’re identical you could - where needed - write new mono files with scipy.io.wavfile.write()

The os module also contains some stuff that could be used to delete the old stereo files or move them somewhere for later manual deletion (I get a bit nervous when deleting stuff with scripts, at least before I’ve been using the script enough that I feel certain it works as intended).

(What i’ve described here is pretty much the step by step solution suggested above by kidslow btw, just adding some specific Python modules which could be useful)

Post

kidslow wrote: Sun Oct 01, 2023 2:55 am Seems like you need the following steps:
  1. recursively scan a directory tree of audio files
  2. for each audio file found:
    1. compare L and R to see if they match
    2. if they do match, convert to single-channel mono
  3. move to the next found file
I would imagine it can also be done by extracting L and R channels into separate files in one pass, then deleting files if there's a duplicate MD5 checksum in the second pass.
An idiot on Set Theory:
"In some cases there is an object called red that contains everything that is red. In much the same way a pot is a plate."

Post Reply

Return to “Samplers, Sampling & Sample Libraries”