Indiscipline

Mild achievements and severe disappointments

posted by Kirill on 2016-11-09

zrtstr is a small command line application for detecting faux-stereo WAV-files, that is, files with two identical channels that should have been saved as mono. Such files are sometimes generated by some audio-editing software and DAWs (I’m looking at you, old Cubase 5). Gotten tired of receiving such files from clients for mixing, as they are using twice the necessary space and require twice the processing power, I decided to deal with this nuisance once and for all. zrtstr is a cross-platform application which runs very fast, thanks to being written in Rust.

“Before” and “after” waveforms: zrtstr before and after

Ideally, I wouldn’t like to see such a limited functionality in a separate application, but I found no easy and coherent way to do using usual SoX or ffmpeg. Which is a shame. But when life deals you such a minor problem that happens so frequently, you have nothing to do but automate the tedious actions.

Usage

zrtstr is a command-line application, but I tried to make it as easy to use as possible. To start using it, provide zrtstr with input file as an argument, or just run it from a directory full of target WAV files. The program will scan every file in its entirety and save mono-copies of detected faux-stereo files with .MONO suffix. Full help available with --help switch, provided by the wonderful Clap library.

Download

Latest Windows binaries are luckily provided in Github releases page. Linux/Mac users are encouraged to build it by hand.

How does it work?

Zrtstr reads interleaved channel samples from a target stereo file one by one and compares left and right samples. If the difference is present (or higher than the threshold given in --dither mode) than file considered true-stereo and program tries to write a mono copy.

Here’s live output on a set of test files:

$ zrtstr.exe
No input file given. Processing current directory.
--- Analyzing: c:\test\32fp-faux-stereo-dithered.wav
101769 / 101769  100.00 % 17311901.54/s
Channels are identical! Faux stereo detected
  * Converting to true-mono...
  ! Writing IEEE_FLOAT files not implemented yet!
--- Analyzing: c:\test\32fp-faux-stereo.wav
101769 / 101769  100.00 % 17436110.94/s
Channels are identical! Faux stereo detected
  * Converting to true-mono...
  ! Writing IEEE_FLOAT files not implemented yet!
--- Analyzing: c:\test\dither24.MONO.wav
File is not stereo! Exiting
--- Analyzing: c:\test\dither24.wav
101769 / 101769  100.00 % 19279415.99/s
Channels are identical! Faux stereo detected
  * Converting to true-mono...
Target file already exists. Replacing...
"c:\test\dither24.MONO.wav" successfully written!
--- Analyzing: c:\test\dither32fp.wav
101769 / 101769  100.00 % 16593892.73/s
Channels are identical! Faux stereo detected
  * Converting to true-mono...
  ! Writing IEEE_FLOAT files not implemented yet!
--- Analyzing: c:\test\mono.wav
File is not stereo! Exiting

As you can see, at the moment program doesn’t know how to write 32 bit floating-point files, as the Hound library doesn’t support it yet.

Contributing

zrtstr is a free software and distributed under GNU General Public License version 2 or later. So anyone is free to hack away and submit any reasonable patches in the repository. Feel free to file a bug report or feature request via Issues.