Added bin/wav2alaw

Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
This commit is contained in:
Jacob Kiers 2014-05-07 07:53:02 +02:00
parent 3d9e4513a3
commit bfa37857c6
1 changed files with 26 additions and 0 deletions

26
bin/wav2alaw Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
# Converts all wav-files in a directory to alaw.
if [[ -z "$1" ]]; then
DIR='.'
else
if [ ! -d "$1" ]; then
echo "Directory does not exist!"
exit
else
DIR=$1
fi
fi
cd $DIR
for f in `ls -1 *.wav | sed 's/\.[^.]*$//' | sort -n`; do
echo "Converting $f.wav to $f.alaw..."
`sox $f.wav --channels 1 --encoding a-law --rate 8000 --type raw $f.alaw.wav`
if [ $? -eq 0 ]; then
`mv $f.alaw.wav $f.alaw`
`rm $f.wav`
fi
done
echo "Done."