Hi I have a bunch of recordings in my library that are stereo WAV's but are actually mono. Is there a script or program for mac that would find and convert the WAV's to mono ?
-
1Converting is trivial. Finding, not quite. Are they really mono files stored in stereo format, or just stereo files with very little stereo width? – leftaroundabout Feb 6 '16 at 21:57
-
Yes they are 100% the same signal on both channels. – user16701 Feb 7 '16 at 14:36
A procedure that would definitely work: for each file ${f}.wav
,
Split it up to M/S stereo, i.e. to a file
${f}_M.wav
and a file${f}_S.wav
. For instance withffmpeg -i ${f}.wav -filter_complex "[0:0]pan=1c|c0=0.5 * c0 + 0.5 * c1[mid];[0:0]pan=1c|c0 = 0.5 * c0 + -0.5 * c1[side]" -map "[mid]" ${f}_M.wav -map "[side]" ${f}_S.wav
If
f.wav
is actually mono, thenf_S.wav
will contain silence. You can detect this by analysing the volume. This is also possible with ffmpegffmpeg -i ${f}_S.wav -af "volumedetect" -f null /dev/null
but it's a bit awkward to parse the output; there's probably an easier tool for this.
- If it is mono, overwrite
f.wav
with the equivalent mono filef_M.wav
. - Else delete
f_M.wav
.
- If it is mono, overwrite
- Either way, delete
f_S.wav
.