dbry/adpcm-xq

FR: Omit wav files already encoded in ADPCM

Closed this issue · 5 comments

From usage:

Operation: conversion is performed based on the type of the infile
          (either encode 16-bit PCM to 4-bit IMA-ADPCM or decode back)

If a folder has a mix of PCM and ADPCM files, it would be useful if adpcm-xq could be set to leave existing ADPCM files as they are.

Currently it's needed to detect whether a wav is encoded in ADPCM or not for scripting purposes of batch encoding whole directories.
(The reverse could also be true if you want PCM only for target as well.)

dbry commented

Makes sense. How about if I add two options: -e for encode only, fail on WAV already ADPCM and -d for decode only, fail on WAV already PCM?

I could also look at the executable filename and if it ends in -encoder I will only encode and if it ends in -decoder I only decode.

I think the two options would be better as you could combine -e -d parameters to get the default behaviour we already have. (both encode ADPCM to PCM and decode ADPCM to PCM)

Usage could point out default mode of operation is -ed with that approach, though you're unlikely to actually pass both -e -d or -d -e manually, so it might be easier to just have the encode and decode options be exclusive.

Doing it via filenames sounds less flexible and isn't intuitive because other options are there as parameters already.

dbry commented

I decided to use both options. The default behavior is still the same (convert either way) but the -d and -e options can force only one behavior. Renaming the executable can do the same thing. For some reason the commit did not post in this thread, but it's in the branch issue-5

Thanks, I've tried the branch and already encoded ADPCM's are ignored indeed!

However this leaves a slight usability issue left, the input WAVs that are not converted by adpcm-xq if e or -d (or filename) is used are left alone in the input directory.

I think if adpcm-xq -e or -d would pass the files as they are to the output, it would be much more practical.

That way, doing a batch encode of *.wav would result in a target folder full of WAVs of desired type, without needing to go back to source dir and manually copy what adpcm-xq warned is already encoded/decoded.

EDIT: adpcm-xq sets a non-zero exit code when it errors in this case, thus moving a file to target dir trivial.

Made very simple batch scripts for Windows users
https://gist.github.com/Teteros/14f41a41e121c43fb5603c02230c4c30

dbry commented

Thanks! I've merged this into master and will create release binaries when I get a chance... :)