Using MIDI to Control Indigo

Posted on
Thu Sep 02, 2010 12:14 pm
nsheldon offline
Posts: 2469
Joined: Aug 09, 2010
Location: CA

Using MIDI to Control Indigo

Last night I was playing one of my keyboards and it struck me that the lighting in my music room was decidedly too bright for the mood of music I was playing. I considered the eminent convenience possibilities of being able to control the brightness of the track lighting in my music room by simply using the expression pedal attached to any one of my synths. Or perhaps the brightness should be relative to how forcefully I hit the keys. So I stopped playing my keyboard and decided to realize this possibility. Within 30 minutes, I was successful using a freeware application, AppleScript, and Remote Apple Events.

First I enabled Remote Apple Events on the Mac mini in the family room on which IndigoServer was running (System Prefs > Sharing > check Remote Apple Events and enable access only for Administrators). Second, I downloaded and installed the freeware application "MidiPipe" (http://homepage.mac.com/nicowald/SubtleSoft/) onto my Mac Pro-based DAW (Digital Audio Workstation, if you're unfamiliar with digital musician lingo). Third, I set up a "pipe" within MidiPipe. The first module of the pipe took input from the USB-MIDI-attached keyboard to which the expression pedal was connected. The second module of the pipe processed each MIDI message using AppleScript and sent a Remote Apple Event to the IndigoServer application running on the Mac mini in the family room. Below is the AppleScript I used within the MidiPipe AppleScript module to control the brightness of the music room lights.
Code: Select all
on runme(message)
   tell application "IndigoServer" of machine "eppc://<admin username>:<admin password>@media-mac.local"
      set newBrightness to round (item 3 of message / 127 * 100) rounding toward zero
      if (item 1 of message = 176) and (item 2 of message = 7) then
         if (newBrightness mod 5) = 0 then
            brighten device "Music Room Light" to newBrightness
         end if
      end if
   end tell
end runme

This code takes all incoming MIDI Continuous Controller messages (value 176 in the first item of the MIDI message), ensures that the CC message is a volume control message (value 7 in the second item). It then converts the MIDI volume value (which has a possible range of 0 to 127) to a percentage value (range of 0 to 100). To reduce the number of brightness INSTEON messages sent, it only sets the brightness of the lights in 5 percent increments (that's what the "mod" thing does).

The code could be easily modified to use the key-on or key-off velocity to determine the brightness, or to turn on or off specific lights based on which keys are pressed.

(EDIT: Corrected math in above code).

Posted on
Thu Sep 02, 2010 1:52 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Using MIDI to Control Indigo

Freaking awesome - thanks for sharing! 8)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jul 01, 2016 10:02 am
akimball offline
Posts: 559
Joined: Aug 07, 2013
Location: Sandy, Utah

Re: Using MIDI to Control Indigo

Insanely great. Love this patch.

-Al

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests