A technical support community for Apple Logic Pro users.

 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Wed Jun 23, 2021 8:42 pm

you did in the project you sent me.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Wed Jun 23, 2021 8:43 pm

In the articulation set, make sure the entire OUTPUT section is empty.

You're basically only using the articulation set in order to give meaningful names as labels to each articulationID. And its ok to use the INPUT section if you like, but leave the OUTPUT section empty.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
D4rkKn1ght
Posts: 17
Joined: Fri Apr 30, 2021 6:01 pm

Re: TIP: Scripter Keyswitches

Wed Jun 23, 2021 8:48 pm

Right. So there can't be a combination of a few standard keyswitches which have output notes assigned (up to 3 notes obviously) - and then some articulations which have a blank output which I want to script? Because I was sure that's what I was doing a couple of weeks ago when I first started experimenting with your sripts. 3 level arts I could do the default Logic way and any that needed 4 or more, I would leave the ouput of those specific ones blank and then script them. But you're saying the combination won't work?
 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Wed Jun 23, 2021 8:52 pm

I don't know if a combination would work, maybe. But for any one articulationID, you cannot have both keyswitches from the OUTPUT and keyswitches from the script. Quite likely you should be able to make sure that for example articulationID 1 has nothing defined in the output section..and then the id will make it to the script. I haven't tested that scenario so I don't really know for sure right now..

if it were me I'd prefer to have it all in one place, in this case, in the script.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
D4rkKn1ght
Posts: 17
Joined: Fri Apr 30, 2021 6:01 pm

Re: TIP: Scripter Keyswitches

Wed Jun 23, 2021 9:04 pm

Yep so I'm 100% sure there aren't outputs defined for the articulations I'm trying to script. They are blank. The only articulations that you'll see with outputs are default, 3 level articulations that I'm not trying to script. The combination of having defaults with defined outputs and scripted with blank outputs was working for me a week or so ago without any noticeable issue.

Also the other reason I don't think the problem is what your first instinct is, is because once the second note arrives in the piano roll, it DOES switch. So if it was a problem like what you're describing, it would never switch. Check out the screen recording/GIF in my post. The selected notes in the Piano Roll are the ones with the scripted articulation assigned. The notes before and after are just default 3 level articulations. You'll notice that once the playhead reaches the second selected note, which is the second occurrence of the scripted articulation, it finally switches then.

So again, to me when I observe this behaviour, it seems like the first occurrence of the note is behaving like a NoteOff and then the second occurrence acts like the NoteOn, which finally enables the switch. There's some kind of NoteOff/NoteOn weirdness happening but I'm not knowledgeable enough to figure it out on my own. Because also observe how the first selected note in the piano roll doesn't make any sound either, just like it's a 0 velocity note. You can see the levels at the top of the Synchron player in my screen recording; no levels or sound are generated by the first selected note, but the second selected note suddenly behaves normal - both making sound AND making the desired articulation switch happen.
 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Wed Jun 23, 2021 9:21 pm

yea I don't know what you had before but when I try it right now, articulationID is being stripped off for artid 1 and 2, even though your articulation set has those cleared in the OUTPUT section. no idea what else to say...keep playing around until articulationID isn't stripped off the notes anymore.

If you want a debugging tool, here is another scripter script you can use:

https://gitlab.com/dewdman42/midimonito ... MidiMon.js

To use that, put another instance of Scripter after the one you already have for keyswitching...and put this script in it, hit the Run Script button and leave the editor window open. Then when you hit play or even if you just click on notes in the piano roll...you see logging of all the keyswitches being generated...and you will also be able to see articulationID...if it hasn't been stripped off.

I am off to bed, so I won't be able to look at this for you until at least tomorrow...but I just tested it and right now your project is stripping off the articulationID before getting to the keyscript....which I think its most likely related to the articulation set. Like I said...there are some design flaws in there...I don't know of any other reason the articulationID would be stripped off before hitting the script....other then the articulation set does so when the OUTPUT section is defined....I hear you that you say you have those entries empty...but its stripping it out for me here now...not sure what you had last week.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Wed Jun 23, 2021 9:21 pm

ps - the keyswitching script is very simple. It works perfectly for me. I'm confident that is not the problem.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Wed Jun 23, 2021 9:26 pm

