Jump to content

CC messages sends delay


Keyflow

Recommended Posts

Hello,

 

I'm using MainStage to send midi to an external midi device (Yamaha Motif XS). To send a program change for the master mode of the Yamaha I have to use SysEx.

When selecting a patch, I want to

1) send program change (midi file > SysEx)

2) send a CC74 (cut off message).

 

The problem is: the CC message is received BEFORE the SysEx PC, so the CC message isn't changed in the "new" selected sound. I read there is an option to use the midi Scripter. Is there a way to make a script to delay the "send CC messages"?

 

Hope you can help!

 

Thanx.

Link to comment
Share on other sites

From this Logic Pro User Guide Script's tutorials:

 

  • Tutorial script 3: Transpose and Delay
    (Repeat notes up one octave with 100ms delay and pass all other events through.)
     
    Text following /* shows comments that explain the JavaScript code.
function HandleMIDI(event) {
event.send();    /* send original event */
if (event instanceof Note) {  /* if it is a note */
event.pitch += 12;   /* transpose up one octave */
event.sendAfterMilliseconds(100);  /* send after delay */
}
}

 

The solution could be obtained by some edition:

 

  • removing the "event.send(); /* send original event */ " line,
    since you don't need to repeat any MIDI events (notes, CC, SysEx, etc);
  • replace the "Note " by ControlChange.74, in the :"if (event instanceof Note) { /* if it is a note */ " line,
    since your target is CC74;
  • removing the "event.pitch += 12; /* transpose up one octave */ " line,
    as there is no need to transpose anything in your situation;
  • and finally setting the required delay value as needed (experimentation required) in the "event.sendAfterMilliseconds(100) " line.

 

The resulting code would normally look like this :

function HandleMIDI(event) {
if (event instanceof ControlChange && event.number == 74) {  /* if it is a CC74 */
event.sendAfterMilliseconds(500);  /* send after a delay of 0.5 second*/
}
event.send()
}

 

Nota: Not being at the studio, I didn't test the above script.

I just wrote same so you get the gist of how it is rather simple.

I wish you that some other more savvy could chime in...

Link to comment
Share on other sites

I think that all you have to do is removing "&& event.number == 74 " from the script. Since that part was specifying the CC74.

 

Be aware though that all the CC includes the modwheel (CC#1), therefore those modwheel wiggles will also be delayed...

 

If you want to keep the modwheel in sync (not delayed), from the original script try replacing "== 74 " with "!== 1 ".

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...