diff --git a/other/get_wavfile_props.sh b/other/get_wavfile_props.sh index 85b75aa9e9709fbc1194c51ca1c2c0b3c720ffb3..6e92d5b1dc9d3c4e631179ab841a4560288fcf61 100755 --- a/other/get_wavfile_props.sh +++ b/other/get_wavfile_props.sh @@ -38,20 +38,45 @@ then exit 1 fi -InfoAudio=InfoAudio file=$1 +system=`uname -s` + +InfoAudio=InfoAudio +if [ "$system" = "Darwin" ]; then + md5=md5 +else + md5=md5sum +fi + +# check, whether we have set md5 correctly +if ! command -v $md5 &> /dev/null +then + echo "Executable for calculating md5 could not be dected. Aborting." + exit +fi + filename=`basename $file` -md5sum=`md5sum -b $1 | cut -d" " -f1` +if [ "$md5" = "md5sum" ]; then + md5sum=`$md5 -b $file | cut -d" " -f1` +elif [ "$md5" = "md5" ]; then + md5sum=`$md5 -r $file | cut -d" " -f1` +else + echo "No valid executable for calculating md5. Aborting." + exit +fi +# getting all info from InfoAudio - storing in res res=`$InfoAudio $file` +# paring res sampleFreq=`echo "$res" | grep -m1 "Sampling frequency" | sed -e 's/\([a-zA-Z\. ]*: \)\([0-9]*\)\(.*\)/\2/g'` numberSamples=`echo "$res" | grep -m1 "No. frames" | sed -e 's/\([a-zA-Z\. ]*: \)\([0-9]*\)\(.*\)/\2/g'` aligned20ms=false -if [ $(expr $numberSamples % 960) == "0" ]; then +remainder=$(expr $numberSamples % 960) +if [ $remainder -eq 0 ]; then aligned20ms=true fi @@ -61,5 +86,6 @@ dataType=`echo "$res" | grep -m1 "Data type" | sed -e 's/\([a-zA-Z\. ]*: \)\([[a dataByteOrder=`echo "$res" | grep -m1 "Data byte order" | sed -e 's/\([a-zA-Z\. ]*: \)\([[a-zA-Z0-9-]*\)\(.*\)/\2/g'` +# printing out echo "${filename};${md5sum};${sampleFreq};${numberSamples};${aligned20ms};${numberChannels};${dataType};${dataByteOrder}"