bpm-tools/bpm-graph

28 lines
429 B
Plaintext
Raw Normal View History

2011-12-11 16:40:50 -02:00
#!/bin/sh
#
# View graph of BPM analysis
#
set -e
if [ -z "$1" ]; then
echo "Usage: $0 <file>" >&2
exit 1
fi
set -u
2011-12-18 10:13:30 -02:00
FILE="$1"
shift
2011-12-11 16:40:50 -02:00
TMP=`mktemp -t bpm.XXXXXX` || exit 1
trap "rm $TMP" 0
2011-12-18 10:13:30 -02:00
sox "$FILE" -r 44100 -e float -c 1 -t raw - | bpm -m 60 -x 180 -g $TMP
gnuplot -p <<END
set style data lines
set ylabel "Difference"
set xlabel "Offset (Beats per minute)"
plot "$TMP" title "`echo "$FILE" | sed -e 's:\":\\\\":g'`"
END