Skip to content

Instantly share code, notes, and snippets.

@sambler
Created June 15, 2018 05:22
Show Gist options
  • Save sambler/67bf0b374d7b9c27e7cec1dd2befbcf2 to your computer and use it in GitHub Desktop.
Save sambler/67bf0b374d7b9c27e7cec1dd2befbcf2 to your computer and use it in GitHub Desktop.
shell script to start jackd and jack_umidi for available devices
#!/bin/sh
# my machine seems to not work with jack -- realtime
# some audio progs allow specifying realtime but don't
# set --no-realtime without it
# so we start jack specifically with --no-realtime
if [ ! `pgrep -u $USER jackd | head -1` ]
then
echo "Starting Jackd..."
jackd --no-realtime -d oss &
sleep 5
fi
getopts "qk" OPT
# stop any existing jack_umidi if requested
case ${OPT} in
q) # quit nicely
pkill -QUIT jack_umidi
;;
k) # force quit
pkill -9 jack_umidi
;;
esac
DEVLIST=`ls /dev | grep ^umidi | grep "\.0" | cut -c 6-9`
for DEV in ${DEVLIST}
do
if [ ! `ps aux | grep jack_umidi | grep "umidi${DEV}" | awk '{print $2}'` ]
then
jack_umidi -C /dev/umidi${DEV} -B
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment