FredBegin Posted November 16, 2016 Share Posted November 16, 2016 I have limited knowledge in programming. My goal is: When playing on midi channel 1, remap channel 1 NoteOn, NoteOff and ControlChange to channel 1 to 4 simultaneously. When playing on midi channel 5, remap channel 5 NoteOn, NoteOff and ControlChange to channel 5 to 8 simultaneously. The first part works The second doesn't. Its the first time i'm using the ''while'' condition. I don't know how to set the midi channel range from 5 to 8 Thanks for any help! Fred var inst1 = 1; var inst2 = 5 function HandleMIDI(event) { if (event instanceof NoteOn && event.channel == inst1|| event instanceof NoteOff && event.channel == inst1 || event instanceof ControlChange && event.channel == inst1) { var i = 1; while (i <= 4) { event.channel = i; event.send(); i++ } } else if (event instanceof NoteOn && event.channel == inst2|| event instanceof NoteOff && event.channel == inst2 || event instanceof ControlChange && event.channel == inst2) { var i = 1; while (i <= 8) {//here's where i'm stucked. Should be set to send on channels 5 to 8 event.channel = i; event.send(); i++} } else {event.send()} event.send(); //Pass MIDI events through the plug-in. } Quote Link to comment Share on other sites More sharing options...
skijumptoes Posted November 16, 2016 Share Posted November 16, 2016 I'm a coder, but not used the scripting in Logic yet, but looking from a code perspective you should be able to just set the starting channel (i.e. 5) so:- var i = 5; while (i <= 8) {....etc You could also use a for loop to specify a range, but this should work providing event.channel/event.send is correct. For..loop would be something more like this:- for (i = 5; i <= 8; i++) { event.channel = i; event.send(); } Quote Link to comment Share on other sites More sharing options...
FredBegin Posted November 17, 2016 Author Share Posted November 17, 2016 Thank you! that worked! 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.