Onegin0 Posted March 16, 2016 Share Posted March 16, 2016 Hi guys I'm looking for a script that takes keyswitch notes and changes them into program changes. C1 -> Program Change 1 C#1 -> Program Change 2 D1 -> Program Change 3 etc I'm new to scripting. Any pointers? No idea if this is a one line job or a big job! Thanks Quote Link to comment Share on other sites More sharing options...
Unheardofski Posted March 16, 2016 Share Posted March 16, 2016 Just change the cases to the different Keyswitch note numbers you want to use and pc.number to the program change numbers, Anything that isn't a keyswitch is treated like a normal note function HandleMIDI(e) { if (e instanceof Note) { switch (e.pitch) { case 20: var pc = new ProgramChange(); pc.number = 1; if (e instanceof NoteOn) pc.send(); break; case 21: var pc = new ProgramChange(); pc.number = 2; if (e instanceof NoteOn) pc.send(); break; default: e.send(); } } else e.send(); } Quote Link to comment Share on other sites More sharing options...
Eric Cardenas Posted March 16, 2016 Share Posted March 16, 2016 Here's my take. Not as elegant as Unheardofski I'm afraid... // Note to Program Change - Starting at C1. function HandleMIDI(event) { var myKey = event.pitch - 36; var pC = new ProgramChange; if (event instanceof NoteOn) { pC.number = myKey; pC.send(); } } 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.