2017-09-13 19:30:52 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Written by Storm Dragon https://social.stormdragon.tk/storm
|
|
|
|
# Released under the terms of the WTFPL License http://wtfpl.net
|
|
|
|
|
|
|
|
declare -A tuning=(
|
|
|
|
# Dropped 1 step.
|
|
|
|
[6d]="D2 G2 C3 F3 A3 D4"
|
|
|
|
# Standard tuning
|
|
|
|
[6e]="E2 A2 D3 G3 B3 E4"
|
2017-09-13 20:02:05 -04:00
|
|
|
# 12 string dropped 1 step.
|
2017-09-13 21:02:23 -04:00
|
|
|
[12d]="D3 D2 G3 G2 C4 C3 F4 F3 A3 D4"
|
2017-09-13 20:02:05 -04:00
|
|
|
# 12 string standard tuning
|
2017-09-13 21:02:23 -04:00
|
|
|
[12e]="E3 E2 A3 A2 D4 D3 G4 G3 B3 E4"
|
2017-09-13 20:02:05 -04:00
|
|
|
# Mandolin
|
|
|
|
[mandolin]="G3 D4 A4 E5"
|
2017-09-13 19:30:52 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
show_help() {
|
|
|
|
echo "Usage: $0 tune_id"
|
|
|
|
echo "Where tune_id is one of"
|
|
|
|
echo "${!tuning[@]}"
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
[ $# -ne 1 ] && show_help
|
|
|
|
[ -z "${tuning[$1]}" ] && show_help
|
2017-09-13 19:40:22 -04:00
|
|
|
[ "$1" == "-h" ] && show_help
|
|
|
|
[ "$1" == "--help" ] && show_help
|
|
|
|
|
2017-09-13 19:30:52 -04:00
|
|
|
# Continuously play the notes until a key is press.
|
|
|
|
# Note key can not be enter or space.
|
|
|
|
# This will adjust how long each note plays.
|
|
|
|
timeout=2
|
|
|
|
for i in ${tuning[$1]} ; do
|
|
|
|
unset continue
|
2017-09-13 20:02:05 -04:00
|
|
|
ifs="$IFS"
|
|
|
|
IFS=""
|
2017-09-13 19:30:52 -04:00
|
|
|
while [[ -z "$continue" ]]; do
|
|
|
|
ps $notePID &> /dev/null && kill $notePID &> /dev/null
|
|
|
|
play -qnV0 synth $timeout pl $i &
|
|
|
|
notePID="$!"
|
2017-09-13 20:02:05 -04:00
|
|
|
read -sN1 -t $timeout continue
|
2017-09-13 19:30:52 -04:00
|
|
|
done
|
2017-09-13 20:02:05 -04:00
|
|
|
IFS="$ifs"
|
2017-09-13 19:30:52 -04:00
|
|
|
done
|
2017-09-13 21:02:23 -04:00
|
|
|
# Kill the final process when the program exits.
|
|
|
|
ps $notePID &> /dev/null && kill $notePID &> /dev/null
|
|
|
|
exit 0
|