Created
July 10, 2020 02:50
-
-
Save indeedwatson/eb443fdb9396626389fe0ba1ccc2cc49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Replace with your controller model | |
KB_MODEL="BK492" | |
# check if jack and a2jmidid are active | |
if jack_control status && (a2j_control --status | grep "enabled"); then | |
# kill any previous instances of fluidsynth | |
for id in $(pidof fluidsynth); do | |
kill $id | |
done | |
MIDI_KB=$(jack_lsp | grep -P "$KB_MODEL \[\d\d\] \(capture\)") || | |
MIDI_KB=$(jack_lsp | grep -P "Midi Through \[\d\d\] \(capture\)") | |
if [ -z "$MIDI_KB" ] | |
then | |
dunstify "Is your midi keyboard on?" "$KB_MODEL\n" | |
exit | |
fi | |
termite --name piano -e "fluidsynth -a jack -j \ | |
$HOME/soundfonts/KawaiUprightPiano-20180102.sf2" & | |
sleep 2 | |
FLUID=$(jack_lsp | grep -P "FLUID Synth \(\d*\) \[\d*\] \(playback\)") | |
echo $MIDI_KB $FLUID | |
jack_connect "$MIDI_KB" "$FLUID" && | |
dunstify "Keyboard connected succesfully" "$KB_MODEL" | |
else | |
dunstify "jack and a2j not started" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment