Jump to content

Remapping channel specific CC messages


remark391

Recommended Posts

I'm looking to create a script that will redirect incoming CC messages (like the midi modifier plug can), but only for a specific channel. 

 

i.e. All incoming CC1 data gets remapped to CC11, but only on channel 1. All other midi data gets passed through. 

 

I'm still pretty new at coding in midi scripter, and can't quite figure it out. Any help would be greatly appreciated!

Link to comment
Share on other sites

  • 10 months later...

I have tried to add in a second command to change another CC message on top of the one that has already been done.

 

function HandleMIDI(event) {

//---This determines CC41 on channel 1---

if (event instanceof ControlChange && event.number == 41 && event.channel == 1 ) {

//---This sets CC41 to CC1---

event.number = 1;

 

}

event.trace();

event.send();

}

 

function HandleMIDI(event) {

//---This determines CC42 on channel 1---

if (event instanceof ControlChange && event.number == 42 && event.channel == 1 ) {

//---This sets CC42 to CC21---

event.number = 21;

 

}

event.trace();

event.send();

}

 

When i run the script it says that it runs correctly, however it is only effecting the CC42 to CC21 not the CC41 to CC1

 

any ideas?

Link to comment
Share on other sites

You're welcome!

 

You can create an additional 'if' statement to process a different channel:

 

//---This determines a CC on channel 6---
  if (e instanceof ControlChange && e.channel == 6 ) {
     switch (e.number) {		// and continue new cases.

 

To assign the event to a different channel you have to use the channel property:

 

//---Set CC41 to CC1 and change the channel to 10---
case 41:        
        e.number = 1;
        e.channel = 10;
        break;

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...