From c0ea006ee41c464ddc439c4690e6b9e4020154d1 Mon Sep 17 00:00:00 2001 From: Skladnayazebra Date: Mon, 5 Oct 2026 19:33:02 +0200 Subject: make guitar-notes.sh interactive --- guitar-notes.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/guitar-notes.sh b/guitar-notes.sh index a03c3fa..acc6015 100644 --- a/guitar-notes.sh +++ b/guitar-notes.sh @@ -1,10 +1,9 @@ #!/usr/bin/env bash -# Every few seconds, I show you a string and a fret/note and you play matching note/fret +# I show you a string and a fret/note and you play matching note/fret, then hit any key to continue -export STRINGS='5-5' +export STRINGS='1-6' export FRETS='0-12' -INTERVAL_SECONDS=5 if [ $# == 0 ]; then echo "No options given, use -n for notes or -f for frets" 1>&2 @@ -25,9 +24,13 @@ rand_note () { clear while true; do + test "$PRESSED" && echo "took $SECONDS second(s)" + SECONDS=0 printf "String %s; " "$(shuf -i "$STRINGS" -n 1)" test "$GUESS_NOTES" && printf "Fret %s " "$(shuf -i "$FRETS" -n 1)" test "$GUESS_FRETS" && printf "%s " "$(rand_note)" - sleep "$INTERVAL_SECONDS" + # press any key to continue + read -n 1 -s -r + PRESSED=true clear done -- cgit v1.3.1