Dewdman42 Posted November 13, 2022 Share Posted November 13, 2022 To the op you might want to consider using an articulation set to listen for key switches and send cc commands instead of a scripter script Quote Link to comment Share on other sites More sharing options...
gacki Posted November 13, 2022 Share Posted November 13, 2022 12 minutes ago, Dewdman42 said: You should handle note off’s too A "quick and dirty" approach for this would be to change if (event instanceof NoteOn) { into if (event instanceof Note) { This has the downside that the controller would be sent twice (once when pressing the key and once when releasing it). I'd refine this once OP indicates that the script is going into the right direction. Quote Link to comment Share on other sites More sharing options...
Dewdman42 Posted November 13, 2022 Share Posted November 13, 2022 If you want to do a script then you have to handle note on and note off differently. Articulation sets already do this behavior Quote Link to comment Share on other sites More sharing options...
Dewdman42 Posted November 13, 2022 Share Posted November 13, 2022 Don’t forget also the possibility to have two tracks assigned to the same instrument channel Quote Link to comment Share on other sites More sharing options...
Dewdman42 Posted November 13, 2022 Share Posted November 13, 2022 You might check out this product also: https://www.autotonic.net This thread started as a MainStage request, I'm not sure if recent question is using Logic or MainStage now, sounds like LogicPro since mentioned Regions... Anyway, both Logic and MainStage supports Articulation Sets and I think with that you can convert incoming keyswitches into whatever CC you want...via articulationID...and drive the midi plugins that way. its not entirely clear to me the midi signal chain and exactly what is being done, so I can't comment more. Quote Link to comment Share on other sites More sharing options...
Dewdman42 Posted November 13, 2022 Share Posted November 13, 2022 But in any case check out this articulation set, instead of Scripter.... Quote Link to comment Share on other sites More sharing options...
gacki Posted November 13, 2022 Share Posted November 13, 2022 52 minutes ago, Dewdman42 said: sounds like LogicPro since mentioned Regions... The screenshot is clearly Logic. Quote Link to comment Share on other sites More sharing options...
Dewdman42 Posted November 13, 2022 Share Posted November 13, 2022 ok well anyway articulation sets and scripter both work in either place. The thread started out discussing MainStage. Perhaps a new thread should have been created. Quote Link to comment Share on other sites More sharing options...
Dewdman42 Posted November 14, 2022 Share Posted November 14, 2022 Here is my version of a Scripter script that handles NoteOff appropriately. I took a different approach, more keyswitches can be added as desired in the top of the script. I still think using ArticulationSet is the way to go though instead of Scripter. var ccmap = []; ccmap[MIDI.noteNumber("C3")] = 25; ccmap[MIDI.noteNumber("C#3")] = 28; ccmap[MIDI.noteNumber("D3")] = 35; var cc = new ControlChange; cc.number = 21; function HandleMIDI(event) { if(event instanceof NoteOn) { if(ccmap[event.pitch] != undefined) { cc.value = ccmap[event.pitch]; cc.channel = event.channel; cc.send(); return; } } else if (event instanceof NoteOff) { if(ccmap[event.pitch] != undefined) { // eat it return; } } event.send(); } Quote Link to comment Share on other sites More sharing options...
Pale Shelter Posted November 14, 2022 Share Posted November 14, 2022 Hello Dewdman42 and again, thank you guys for working on that script ! it's a game changer for me. Dewdman42, your script works perfectly, it's like magic here. For those 3 notes (C3 C#3 and D3) it's working. So I adapted your script to my needs (see below). In theory it should works, the script is evaluated successfully but I got no sound anymore. With your script it's working but with mine and my 48 notes, no. Would you have an idea ? Thank you var ccmap = []; ccmap[MIDI.noteNumber("C0")] = 1; ccmap[MIDI.noteNumber("C#0")] = 3; ccmap[MIDI.noteNumber("D0")] = 6; ccmap[MIDI.noteNumber("D#0")] = 9; ccmap[MIDI.noteNumber("E0")] = 11; ccmap[MIDI.noteNumber("F0")] = 14; ccmap[MIDI.noteNumber("F#0")] = 17; ccmap[MIDI.noteNumber("G0")] = 20; ccmap[MIDI.noteNumber("G#0")] = 23; ccmap[MIDI.noteNumber("A0")] = 26; ccmap[MIDI.noteNumber("A#0")] = 29; ccmap[MIDI.noteNumber("B0")] = 31; ccmap[MIDI.noteNumber("C1")] = 33; ccmap[MIDI.noteNumber("C#1")] = 35; ccmap[MIDI.noteNumber("D1")] = 38; ccmap[MIDI.noteNumber("D#1")] = 41; ccmap[MIDI.noteNumber("E1")] = 43; ccmap[MIDI.noteNumber("F1")] = 47; ccmap[MIDI.noteNumber("F#1")] = 50; ccmap[MIDI.noteNumber("G1")] = 55; ccmap[MIDI.noteNumber("G#1")] = 58; ccmap[MIDI.noteNumber("A1")] = 60; ccmap[MIDI.noteNumber("A#1")] = 62; ccmap[MIDI.noteNumber("B1")] = 64; ccmap[MIDI.noteNumber("C2")] = 68; ccmap[MIDI.noteNumber("C#2")] = 71; ccmap[MIDI.noteNumber("D2")] = 74; ccmap[MIDI.noteNumber("D#2")] = 76; ccmap[MIDI.noteNumber("E2")] = 79; ccmap[MIDI.noteNumber("F2")] = 82; ccmap[MIDI.noteNumber("F#2")] = 83; ccmap[MIDI.noteNumber("G2")] = 87; ccmap[MIDI.noteNumber("G#2")] = 89; ccmap[MIDI.noteNumber("A2")] = 90; ccmap[MIDI.noteNumber("A#2")] = 93; ccmap[MIDI.noteNumber("B2")] = 96; ccmap[MIDI.noteNumber("C3")] = 99; ccmap[MIDI.noteNumber("C#3")] = 102; ccmap[MIDI.noteNumber("D3")] = 105; ccmap[MIDI.noteNumber("D#3")] = 108; ccmap[MIDI.noteNumber("E3")] = 111; ccmap[MIDI.noteNumber("F3")] = 113; ccmap[MIDI.noteNumber("F#3")] = 115; ccmap[MIDI.noteNumber("G3")] = 117; ccmap[MIDI.noteNumber("G#3")] = 120; ccmap[MIDI.noteNumber("A3")] = 123; ccmap[MIDI.noteNumber("A#3")] = 125; ccmap[MIDI.noteNumber("B3")] = 127; var cc = new ControlChange; cc.number = 21; function HandleMIDI(event) { if(event instanceof NoteOn) { if(ccmap[event.pitch] != undefined) { cc.value = ccmap[event.pitch]; cc.channel = event.channel; cc.send(); return; } } else if (event instanceof NoteOff) { if(ccmap[event.pitch] != undefined) { // eat it return; } } event.send(); } Quote Link to comment Share on other sites More sharing options...
Dewdman42 Posted November 14, 2022 Share Posted November 14, 2022 Well any notes you use as key switches can’t be used as real notes from the region. You have a lot of key switches there. scripter and other modiffx don’t have a way to distinguish between the region notes and the key switches you are playing to change key. There are other tricks you can get into with perhaps the environment so that incoming notes from keyboard will be on a different midi channel and then the script can tell where they came from Quote Link to comment Share on other sites More sharing options...
Pale Shelter Posted November 14, 2022 Share Posted November 14, 2022 I tried seriously to use ArticulationSet, but nothing happened, it doesn't work. I didn't understand why your script guys with the 48 keyswitch I added didn't work, it wasn't logical. Finally I found that the script with midi notes number just under D#1 didn't work. So the script you made is working perfectly, from D#1 to B3 and I still can't believe it. A dream. Now, let's do music 🙂 A BIG THANK YOU Quote Link to comment Share on other sites More sharing options...
Dewdman42 Posted November 14, 2022 Share Posted November 14, 2022 The articulation set does work, I tried it. You are missing some step in setting it up. Did you make sure to enable the MIDI Remote button? The Script will also work fine, unless you have some typo in the changes you did, I will look closer... but as I said, make sure you are not trying to use any keyswitches that are on the same pitches as notes in your region. that will not work in either approach unless you modify further to handle midi channels or something of this nature. Quote Link to comment Share on other sites More sharing options...
Dewdman42 Posted November 14, 2022 Share Posted November 14, 2022 Ok, so first thing, whenever you post Scripter code, please use the CODE button (see above) in the editor so that you're code will look more presentable here is your code formatted now, I don't see any typos and any reason why it wouldn't work. Please describe what you mean when you say it doesn't work var ccmap = []; ccmap[MIDI.noteNumber("C0")] = 1; ccmap[MIDI.noteNumber("C#0")] = 3; ccmap[MIDI.noteNumber("D0")] = 6; ccmap[MIDI.noteNumber("D#0")] = 9; ccmap[MIDI.noteNumber("E0")] = 11; ccmap[MIDI.noteNumber("F0")] = 14; ccmap[MIDI.noteNumber("F#0")] = 17; ccmap[MIDI.noteNumber("G0")] = 20; ccmap[MIDI.noteNumber("G#0")] = 23; ccmap[MIDI.noteNumber("A0")] = 26; ccmap[MIDI.noteNumber("A#0")] = 29; ccmap[MIDI.noteNumber("B0")] = 31; ccmap[MIDI.noteNumber("C1")] = 33; ccmap[MIDI.noteNumber("C#1")] = 35; ccmap[MIDI.noteNumber("D1")] = 38; ccmap[MIDI.noteNumber("D#1")] = 41; ccmap[MIDI.noteNumber("E1")] = 43; ccmap[MIDI.noteNumber("F1")] = 47; ccmap[MIDI.noteNumber("F#1")] = 50; ccmap[MIDI.noteNumber("G1")] = 55; ccmap[MIDI.noteNumber("G#1")] = 58; ccmap[MIDI.noteNumber("A1")] = 60; ccmap[MIDI.noteNumber("A#1")] = 62; ccmap[MIDI.noteNumber("B1")] = 64; ccmap[MIDI.noteNumber("C2")] = 68; ccmap[MIDI.noteNumber("C#2")] = 71; ccmap[MIDI.noteNumber("D2")] = 74; ccmap[MIDI.noteNumber("D#2")] = 76; ccmap[MIDI.noteNumber("E2")] = 79; ccmap[MIDI.noteNumber("F2")] = 82; ccmap[MIDI.noteNumber("F#2")] = 83; ccmap[MIDI.noteNumber("G2")] = 87; ccmap[MIDI.noteNumber("G#2")] = 89; ccmap[MIDI.noteNumber("A2")] = 90; ccmap[MIDI.noteNumber("A#2")] = 93; ccmap[MIDI.noteNumber("B2")] = 96; ccmap[MIDI.noteNumber("C3")] = 99; ccmap[MIDI.noteNumber("C#3")] = 102; ccmap[MIDI.noteNumber("D3")] = 105; ccmap[MIDI.noteNumber("D#3")] = 108; ccmap[MIDI.noteNumber("E3")] = 111; ccmap[MIDI.noteNumber("F3")] = 113; ccmap[MIDI.noteNumber("F#3")] = 115; ccmap[MIDI.noteNumber("G3")] = 117; ccmap[MIDI.noteNumber("G#3")] = 120; ccmap[MIDI.noteNumber("A3")] = 123; ccmap[MIDI.noteNumber("A#3")] = 125; ccmap[MIDI.noteNumber("B3")] = 127; var cc = new ControlChange; cc.number = 21; function HandleMIDI(event) { if(event instanceof NoteOn) { if(ccmap[event.pitch] != undefined) { cc.value = ccmap[event.pitch]; cc.channel = event.channel; cc.send(); return; } } else if (event instanceof NoteOff) { if(ccmap[event.pitch] != undefined) { // eat it return; } } event.send(); } Secondly, I think the articulation set will work for you and might even be able to actually handle when you have conflicting notes in the region... Try it again. Make sure you enable MIDI REMOTE...its the button in the top left corner..it should be BLUE to be active. Quote Link to comment Share on other sites More sharing options...
Dewdman42 Posted November 14, 2022 Share Posted November 14, 2022 so another trick you could use that I just thought of....without articulation set...to avoid the problem of conflicting pitches in the region.... you can make sure all the events in the region have articulationID set to something, like 1 or 2 or something, like that, anything other then zero. when you play notes on your keyboard...WITHOUT ANY ARTICULATION SET ACTIVE, they will appear to scripter with ArticulationID=0. Then in the script we can determine whether the events are coming from the region or not based on the articulationID It would mean you have to modify all your region data to have articulationID=1 or any non zero value. You can do that in the event list editor in simple steps: add articulation to the event list view (event list view menu) select all the notes in the region change one of them from 0 to 1, they will all change because they're all selected. But then the script might look like this in order to distinguish notes coming from live keyboard vs notes coming from the region: var ccmap = []; ccmap[MIDI.noteNumber("C0")] = 1; ccmap[MIDI.noteNumber("C#0")] = 3; ccmap[MIDI.noteNumber("D0")] = 6; ccmap[MIDI.noteNumber("D#0")] = 9; ccmap[MIDI.noteNumber("E0")] = 11; ccmap[MIDI.noteNumber("F0")] = 14; ccmap[MIDI.noteNumber("F#0")] = 17; ccmap[MIDI.noteNumber("G0")] = 20; ccmap[MIDI.noteNumber("G#0")] = 23; ccmap[MIDI.noteNumber("A0")] = 26; ccmap[MIDI.noteNumber("A#0")] = 29; ccmap[MIDI.noteNumber("B0")] = 31; ccmap[MIDI.noteNumber("C1")] = 33; ccmap[MIDI.noteNumber("C#1")] = 35; ccmap[MIDI.noteNumber("D1")] = 38; ccmap[MIDI.noteNumber("D#1")] = 41; ccmap[MIDI.noteNumber("E1")] = 43; ccmap[MIDI.noteNumber("F1")] = 47; ccmap[MIDI.noteNumber("F#1")] = 50; ccmap[MIDI.noteNumber("G1")] = 55; ccmap[MIDI.noteNumber("G#1")] = 58; ccmap[MIDI.noteNumber("A1")] = 60; ccmap[MIDI.noteNumber("A#1")] = 62; ccmap[MIDI.noteNumber("B1")] = 64; ccmap[MIDI.noteNumber("C2")] = 68; ccmap[MIDI.noteNumber("C#2")] = 71; ccmap[MIDI.noteNumber("D2")] = 74; ccmap[MIDI.noteNumber("D#2")] = 76; ccmap[MIDI.noteNumber("E2")] = 79; ccmap[MIDI.noteNumber("F2")] = 82; ccmap[MIDI.noteNumber("F#2")] = 83; ccmap[MIDI.noteNumber("G2")] = 87; ccmap[MIDI.noteNumber("G#2")] = 89; ccmap[MIDI.noteNumber("A2")] = 90; ccmap[MIDI.noteNumber("A#2")] = 93; ccmap[MIDI.noteNumber("B2")] = 96; ccmap[MIDI.noteNumber("C3")] = 99; ccmap[MIDI.noteNumber("C#3")] = 102; ccmap[MIDI.noteNumber("D3")] = 105; ccmap[MIDI.noteNumber("D#3")] = 108; ccmap[MIDI.noteNumber("E3")] = 111; ccmap[MIDI.noteNumber("F3")] = 113; ccmap[MIDI.noteNumber("F#3")] = 115; ccmap[MIDI.noteNumber("G3")] = 117; ccmap[MIDI.noteNumber("G#3")] = 120; ccmap[MIDI.noteNumber("A3")] = 123; ccmap[MIDI.noteNumber("A#3")] = 125; ccmap[MIDI.noteNumber("B3")] = 127; var cc = new ControlChange; cc.number = 21; function HandleMIDI(event) { if(event instanceof NoteOn && event.articulationID == 0) { if(ccmap[event.pitch] != undefined) { cc.value = ccmap[event.pitch]; cc.channel = event.channel; cc.send(); return; } } else if (event instanceof NoteOff && event.articulationID == 0) { if(ccmap[event.pitch] != undefined) { // eat it return; } } event.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.