Script Channel Constrainer?

I’ve just implemented using the midi file player to play a sequence that has a click track. The click track is on channel 3 and ultimately routes to an instance of Battery 4. I’m wanting to harness the note events of the click track to flash LED widgets on the panel so I can see the click as well as hear it. I’m using three midi channel constrainers coming out of the midi file player so I can constrain the notes to the three different plugins. Since there is no midi-in block involved, I was wondering if there is a way to capture those note events from the constrainer so that I can trigger the LEDs. I’m not seeing anything in docs giving me an indication this would work.

X

Use a scriptlet to inject that note message in the local gp port and then midi Learn the widget
Or send the proper OSC message to GP
Or send the midi note to an additional midi in block using the midi merge option and then use a rackspace script to react on that midi in block and set the widget value.

Scriptlet

On NoteEvent(m : NoteMessage)
 if IsNoteOn(m) then
    InjectMidiEvent("Local GP Port", MakeControlChangeMessage(100, 127))
 else
    InjectMidiEvent("Local GP Port", MakeControlChangeMessage(100, 0)) 
 end
End

Here the solution using a RackspaceScript and OSC

var MIN : MidiInBlock
    METRO : Widget

//Called when a NoteOn or NoteOff message is received at some MidiIn block
//Note: this will NOT be called for NoteOn/NoteOff messages if you have explicit
//NoteOnEvent/NoteOffEvent respectively callbacks defined

On NoteEvent(m : NoteMessage) from MIN
 if IsNoteOn(m) then
  OSC_SendDoubleSpecific("/METRO/SetValue", 1.0, "127.0.0.1", 8001)
 else
  OSC_SendDoubleSpecific("/METRO/SetValue", 0.0, "127.0.0.1", 8001) 
 end   
End
1 Like