no actually scratch that, articulationID is NOT being stripped off for art1 and art2 in your example project, it is working as you hoped...so that is not necessarily the problem....but whatever stuff you are talking about above is not the keyswtiching script...as I said, its a very simplistic script. sorry but I won't have any more time tonight to look closer at your project. Good luck.
Last edited by Dewdman42 on Wed Jun 23, 2021 9:59 pm, edited 1 time in total.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
D4rkKn1ght
Posts: 17
Joined: Fri Apr 30, 2021 6:01 pm

Re: TIP: Scripter Keyswitches

Wed Jun 23, 2021 9:29 pm

Awesome, I'll take a look and see if I can figure anything out with the debug.

Yeah I believe and agree with you that the script is probably not the culprit. Especially since it was working until recently. Something else must be going on, but I just can't figure out what.

And FYI the reason I don't want to just script the whole Art Set is that there's simply just too many to do. I bought Art Conductor to save time for all the articulations that don't need 4 or more triggers with the objective of only scripting certain Articulations that require more than 3 notes.

Anyway, thanks for your help and input so far :) Look forward to getting more thoughts from you when you get another chance to check it out.
 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Wed Jun 23, 2021 9:33 pm

Before I nod off, Theoretically there is one other thing that could be going on...

LogicPro handles keyswitching slightly differently then this script does. Let's take the script first....

The script sends each keyswitch as NoteOn followed immediately by the keyswitch NoteOff. That actually works fine for 99.99% of libraries out there, I actually don't know of a single library where that won't work.

LogicPro articulation set handles it slightly differently, what that does is that if you have a note with an articulationID, it first sends the NoteOn for each keyswitch...and then it sends the actual note (note the NoteOff's for the keyswitches haven't been sent yet). The note is still being held...and all of the associated keyswitches are also still being held.... and then finally the NoteOff for the actual note comes through...and after that then LogicPro finally sends the NoteOff's for each of the keyswitches that were held open that whole time.

That theoretically works fine also, though its way more complicated then it needs to be as most sample libraries do not require you to hold down the keyswitches while playing the notes.

However since you are using a mixed bag of OUTPUT and scripted keyswitches....it could be that since in some cases they are held down and some cases not...the Synchron player is receiving some confusing mess of keyswitch NoteOn/NoteOff's ..especially with Synchron where you have 5 dimensions deep, two different articulations might be sharing some of the same keyswitches...and your OUTPUT versions will be leaving them hanging open while the script won't be....

just a theory...

UPDATE: All of the above is true, but probably not the problem you're having...see post below....
Last edited by Dewdman42 on Wed Jun 23, 2021 10:00 pm, edited 3 times in total.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Wed Jun 23, 2021 9:34 pm

A good command line script for the future would be a script that can convert the articulation set plist file into one of these scripts...then you add from there. but that will not happen this week, sorry.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Wed Jun 23, 2021 9:59 pm

Actually I revert back to what I said earlier.... ArticulationSet **IS** stripping off the articulationID on the NoteOn...but not the NoteOff...which is annoying but that confused me a few posts ago. But anyway in your project when art1 or art2 are used, look at the logging and you will see that articulationID isn't coming through on the NoteOn...it does come through for the corresponding NoteOff..but its stripped off the NoteOn.....UNLESS you hit the note twice in a row...like you observed...then it doesn't strip off the articulationID. hahah

why would that be? That is because the articulation set is "smart" enough to know that if you have two notes of the same articulation in a row it doesn't need to send the keyswitches again for the second note.. So it doesn't even try. Since it doesn't try to send a keyswitch for the second note, it doesn't strip off the articulationID either.

I don't see any way around this other then clearing your OUTPUT section entirely... but anyway I really am heading to bed now...good luck.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Thu Jun 24, 2021 4:48 pm

Alright, this might help you...

Here is a command line shell script (see below)..

Basically you run this script and supply the name of the Articulation Set plist file. Articulation Set plist files are found in the following place:
~/Music/Audio\ Music\ Apps/Articulation\ Settings/


So run this script and supply the name of the plist you want...it will export the keyswitch section you need to use with my key switcher script found now in post#1.

