blob: a03c3fa2125851f86a958336a7c4076371ff21a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
|