total time of audio
Really simple way that works in macos
soxi -D * | awk 'BEGIN { s = 0 }; { s = s + $1 }; END { print s " seconds"}'
More complex ways
Calculate the total time of all audio files at a location.
EPOCH='jan 1 1970'; sum=0; for i in `soxi * | grep Duration | awk -F" " '{print $3}' | grep :`; do sum="$(date -u -d "$EPOCH $i" +%s) + $sum"; done; echo "total = `echo $sum | bc` seconds"
Alternative that works with large number of files:
EPOCH='jan 1 1970'; sum=0; for i in `find . -iname "*.wav" -exec soxi {} \; | grep Duration | awk -F" " '{print $3}' | grep :`; do sum="$(date -u -d "$EPOCH $i" +%s) + $sum"; done; echo "total = `echo $sum | bc` seconds"