For example, if you saved this script with a name like getSwitches.sh (and make sure its in your path or copy it to the Articulation Settings folder)....

A usage example would be like this:

cd ~/Music/Audio\ Music\ Apps/Articulation\ Settings/
getSwitches.sh test.plist
KS[1] = {"E0","F0"};
KS[2] = {"C0",[25,12]};
KS[3] = {"F#0"};
KS[4] = {"D0"};
KS[5] = {"G0"};
KS[6] = {"F0"};
KS[7] = {"C#0"};
KS[8] = {"D#0"};


Then you copy and paste that outputted text into the Keyswitcher script at the top, and that should have all NoteOn and CC switches copied from the ArticulationSet into script form.

I may update this later to be more automatic to create the entire script and save it in the right place with a name, etc..with the entire script already in there, etc.. but for now this is all you get...but anyway should help you get past this problem where you have a lot of existing articulation sets that need more then 3 keyswitches.. obviously you have to add more keyswitches to this generated output as needed and you have to go clear out the OUTPUT section of the articulation set for it to work correctly.

https://gitlab.com/dewdman42/art2script/-/blob/main/art2script.sh
Last edited by Dewdman42 on Sun Oct 17, 2021 10:01 pm, edited 2 times in total.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
D4rkKn1ght
Posts: 17
Joined: Fri Apr 30, 2021 6:01 pm

Re: TIP: Scripter Keyswitches

Thu Jun 24, 2021 5:11 pm

Thanks so much man. After experimenting a bunch yesterday I confirmed/concurred with your theories. What I think must have happened when I THOUGHT I had the combination of output and no output Articulations working a week or so ago - I think I did the first few scripted articulations, saw that they worked and then went about adding a few more PLUS the standard Logic/unscripted ones. I then don't think I fully tested to see whether the scripted switches were still working after I began adding in the standard non-scripted variety. It must have broken in the same way I'm currently experiencing but I didn't notice because I've been using different instruments (that don't require this scripting) until now.

So yeah, I came to the same conclusion as you; that using some kind of command-line script to rip the articulations from the Art Set I bought was basically the only way to go. But it was beyond my skill level to do myself. So thanks so much for this. Really appreciate it. :)
 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Thu Jun 24, 2021 5:51 pm

cheers
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
D4rkKn1ght
Posts: 17
Joined: Fri Apr 30, 2021 6:01 pm

Re: TIP: Scripter Keyswitches

Thu Jun 24, 2021 6:09 pm

Although I see the only limitation of this first version of your script is that we still have to manually type in the ArtID names...

Is there a way we can modify/update this script to fetch the names from the .plist also?
 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Thu Jun 24, 2021 6:19 pm

I'll take a look, I overlooked that. The name is really kind of optional anyway, the script doesn't need it, its just there for information purposes only, but its a good point, let me figure that out.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
D4rkKn1ght
Posts: 17
Joined: Fri Apr 30, 2021 6:01 pm

Re: TIP: Scripter Keyswitches

Thu Jun 24, 2021 6:31 pm

Oh so this version of the Scripter script only uses the ID number is it? I assumed it was using the names like in your previous version. The names are definitely less important if that's the case.
 
User avatar
Dewdman42
Topic Author
Posts: 3365
Joined: Tue Sep 09, 2014 3:01 pm

Re: TIP: Scripter Keyswitches

Thu Jun 24, 2021 6:34 pm

name was never really needed...the first script is easier to understand fro some people from a scripting perspective...which is why I did that one first...but its the inferior approach in general. That's why I moved it off of the first post.

Its still useful to have the name there as a comment, as is the case with this good script...when you go back to add in more keyswitches it will be a little easier to find...but not needed for the script to run at all.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
D4rkKn1ght
Posts: 17
Joined: Fri Apr 30, 2021 6:01 pm

Re: TIP: Scripter Keyswitches

Thu Jun 24, 2021 6:50 pm

Dewdman42 wrote:
Its still useful to have the name there as a comment, as is the case with this good script...when you go back to add in more keyswitches it will be a little easier to find...but not needed for the script to run at all.


Yeah that's definitely true. To be able to easily ID which entry is which articulation is probably very useful actually. I'm sure you'll find a way to harvest the names in your V2.0 shell :wink: