Pro Tools Rec Light

I decided to get rid of midi shield and changed the firmware. Now it is Hiduino. The program still works. :slight_smile:

Hello! Small update:
After couple weeks of testing during the real recording sessions I found a small bug. During recording when I try to choose a track (click on any track, armed or not) the LED shuts down. Fixed it!!! removing any info concerning channel byte. Now it works as should (sorry for the quality).

Don't understand why channel byte was an obstacle but it was. I'm going to check the idea with adding:

ccMessage12Value = -1; // blank MSB of message to stop rapid on / off of LEDs

May be this time (without channel info ) it will work.

Thank you!

Fixed it!!! removing any info concerning channel byte. Now it works as should

Well done. :slight_smile:

Thanks for the update.

Hello!
Another small update:

Mixing sessions brought a new bug: suddenly it turned out that "Scrubber Tool" when used sends tones of CC messages including the ones concerning record. The LED "rapidly turns on/off"... So, I was forced to deal with

 ccMessage12Value = 0; // blank MSB of message to stop rapid on / off of LEDs

and I found what was wrong with it!
I realised what it was for)) If it is correct I'd call it like: "MIDI debouncing". :slight_smile:
Dear Grumpy_Mike, your are GREAT!
All I had to to do is to change it to:

ccMessage44Value = 0;

since the message "ccMessage12Value" arrives first.
And voila: it works even better! I think from now I'm protected from new "surprises".

Thank you! :slight_smile:

and I found what was wrong with it!

Fantastic.
Mrs Grumpy says "that was the result you were aiming for but rarely get". To be able to fix your own stuff is good. :slight_smile:

Hi, after a week of fooling around with my first project...
Here is my code:

#include <MIDI.h>

//Flash arduino 8u2 or 16u2 chip with HIDUINO_MIDI.hex
//Set ProTools or other DAW to use MIDI controller / HUI protocol / arduino_midi (default hiduino name)
//The two sets of messages that we are looking for are:
// RECORD ON
// 1) channel 1,  controller 12, value 14 
// 2) channel 1,  controller 44, value 69
// RECORD OFF
// 1) channel 1,  controller 12, value 14 
// 2) channel 1,  controller 44, value 5

int firstMsg=0;  // set int for the first part of the two messages

MIDI_CREATE_DEFAULT_INSTANCE(); 

void setup(){
//Use LED for reference
pinMode(13,OUTPUT); 
// Listen for MIDI on channel 1 only
MIDI.begin(1); 
//Listen for incoming ControlChange MIDI messages and pass bytes to function if received
MIDI.setHandleControlChange(CCSequence); 
}

void loop() {
MIDI.read(); // Read all incoming MIDI data
}

//Function that will receive the CC MIDI Bytes
void CCSequence(byte channel, byte controller, byte value  ) { 
  //Check if CC message is equal to the first part of our two sequences:
  //1) channel 1,  controller 12, value 14 
  if((channel==1)&&(controller=12)&&(value==14))
    {
      //Mark first part of the sequence as received
      firstMsg=1; 
    }
    
  //If first part is received look for the second part of our two sequences
  if(firstMsg==1)
      {
        //Check if CC message is the second part of RECORD ON
        //2) channel 1,  controller 44, value 69
        if((channel==1)&&(controller=44)&&(value==69))
          {
            //Turn LED ON
            digitalWrite(13, HIGH);
            //Reset Marker. We start waiting for the first part of the sequence again
            firstMsg=0;
          } 
        //Check if CC message is the second part of RECORD OFF
        //2) channel 1,  controller 44, value 5
        if((channel==1)&&(controller=44)&&(value==5))
          {
             //Turn LED OFF
             digitalWrite(13, LOW);
             //Reset Marker. We start waiting for the first part of the sequence again
             firstMsg=0;
          }
      }
}

Hi! I'm trying to do something very similar but I'm using a Teensy 3.2

I copied your code but it keeps giving me this error message:

Arduino: 1.6.11 (Mac OS X), TD: 1.30, Board: "Teensy 3.2 / 3.1, MIDI, 96 MHz optimize speed (overclock), US English"

hui_controller:15: error: expected constructor, destructor, or type conversion before ';' token
MIDI_CREATE_DEFAULT_INSTANCE();
^
Using library MIDI in folder: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/MIDI (legacy)
expected constructor, destructor, or type conversion before ';' token

