Automating Reaper with iCal and AppleScript

Most of you know that at Coast Hills, we record our services each week using Reaper. For a while, I was multi-tracking each service, but then I realized that was generating a ton of data that I didn't know what to do with. We don't go back to the tracks that often (except for training, tweaking set ups, and room adjustments), so I figured we could cut back on the data load. So I decided to change up our recording plan.

On Saturday night, we record a two track board mix. This mix is built from groups, sent to a matrix then directed out MADI 55 & 56 to the MADIFace and into Reaper. At the 9 on Sunday, we record the board mix plus the pastor's message right from his mic. At the 11, we multitrack the whole band plus the board mix and pastor's message. This gives us a full set of tracks for the weekend, and we have board mixes of each service. We build the podcast from the pastor's track.

So that's all well and good, but you know how hectic it can get in the booth the final minutes before the service and more than once we have been forgetting to start Reaper. We usually get it somewhere in the first song, but that defeats the purpose. I got to thinking back to a post Daniel Murphy wrote a long time ago about automating the start of his QuickTime capture using an iCal event that has an alarm that fires an AppleScript. 

It occurred to me that I could write a script to start Reaper, and fire it each service 1 minute before service start in iCal. 

Starting the recording was easy; but I also wanted to make sure we had the right tracks armed for recording. That's where Reaper's Action list comes. Reaper has a robust set of actions that you can set up to control every aspect of the program. And you can assign keyboard shortcuts to any of them, shortcuts that can be fired from an AppleScript. 

The first step was to set up the keyboard shortcuts. To make sure we had just the tracks armed that we wanted, my first action was to clear any armed tracks. I assigned that command to "option-command-c". Next, I assigned "option-command-a" to arm track one, our board mix track. I assigned "option-command-b" to arm track two, our pastor's track. I actually have both our teaching pastor's channels set up in our project template in Reaper; they occupy tracks one and two. When we load the project each week, we just delete the track we're not using (based on who's speaking). Finally, I assigned "shift-option-a" to arm all tracks. Those key shortcuts are somewhat arbitrary; I picked what made sense to me, based on what was open. 

The next step is to write three AppleScripts. They all follow the same basic format.

tell application "REAPER"


delay 1

tell application "System Events" to keystroke "c" using {command down, option down}

delay 1

tell application "System Events" to keystroke "a" using {command down, option down}

delay 1

tell application "System Events" to keystroke "r" using {command down}

end tell

The first two lines bring Reaper to the foreground. The third line is a command-option a (which I previously assigned to arm track one). I added the delay of 1 second to make sure the script didn't run too fast for Reaper to keep up. The next line is a command-r to start recording. "End tell" finishes the script.

UPDATE: I've since added an additional line to delay the script by 1 second after the original Activate command to give the computer time to catch up to the script. END UPDATE.

I saved this script as "Saturday Reaper.scpt" and set up a recurring calendar event to fire an alarm every Saturday evening at 4:59 PM. The alarm calls the script (as opposed sending a message or playing a sound). 

To create the other scripts, I simply added additional track arming lines using the same syntax. Each script is named for when it runs, and I set up recurring alarms to fire them at 8:59 and 10:59 respectively. 

We ran this the first time this weekend and it worked like a champ. One thing to note is that when you first set up the alarm, iCal defaults to running the script 15 minutes before your event time. You can go in and edit the time to fire the alarm, but be sure to do that before you set up the recurring part. 

The net result of about 20 minutes worth of work is that we have one less thing to think about right as the service starts. This same concept could most likely be carried over to any other DAW you may be recording to, though how much you can control through customizable keyboard shortcuts may vary. Still, it's worth a shot!

Today's post is brought to you buy Heil Sound. Established in 1966, Heil Sound Ltd. has developed many professional audio innovations over the years, and is currently a world leader in the design and manufacture of large diaphragm dynamic, professional grade microphones for live sound, broadcast, & recording.