Music: April 2014 Archives
I have an office/recording studio at home. There's a RECORDING light on the wall outside the door to tell people to leave me alone because I'm busy. There's a switch on the wall inside the room, to turn this light on and off.
It works great, but I want be able to easily toggle the light without getting up. So I replaced the switch with an X10 switch, which I can toggle with my server using heyu. I could install heyu in lots of places, but it's simple enough to just run a command with ssh.
That works great, but I want to be able to toggle it quickly, and running a command in the terminal is a bit slow. So I wrapped the command in an AppleScript.
That works great, but it still requires me to stop what I am doing and use the mouse to select the AppleScript from a menu. So I made it into a Service that I can run with a keyboard command (a Cocoa AppleScript applet that registers itself as a Service and saves the toggle state in its plist file).
That works great, but if I am playing guitar, even a keyboard command can be a bit cumbersome. So I have this MOTU 828mkII FireWire audio device with a configurable pedal feature, and a BOSS FS-5U pedal connected to it, and I configure it to execute the keyboard command the Service uses.
That works great, but even though the light switch has an audible "click" when it toggles, I can't necessarily see from where I am sitting whether it toggled on, or off. So I have the AppleScript also send a Growl notification to tell me whether the light just switched on, or off.
So now I just tap the pedal, and the light turns on or off, and I get a notification to tell me which it did, so I don't have to turn my head or use my hands.
That's a lot of work just to turn a light on and off, with the switch four feet away from me. But you probably wish you did it. I just wish I could've done it in a sane language like Perl, but the startup costs were just a little high compared to running a compiled AppleScript, and considering all the other costs (pedal -> device -> key command -> launch app -> ssh to server, which then sends a signal over USB to a serial device that sends a radio signal to a receiver that sends a signal over the power lines to my switch), I decided to just keep it simple.