I was just wondering if there is a way to adapt this for the Teensy?

I copied your code but it keeps giving me this error message:

Well I have just tried compiling the code for a Teensy 3.2 and I got no error message at all. I suspect you haven't copied it correctly. I am using Arduino 1.8.4

I’m VERY new to Arduino and completely lost. My girlfriend made a “RECORDING” light for me for my birthday with a remote but I’d rather have it turn on and off when I press record in Pro Tools 12. I have an Arduino R3 Plus and a Sainsmart relay. I also have all of the components to make a MIDI circuit but would rather have this operate via MIDI USB. Could someone explain to me how to connect the Arduino to the relay and then what code to install? Also where would I connect the cable running from the light itself? Pretend you’re explaining it to a 5 year old. Lol. Thanks!

I am having a issue using HIDUINO. Pro Tools doesn't seem to send anything to my board. Did you change any configuration in PT? I can make it work sending raw MIDI CC Messages with MIDI-OX. Do you have any new code? Did you try using a MIDI Shield?

Thanks :slight_smile:

I couldn’t get it to work so I threw in the towel. If you get it working though, PLEASE let me know!

I'm still pretty stupid at programming languages so won't be able to help you with coding. All I know is the code that was written by Mr. Grumpy Mike. I changed some values (all the changes are in the thread). Then (after testing it with midi shield) I turned my arduino to (I believe) Hiduino. After that arduino was plugged via USB and was recognized by computer as midi device.
You have to configure your DAW. In Peripherals choose midi controller (hiduino). Under type choose HUI. After that PT will send midi data to your device. Just in case: the values in code correspond only to HUI protocol. It won't work with BABY HUI or Mackie (it's confusing but will work with MACKIE HUI in Cubase).

I got it working! Now, in Pro Tools 12, the pan faders are randomly changing for some reason. Almost as if there was automation on the track. It doesn't happen if I unplug the Arduino so it has something to do with that. Any idea what could be causing this?

UPDATE: This appears to be happening whenever I commit or render a track. It only seems to be affecting whatever the 6th track is on my edit window though. Very odd. Or is it?

gabermusic:
I'm still pretty stupid at programming languages so won't be able to help you with coding. All I know is the code that was written by Mr. Grumpy Mike. I changed some values (all the changes are in the thread). Then (after testing it with midi shield) I turned my arduino to (I believe) Hiduino. After that arduino was plugged via USB and was recognized by computer as midi device.
You have to configure your DAW. In Peripherals choose midi controller (hiduino). Under type choose HUI. After that PT will send midi data to your device. Just in case: the values in code correspond only to HUI protocol. It won't work with BABY HUI or Mackie (it's confusing but will work with MACKIE HUI in Cubase).

THANKS A LOT. It was this problem. Now it works perfectly. :slight_smile:

Are you not having the issues with the pan fader shifting? If so, could you send me the exact sketch that you used? I’m so lost. Thanks!

Hi @gabermusic
i just received my first arduino board and i'm trying to get it work with your code.
I also tried @FLIKI's code, but with no success.
My first attempts were done with some serial to midi bridge and looper as a virtual midi interface, with no success. I could see CC msg from protools but no light!
Then, i flashed (hard to figure out how to do when you're a beginner :slight_smile: ) with hiduino and could finally understand i would have to switch from both firmwares (HIDUINO and original one) to upload code and test it alternatively.
So, at to moment, i can't manage to light the onboard led (i believe it should light up and then, when validated, i would use i3 pin to drive a relay, or even an external LED... is this the case?).
So, could you post your final code?
I thank you in advance.
Ron.

Ahah, FLIKI's code repasted, and it seems to work :slight_smile: Hell yeah!
Now i have to build the hardware part.

Argh, trying to adapt for Studio One (which i'm not able at the moment), i figured out there was an issue in FLIKI's code, at three location if i remember well:

" if((channel==1)&&(controller=12)&&(value==14))"

-> controler is set, not tested.

Injecting MIDI values from Pocket midi seems not to react positively after correcting, i'm a bit disappointed and have to test further more.

Finally working punctually in the evenings is not a good method.
I corrected this little mistake and tried it in pro Tools: that still works, so my mistake is probably in Pocket Midi usage.
Regarding Studio One, i hadn't tried the mackie HUI controller, only mackie control (which made no sense).
Using mackie HUI - for which these midi codes fit well - allows one to use this light in any daw handling the HUI controller.