Skip to content

Instantly share code, notes, and snippets.

@fzero
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fzero/bf393828943455304949 to your computer and use it in GitHub Desktop.
Save fzero/bf393828943455304949 to your computer and use it in GitHub Desktop.
wav1644.sh - Converts .wav files to 16bits/44khz (CD quality)
#!/bin/bash
# wav1644.sh - Converts .wav files to 16bits/44khz (CD quality)
# Many iPad audio apps need this, and it's a good size/quality ratio for
# uncompressed audio anyway. Fuck Neil Young and other clueless audiophiles.
# Download this to somewhere in your $PATH and make it exectutable with
# chmod a+x wav1644.sh
# WAV conversion function - uses ffmpeg
function convertwav {
mv "$1" "$1.original"
ffmpeg -i "$1.original" -acodec pcm_s16le -ar 44100 "$1"
}
# Usage
if [ "$1" == "" ]; then
echo "Usage: $(basename $0) <high sampling rate wav or folder>"
exit 1
fi
# Do it!
if [ -f "$1" ]; then
convertwav "$1"
elif [ -d "$1" ]; then
cd "$1"
for wavfile in *.wav; do
convertwav "$wavfile"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment