A different CC # after a delay of 100 ms

Hi,

I have a MidiOut block with a button widget that sends out CC #20 on channel 15. I need the same button to send out CC #23, also on channel 15, but 100 ms after sending CC #20 out.

How can I accomplish this?

This thread has the answer:

Thanks for your reply @DaveBoulden

Different from the example, I use a MidiOut block (with handle = MIDIout) … and it resides in the Global Panel (not in a rackspace).

I tried this simple script below (derived from the example) but get this error message:
“GLOBAL RACKSPACE (Script Entity: GlobalRackspace) - Semantic error in “Main”: Line 4, Col 66: MIDIout cannot be used in this context”

Var
   MIDIout : MidiOutBlock

On ControlChangeEvent(m : ControlChangeMessage) Matching 20 from MIDIout    
  If (m.GetCCValue() == 127)
    Then
      MIDIout.SendLater(m, 100.0)
  Else
    MIDIout.SendNow(m);
End

This means that you cannot use the On ControlChangeEvent on a MIDIOutBlock, but only on a MIDIInBlock. You could do the same on a MIDI in block connected to a MIDI out block, but I would rather use a Scriptlet for that. Simply map you widget button to the CCTrigger parameter of this Scriptlet connected to you

Var
  CCTrigger : parameter 0..127 = 0

On ParameterValueChanged Matching CCTrigger
  If CCTrigger == 127
  Then
    SendNow(MakeControlChangeMessage(20,127));
    SendLater(MakeControlChangeMessage(23,127), 100.0);
  End
End

I didn’t test it but it should be close to work (but it only sends 127 value as, for any reason, it seems to be what you tried to do).

Hi @David-san,

After getting an error I had to seach a bit for the reason, but got the reasons, but the small change and now it works.

Thanks, you put me on the right track.

Var
  CCTrigger : parameter 0..127 = 127

On ParameterValueChanged Matching CCTrigger
  If CCTrigger == 127
  Then
    SendNow(MakeControlChangeMessage(20,127));
    SendLater(MakeControlChangeMessage(23,127), 100.0);
  End
End

I never could write ten lines of code without a single syntax error. And as I wrote this away from my GP computer… :nerd_face:

Happy if it works for you. :wink:

1 Like