The best way to remember to do something when you’re going to run some important program is to put in the program itself. Or at the very least, put it in a script that you use to invoke the program.
I have a few things I need to remember for the performance I’m preparing for. One has to do with a projector. I’m using a stylus to draw cloud shapes on my screen. And one way I can do this is to mirror my screen to a projector so the audience can see my GUI. However, doing this usually changes the geometry of my laptop screen, so that instead of extending all the way to the edges, there are empty black bars on either side of the used portion of my display. That’s fine, except the stylus doesn’t know and doesn’t adjust. So to reach the far right edge of the drawn portion of the screen, I need to touch the far right edge of the drawn portion, which puts over a centimetre between the stylus tip and the arrow pointer. Suboptimal!
Ideally, I’d like to have any change in screen geometry trigger a script that changes the settings for for the stylus (and I have ideas about how that may or may not work, using upstart, xrandr and xsetwacom), but in the absence of that, I just want to launch a manual calibration program. If I launch the settings panel, there’s a button on that that launches one. So the top part of my script checks if the calibration is different than normal and launches settings if it is.
The next things I need to remember are audio related. I need to kill pulseaudio. If my soundcard (a Fast Track Ultra) is attached, I need to change the amplitude settings internally so it doesn’t send the input straight to the output. Then I need to start jack using it. Or if it’s not attached, I need to start jack using a default device. Then, because it’s useful, I should start up Jack Control, so I can do some routing, should I need it. (Note: in 12.04 if you start qjackctl after starting jackd, it doesn’t work properly. This is fixed by 13.04.) Finally, I should see if SuperCollider is already running and if not, I should start it.
That’s a bit too much to remember for a performance, so I wrote a script. The one thing I need to remember with this script is that if I want to kill jack, it won’t die from Jack Control, so I’ll need to do a kill -9 from the prompt. hopefully, this will not be an issue on stage.
This is my script:
#!/bin/bash # first check the screen LINE=`xrandr -q | grep Screen` WIDTH=`echo ${LINE} | awk '{ print $8 }'` HEIGHT=`echo ${LINE} | awk '{ print $10 }' | awk -F"," '{ print $1 }'` if [[ ${WIDTH} != 1366 || ${HEIGHT} != 768 ]] then gnome-control-center wacom else echo normal resolution fi # now setup the audio pulseaudio --kill # is the ultra attached? if aplay -l | grep -qi ultra then echo ultra #adjust amplitude i=0 j=0 for i in $(seq 8); do for j in $(seq 8); do if [ "$i" != "$j" ]; then amixer -c Ultra set "DIn$i - Out$j" 0% > /dev/null else amixer -c Ultra set "DIn$i - Out$j" 100% > /dev/null fi amixer -c Ultra set "AIn$i - Out$j" 0% > /dev/null done done #for i in $(seq 4); do # amixer -c Ultra set "Effects return $i" 0% > /dev/null #done #start jack jackd -d alsa -d hw:Ultra & else #start jack with default hardware jackd -d alsa -d hw:0 & fi sleep 2 # jack control qjackctl & sleep 1 # is supercollider running? if ps aux | grep -vi grep | grep -q scide then echo already running else scide test.scd & fi