remark391 Posted January 4, 2017 Share Posted January 4, 2017 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! Quote Link to comment Share on other sites More sharing options...
Eric Cardenas Posted January 10, 2017 Share Posted January 10, 2017 This one should get you going; function HandleMIDI(event) { //---This determines CC1 on channel 1--- if (event instanceof ControlChange && event.number == 1 && event.channel == 1 ) { //---This sets CC1 to CC11--- event.number = 11; } event.trace(); event.send(); } Quote Link to comment Share on other sites More sharing options...
jcavenagh Posted November 14, 2017 Share Posted November 14, 2017 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? Quote Link to comment Share on other sites More sharing options...
Eric Cardenas Posted November 14, 2017 Share Posted November 14, 2017 See if this works for you: function HandleMIDI(e) { //---This determines a CC on channel 1--- if (e instanceof ControlChange && e.channel == 1 ) { switch (e.number) { case 41: //Set CC41 to CC1 e.number = 1; break; case 42: //Set CC42 to CC21 e.number = 21; break; } } e.trace(); e.send(); } Quote Link to comment Share on other sites More sharing options...
jcavenagh Posted November 14, 2017 Share Posted November 14, 2017 how thank you! thats just what i needed Sorry to be a pain but is there anyway to get it to trigger on other midi channels or specify which channels you want for each case? Quote Link to comment Share on other sites More sharing options...
Eric Cardenas Posted November 14, 2017 Share Posted November 14, 2017 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; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.