Skip to content

Instantly share code, notes, and snippets.

@agoramachina
Last active July 30, 2019 08:35
Show Gist options
  • Save agoramachina/b52feb5dd3e4ddc38878be4dcce5d723 to your computer and use it in GitHub Desktop.
Save agoramachina/b52feb5dd3e4ddc38878be4dcce5d723 to your computer and use it in GitHub Desktop.
#!/bin/bash
aseqdump -p "USB MIDI Interface" | \
while IFS=" ," read src ev1 ev2 ch label1 data1 label2 data2 rest; do
case "$ev1 $ev2 $data1 $data2" in
"Control change 67 127" ) xdotool keydown ctrl+ ;;
"Control change 67 0" ) xdotool keyup ctrl ;;
"Control change 66 127" ) xdotool keydown super+ ;;
"Control change 66 0" ) xdotool keyup super ;;
"Control change 64 127" ) xdotool keydown alt+ ;;
"Control change 64 0" ) xdotool keyup alt ;;
esac
case "$ev1 $ev2 $data1" in
"Note on 49" ) xdotool key F1 ;;
"Note on 51" ) xdotool key F2 ;;
"Note on 51" ) xdotool key F3 ;;
"Note on 56" ) xdotool key F4 ;;
"Note on 58" ) xdotool key F5 ;;
"Note on 61" ) xdotool key F6 ;;
"Note on 63" ) xdotool key F7 ;;
"Note on 66" ) xdotool key F8 ;;
"Note on 68" ) xdotool key F9 ;;
"Note on 70" ) xdotool key F10 ;;
"Note on 73" ) xdotool key F11 ;;
"Note on 75" ) xdotool key F12 ;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment