46 lines
1.1 KiB
Bash
Executable File
46 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Copyright (C) 2012 Mark Hills <mark@xwax.org>
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# version 2, as published by the Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# General Public License version 2 for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# version 2 along with this program; if not, write to the Free
|
|
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
# MA 02110-1301, USA.
|
|
#
|
|
|
|
#
|
|
# View graph of BPM analysis
|
|
#
|
|
|
|
set -e
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "Usage: $0 <file>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
set -u
|
|
|
|
FILE="$1"
|
|
shift
|
|
|
|
TMP=`mktemp -t bpm.XXXXXX` || exit 1
|
|
trap "rm $TMP" 0
|
|
|
|
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
|