Jump to content

TIP: Scripter Keyswitches


Recommended Posts

Another comment I want to make as a general heads up:

 

These scripts send NoteOn keyswitches followed immediately by the corresponding NoteOff.

 

This is slightly different then the way ArticulationSet's work. When you use the ArticulationSet to send keyswitches:

 

The NoteOff is not sent until a new articulationID is encountered, it leaves the NoteOn hanging open until then.

 

In theory, this only matters for instruments which pay attention to that aspect, which most sample instruments do not. Most sample instruments simply listen for the NoteOn of a keyswitch, which triggers an articulation and that's it. the NoteOff could come immediately now, or much later and it won't matter. But indeed there are occasionally some libraries which keep track of which keyswitches are currently "open", meaning the NoteOn has turned on a certain feature and as long as that keyswitch note is held down and sustaining, the feature is activated until the keyswitch note is released. In that case, these scripts will not currently work...but ArticulationSet's work that way.

 

I don't believe most of you will need to do anything about this, but if you are using one of those instruments that uses held keyswitches for some purpose, then these scripts (so far) are not for you.

 

It is possible to script things to be more like ArticulationSet's, but introduces more complexity that I am specifically trying to leave out for the sake of learning.

OSX 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

Hey Dewdman42. Could you please speak a bit more about the default behaviour of an instrument when no articulation is selected in an articulation set? You briefly spoke about it above - setting a dummy first entry in the art. set without any keyswitches. I thought I knew what you meant and tried that, but it didn't work for me. I would actually get no sound. Testing this with Synchron Player by the way.

 

As you know, when an art. set is chosen for a particular track/instrument, it has a little drop-down menu added to its GUI window too. So in my art. set I made my first articulation an empty one called Dummy, adding no other details to it. No keyswitches etc. So then when I have Synchron Player open, the dropdown at the top is set to 'Dummy' by default, but as I click through the available articulations in the GUI to audition them and play around and see what I like, there is no sound. Without the dummy entry, there is sound, but as you say, it defaults to the first articulation in the art. set. Even if you choose a different articulation from that dropdown menu, it's basically forcing you to use your art. set to hear any of the articulations and if you haven't made entries for all the articulations (for Synchron Strings it would be a massive task that I don't want to do) - then you're out of luck.

 

Any light you can shed on this? Any ways around it?

Link to comment
Share on other sites

are you talking about the behavior of the articulation set or the behavior of the scripts on this thread?

 

but articulation sets do end up sending the first articulation OUTPUT section if no articulation is present in the note. You should be hearing something, so maybe share a project to show what you mean.

 

The Scripts above, which are instead of the output section of articulation set....do work slightly differently as of now. If no articulationID is present on a note, it is assumed to be zero. ifs you don't have keyswitches defined for articulation zero, then it will just send the note itself with no keyswitching...which means it will continue with whatever articulation is currently in effect.

OSX 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

  • 2 weeks later...
I'm not an Excel expert, but I just want to point out that it would probably be fairly easy to make an Excel Macro or a script of some kind that can take an Excel csv file and generate a complete keyswitch script. Maybe I will take a crack at that later today.

OSX 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

Sorry I didn't get notified of your posts Dewdmand42 and I've been pulled in another direction for the last week or so.

 

I'll come back to the default behaviour thing I asked about last time.

 

For now, I see you've edited your original post to put that other version of the script where you just edit the array at the top. I was about to try that one anyway actually.

 

So now I am trying it, but for some reason, it's not working properly. The keyswitch seems to only take effect if there are two notes in a row with the same articulation assigned to them. And it only takes effect on the 2nd of the two notes. So for example, I've got an articulation with 4 notes I've specified at the top of your script in order to switch to the desired articulation in Synchron Strings Pro. I then have the corresponding Art Name/ID right after it (the green section). But in the piano roll, if I have only one note with that Art ID assigned to it, it doesn't switch to the desired articulation as is normal. If I put another note right after the first one, however, it does switch when it reaches the second note. If I then delete the first note, then it goes back to not working gain. So basically there's something in that script that's requiring at least two subsequent notes of the same ID before the switch happens.

 

Look forward to your help. Thanks!

Link to comment
Share on other sites

Thanks Dewdman42.

 

I'm quite confused now because I did a test with the old version of your script which was previously working for me and now that's doing the same thing. Any of the articulations I've scripted that require 4 notes to keyswitch seem to exhibit this behaviour. I've also noticed that if I assign one of these '4 note articulations' to a note in the piano roll and then click on it, it doesn't make a sound the way most MIDI notes do when you click on/select them. But if I click on it a second time it does. This seems to mimic the behaviour that's happening with the keyswitching/scripting also. That only after a subsequent triggering of the MIDI note does it actually.... I dunno...do anything. So it's not just the switching that doesn't happen on the first occurrence but the note itself doesn't even make a sound until a second occurrence.

 

Actually looking at the behaviour in Synchron player [and I've attached an example project and a screen recording of this] - I have a few notes that come first assigned in the usual Logic way as they only require 3 notes to switch. When the playhead reaches the notes that I've assigned the custom scripted 4 note switches to. The first MIDI note seems to only serve to disable the previous articulation, as if it's only sending a NoteOff message. Then the subsequent occurence enables the desired articualtion. So 2 notes in a row with the scripted articulation, the first one seems to only have a 'NoteOff' type effect, disabling whatever the previous articulation was, then once the second note comes along, then it seems to activate in a NoteOn type fashion. If you look at the video I've shared, you can see what I'm trying to describe by watching the virtual keyboard at the bottom of Synchron player. Watch how the highlighted keyswitches to the far left work as the articulations switch and then look at what happens once the first script articulation arrives. All that seems to happen is the virtual pressing of the keyswitches seems to release. Once the second scripted articulation arrives, then you can see the virtual keys/keyswitches press down on the correct notes to activate the desired articulation.

 

I've got no idea why this behaviour has started now and wasn't happening before though....

 

 

1631508201_KeyswitchIssuesEg.thumb.gif.7325002894dd42b95d98bf84dae2b87a.gif

Example Project.zip

Link to comment
Share on other sites

Its mentioned in the first post, that you need to make sure the OUTPUT section of the articulation set does not have any keyswitches defined. It should be completely empty. Put the keyswitches in the script.

 

The reason is because LogicPro has a design flaw where if you have keyswithes sent from the OUTPUT section of the articulation set, it strips the articulationID away from the note at the time it sends the keyswitches...and thus the script can't see articulationID anymore.

OSX 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

I don't have anything in the output section. I have some standard Keyswitches that don't require any script assistance, they have the 3 output Notes. But the ones I'm using scripts for have empty output settings.

 

Or do you mean the entire output section for all keyswitches, scripted or unscripted, has to be empty? Because that didn't seem to be the case a week or so ago when I first tried this out. I just had blank output for the articulations I wanted to script, but the other articulations that didn't need scripting I had the 3 note output set up in the default Logic way. I wasn't getting this behavoiur then.

Link to comment
Share on other sites

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 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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/midimonitorlpx/-/raw/master/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 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

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. Edited by Dewdman42

OSX 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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....

Edited by Dewdman42

OSX 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

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 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

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 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

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

Edited by Dewdman42

OSX 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

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. :)

Link to comment
Share on other sites

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 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

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 12.x (Monterey) on OpenCore - Logic Pro 10.7.4, VePro7, Mainstage3 - 5,1 MacPro 3.46ghz x 12 96gb ram

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...