A simple, DIY “Recording” lamp that automatically syncs with your DAW

Guy Dupont
8 min readAug 31, 2019

This post was written for my friends at Game Audio Boston. If you’re in the Boston area, come join us!

If you share your studio space with coworkers, roommates, animals, or literally anyone else, you are probably familiar with the pain of having a recording session be unexpectedly interrupted. Assuming you’ve already agreed upon the times at which you can expect silence in your space, you may find it helpful to develop a system for letting others know when recording is in progress. This tutorial will show you how to hack together an affordable and simple take on the classic red “Recording” (or “On Air”) lamp that wirelessly syncs with the recording status of your DAW. In other words: Hit record -> lamp goes on. Hit stop -> light goes off. This is written particularly for Reaper, but with some extra effort, it may be possible to get things working with other DAWs. More on that later.

UPDATE (2021): I have a video for getting this set up with Pro Tools here.

Disclaimer: This is meant to be a fun hack, not a robust solution. I recommend reading this all the way through before deciding if this is a good fit for you. I am open to any and all suggestions!

Here’s what you’ll need:

An IFTTT Account

  • IFTTT is a free platform that allows you to link triggers and actions across various digital services. For example, you can connect your Instagram and Twitter accounts, and have IFTTT automatically tweet a copy of every picture you post on Instagram. In our case, the trigger is going to be “my recording status has changed” and the action is going to be “turn the lamp on or off”

An IFTTT enabled light bulb

  • …or power outlet, if you want to use a good old fashioned “dumb” light bulb.
  • Fortunately, most brands are IFTTT compatible these days. I really like the Philips Hue series, but you can buy generic “smart sockets” on Amazon for less than $10 if you’re feeling thrifty. Just make sure they mention IFTTT somewhere in the product description to be safe.

Reaper

  • This task is particularly easy to accomplish using Reaper, which was designed with extensibility in mind. It’s affordable, well maintained, and generally excellent if you aren’t already familiar.

Part 1: Set up your Smart Bulb/Socket

For the sake of simpler debugging, I suggest working backwards — get the light working first. The setup is going to completely depend on which brand you buy, so just use the instructions provided by the manufacturer. Once you get to the point where you can turn the product on and off using the provided software, you should be good to move on.

Part 2: Hook your light up to IFTTT

Now you’ll need to allow your light to be controlled via generic “webhook” triggers provided by IFTTT. You can execute these triggers from any internet connected device. You’ll want to verify that they work before plugging them into Reaper.

(1) Login to IFTTT

(2) Create a new IFTTT recipe

(3) Click “This” to select your trigger service

(4) Search for and select “Webhooks”

(5) Select “Receive a web request” as your trigger. It is the only option as of this writing.

(6) Create an “Event name” for this trigger. Keep in mind that you’ll need to create separate triggers for turning the light on and off. I’m choosing “record_lamp_on” here.

(7) Click “That” to select your action service

(8) Search for and select the service that works with your smart bulb/socket. I’m using Smart Life.

(9) At this point, you’ll need to find and select your service’s action for turning a light on. It will likely ask you which bulb/socket you want to control. It’s generally pretty intuitive.

(10) Once finished, you should see a summary screen. Find and click the “Settings” button.

(11) With your light on, use the “Check Now” button to verify that your light reacts appropriately.

(12) Repeat steps 2–11 and create a recipe for turning the light off. Use a different event name for step 6 (“record_lamp_off”, perhaps), and make sure you choose the action for turning a light off when re-executing step 9.

Part 3: Configure Reaper to talk to your lights

Now you need to add a script to Reaper that will monitor your recording state and trigger your new IFTTT actions when it changes. This is easily accomplished using Reaper’s built-in “ReaScript” support:

(1) Open Reaper

(2) Click on Actions -> Show Action List

(3) Next to ReaScript, click “New”

(4) Name your new script as you please. For File Type, select “EEL files”

(5) In the text editor, paste the following code:

(6) In the first line of code, change the string “record_lamp_on” to match the Event Name you chose for your “lamp on” IFTTT webhook in Part 2.

(7) In the second line of code, change the string “record_lamp_off” to match the Event Name you chose for your “lamp off” IFTTT webhook in Part 2.

(8) You need to fetch your secret key from IFTTT

  • Log back into IFTTT, and click on the “My Services” button on the top left
  • Search for and select “Webhooks”
  • Click on the “Documentation” button at the top right
  • This documentation screen should have a string of random characters at the top, preceded by “Your key is:”. Copy that string of random characters (but keep it safe!)

