From d7a633380519e2f2d385597725308cdac62f4f37 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Thu, 4 Jul 2024 21:58:57 -0400 Subject: ztunekey: optionally retune and transpose. --- ztunekey | 52 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'ztunekey') diff --git a/ztunekey b/ztunekey index da69d56..3a3a7a9 100755 --- a/ztunekey +++ b/ztunekey @@ -5,6 +5,25 @@ # ...installed via: # convert guitar-tuner-icon-28.jpg .local/share/icons/hicolor/256x256/apps/ztunekey.png +if [ "$1" = "--help" ]; then + cat < $tunefile & + find_key -q "$tmpfile" > $keyfile & + wait ) | zenity --progress --no-cancel $ZOPT --icon-name=ztunekey --text="$bn" --pulsate --auto-close + +TUNING="$( cat $tunefile )" +KEY="$( cat $keyfile )" +rm -f $keyfile $tunefile + +zenity --question $ZOPT --icon-name=ztunekey --text="$bn\\nTuning: $TUNING cents\\nKey: $KEY )\\n\\nRetune to standard?" +[ "$?" = 1 ] && exit 1 + +zenity --scale $ZOPT --icon-name=ztunekey --text="Semitones to transpose?\\n0 = original key." --min-value=-12 --max-value=12 --value=0 > /tmp/semi.$$ -( find_tuning -q "$file" > /tmp/tuning.$$ & - find_key -q "$file" > /tmp/key.$$ & - wait ) | zenity --progress $ZOPT --icon-name=ztunekey --text="$bn" --pulsate --auto-close +S="$( cat /tmp/semi.$$ )" +rm -f /tmp/semi.$$ +P="$( perl -MPOSIX=round -e "printf '%+2.2f', round(100 * ($S - $TUNING / 100)) / 100" )" +newfile="$( echo "$bn" | sed 's,\.[^.]*$,'$P'.wav,' )" -zenity --info $ZOPT --icon-name=ztunekey --text="$bn Tuning: $( cat /tmp/tuning.$$ ) cents Key: $( cat /tmp/key.$$ )" +mkdir -p ~/retuned +rubberband --pitch $P $tmpfile ~/retuned/"$newfile" | zenity --progress --no-cancel $ZOPT --icon-name=ztunekey --text "Retuning $bn by $P semitones." --pulsate --auto-close +audtool --playlist-addurl-to-new-playlist ~/retuned/"$newfile" -rm -f /tmp/tuning.$$ /tmp/key.$$ -- cgit v1.2.3