summaryrefslogtreecommitdiff
path: root/guitar-notes.sh
diff options
context:
space:
mode:
authorSkladnayazebra <skladnayazebra@gmail.com>2026-09-27 10:25:36 +0200
committerSkladnayazebra <skladnayazebra@gmail.com>2026-09-27 10:25:36 +0200
commit34014b43e2778c44c4775ee0f1732c9d6c6302e6 (patch)
tree29cf71d34a1d6c50c0c1954d2f226fffaadf7021 /guitar-notes.sh
parentf946e283436d1009010937aa10155837bf34756f (diff)
add guitar-notes.sh
Diffstat (limited to 'guitar-notes.sh')
-rw-r--r--guitar-notes.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/guitar-notes.sh b/guitar-notes.sh
new file mode 100644
index 0000000..a03c3fa
--- /dev/null
+++ b/guitar-notes.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+# Every few seconds, I show you a string and a fret/note and you play matching note/fret
+
+export STRINGS='5-5'
+export FRETS='0-12'
+INTERVAL_SECONDS=5
+
+if [ $# == 0 ]; then
+ echo "No options given, use -n for notes or -f for frets" 1>&2
+ exit 1
+fi
+
+while getopts 'nf' opt; do
+ case $opt in
+ n) GUESS_NOTES=true;;
+ f) GUESS_FRETS=true;;
+ *) echo "Invalid option, use -n for notes or -f for frets" 1>&2; exit 1
+ esac
+done
+
+rand_note () {
+ shuf -e Do Do-di Re-be Re Re-di Mi-be Mi Fa Fa-di Sol-be Sol Sol-di La-be La La-di Ti-be Ti -n 1
+}
+
+clear
+while true; do
+ 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"
+ clear
+done