File size: 401 Bytes
825ae3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash

TOTAL_TIME=0
for TRACK in *.mp3; do
    echo Reading "${TRACK}"
    TRACK_TIME="$(soxi -D "${TRACK}" 2>/dev/null)"
    [[ "$TRACK_TIME" != "" ]] && TOTAL_TIME="$TOTAL_TIME + $TRACK_TIME"
    TOTAL_TIME=$(echo "$TOTAL_TIME" | bc)
done
echo ''
echo -n "Total Duration (in seconds): "
echo "${TOTAL_TIME}"

# echo -n "Average Clip Duration (in seconds): "
# echo "${TOTAL_TIME}/${LEN}" | bc