My first thought is just something like:
# assume -D flag is available to disable automatic dithering
sox original.wav -Dr 8000 new.wav
# if -D flag isn't available (sox < 14.3), then dithering isn't automatic
if [$? -ne 0]; then
sox original.wav -r 8000 new.wav
fi
As checking the version numbers seemed like it would probably be a pain and not very future-proof.
The only main disadvantage is that if there is some other error, the operation is attempted twice.
David Dean
2009-11-20 03:13:11