(9) Switch back to Reaper. In the first two lines of your ReaScript, replace the string “your_key_here” with the key that you retrieved in step 8.

(10) To the right of your ReaScript editor, select the option “Run defer() code”. This will let your script actively monitor the state over time.

(11) Save your script, and click “Start”

(12) Now, when you start recording in reaper, the script should activate your IFTTT recipe and turn on your light! When you stop recording, the light should go off. Note that — depending on your internet connection — it may take a few seconds for the events to trigger. If you restart Reaper, you will now see your your script listed as an Action that you can run. It seems like it is possible to have it run automatically using a Reaper extension called SWS, but that’s out of scope for this tutorial.

Photo by John Hult on Unsplash

Part 4 (BONUS): Potential Extensions/Modifications

Speed it up.

  • As I mentioned above, you may find that it takes a few seconds for your lights to turn on and off. This is because your request has to go all the way from your computer to IFTTT’s servers, only to come right back to your light bulb. If you feel like getting your hands dirty, you can build a system that lets you keep all of the traffic on your local network. The most cost effective way is to program a Raspberry Pi or WiFi enabled microcontroller (Check out the ESP8266) to toggle an electromechanical relay. These devices can be addressed directly via your router, which means your request’s journey is much, much shorter.

Connect other hardware/services.

  • One advantage of using IFTTT here is that you can reroute your triggers without changing anything in your ReaScript. You can use your DAW’s state to toggle a smart lock on your door. You can automatically switch your air conditioning on and off. I’ve actually been using this with a box fan in my studio’s window during the summer.

Using other DAWs

  • This is much harder than it should be, in my opinion — especially if you’re a Pro Tools user. You can do it, however, by writing a program to act as a virtual MIDI device that listens for certain transport-related MIDI events (record, play, pause, etc.), and syncs with the IFTTT servers accordingly. I’ve done similar projects using Node.js and the wonderful midi library. You could also accomplish this using Max if you’re more comfortable with a visual programming environment. I may follow this post with an example if I get more time soon — let me know if you’re interested.

Feel free to respond with anything else you come up with!

Part 5 (BONUS BONUS): Understanding the code

Here’s an explanation of what’s happening in the code, if you’re interested:

turnLightOn = "/bin/sh -c \"curl -H 'Connection: close' -i -X POST 'https://maker.ifttt.com/trigger/record_lamp_on/with/key/your_key_here'\"";turnLightOff = "/bin/sh -c \"curl -H 'Connection: close' -i -X POST 'https://maker.ifttt.com/trigger/record_lamp_off/with/key/your_key_here'\"";

These two variables ( turnLightsOn and turnLightsOff ) hold string values that are later passed to your machine to be executed as commands. The key part of each of these command strings is curl , which is a program that comes pre-installed on your machine that deals with web calls. So each of these commands basically tells curl to reach out to the IFTTT addresses you’ve provided.

lastState = 0;

Here we set up a variable to hold on to the play/record state. 0 means nothing is happening, which is the case when the program first boots up.

function main()

Here we begin to define the function in which our logic runs. This will be executed by Reaper over and over again so that we can keep a close watch on the play/record state.

currentState = GetPlayState() & 4;

This is where we check the play/record state of Reaper. GetPlayState & 4; is just a tricky way of saying “are we currently recording?”. If that’s true, then currentState will be assigned some number greater than 0. We don’t really care specifically what it is.

lastState != currentState ?

This line is super important. Since this code is run repeatedly, we want to avoid making the same request to the IFTTT servers over and over again. So this line says to only run the following code if the play/record state is different than the last time we checked.

command = currentState > 0 ? turnLightOn : turnLightOff;

Now we assign our command variable to either of the command strings we defined at the top of our script. If currentState > 0 — aka “if we are recording” — set command to be turnLightOn . Otherwise set it to turnLightOff .

ExecProcess(#result, command, 0);

This line tells our machine to execute the curl command that was determined on the previous line. We don’t actually care about #result .

lastState = currentState;

Each time we execute our command we want to save our state to the lastState variable so that we don’t accidentally execute again too soon.

defer("main();");

Here we tell our program to run our main logic loop again immediately after it finishes.

main();

Our last line of code triggers the main logic loop for the first time when the script is first run.

--

--