# Kontakt Script to change midi CC's to Key switch notes?



## JT3_Jon (Sep 10, 2014)

I have a smaller keyboard and it becomes frustrating using some libraries that house multiple articulations in one patch selectable by pre-defined keyswitches. For example, I'm playing a string patch and the articulation changes are for C7, C#7, D7, D#7, etc, but my keyboard, in order to be in the playable range of the instrument, does not go that high. 

I was hoping instead of creating new mapping on my keyboard and have to switch to this every time I want to play this one sample library, but instead use a kontakt script that will convert midi CC's to midi notes that I can assign and save as a preset. Does such a Kontakt script exist? I ask if one already exists as I have no clue how to script! 

But if I did, here is what I would do. I would have a input to the script start with a selectable midi CC so that not all midi CC's are running through the script, only the one you want to use to switch articulations. I would then have a value "from" and "to" selector so I can chose the range of the midi CC, as well as a selectable midi destination note that it will trigger. So for example I can set it to effect midi CC 85, and from 0-10 = C7, 11-20 = C#7, 21-30 = D7, 31-40 = D#7, etc. Having midi learn would speed this up, but isn't necessary. 

Something like this has to exist already right? I mean, this has to be a common enough problem?


----------



## Big Bob (Sep 10, 2014)

I am not aware of any existing multi-script that does this however, it would not be too difficult to write such a script. However, you would first have to specify more detail and/or what options might be required. 

Just to get you started, consider the following:

1. Are the keyswitches you want to synthesize latching or momentary? ie when you play a keyswitch do you have to hold it down while you play the next note or is its state' remembered' until another key switch is hit?

2. Since the answer to question 1 is most likely that the keyswitches are' latching', you should specify under what exact condtions the keyswitch notes are to be generated. You may not want a keysw note to be generated everytime your designated CC changes its value. As an alternative, you might want to use a single trigger key (if you have at least one key to spare for that purpose) to actually send the 'created' keyswitch note. That way, the CC value that exists when the trigger key is hit would determine which keyswitch to send, but, changing just the CC would not create any keyswitch events.

3. Would there be only one (programmable) CC# used or would it be necessary to provide for multiple CC proxies?

Depending on the detail you provide, someone may be willing to throw such a multi-script together for you (or maybe someone else already knows of such a script).

Rejoice,

Bob


----------



## JT3_Jon (Sep 10, 2014)

Hello Bob!

Thank you for taking the time to reply to my post! Very much appreciate it. Here are the answers to your questions. 

1. As you guessed, these keyswitches will be latching. The particular library I'm using does not use momentary key switches, though I guess an option for this might be a good idea for those who need it? In my case though I rarely see momentary key switches that you need to hold down. In fact, I cannot off the top of my head think of one! So perhaps its unnecessary. 

2. I would prefer not to use a created keyswitch note, as when using DAWs midi chasing during playback, its much easier to chase CC's vs actual keyswitches anyway. Plus when it comes time to score you dont have to remove any notes, so its win-win. Of course this means you have to make sure to write the first midi CC in your DAW, but this is no problem. In fact, this is how I use VSL VI player, which allows you to use midi CC instead of keyswitches to switch between articulations, and it works great! 

3. In my case only one midi CC would be needed, since you have the ability to in theory have 127 different articulations, this should be more than enough. Of course having the ability to make it any CC you want is important, but only one midi CC per script is necessary. 

Thinking out loud, I wonder if it should be a macro script or an instrument script? If its an instrument script it could be changed per instrument and per midi channel, which would be cool. However since most instruments theses days have their own scripts, I wonder if that could potentially interfere with them? If so, I guess a macro script would be in order, however I'm unsure how one would go about making it only work per instrument channel? I guess it could work on all and I only load these instruments into their own Kontakt instance. I see how this is already getting more complicated than I originally thought! 

Again, thank you for the post Bob! I really do appreciate your thoughts and expertise! [/quote]


----------



## A.G (Sep 10, 2014)

> So for example I can set it to effect midi CC 85, and from 0-10 = C7, 11-20 = C#7, 21-30 = D7, 31-40 = D#7, etc.


It can be done in the KSP easily. As far as I see you want to use same CC# (85) value ranges mapped to target KS. If you plan to use a single hardware Slider, Fader or Knob ranges to trigger those values - I guess it will be hard.
You have to use so called "One Shot" CC assignments:
1. For example if you want to trigger KS 60 (C3) you can assign a direct CC60 (any value).
2. You can use a single CC# (say 85) and assign "One Shot" hardware buttons set to fixed Button range (Min/Max, MSB/LSB or what else) Values. I.e if you need C7 you can assign a button to CC85, Min/Max range=108, if need C#7 (CC85, Min/Max=86) etc. You can transform such CC "One Shot" assignments into KS direct numbers in the KSP easily.

Regarding the KS Note ON/OFF messages. The direct CC# will be transformed into KS Note ON (you can ignore that Note ID to behave as a silent KS). After that you have to produce a delayed Note OFF message coming with say 200-300Ms delay. This delay time is quite enough for articulation switching.


----------



## JT3_Jon (Sep 10, 2014)

EXACTLY! I already use these "one shot" buttons on my keyboard controller for VSL VI (i.e. button one is midi CC 85 @ 10, button 2 is midi CC85 @ 20, etc) and this works great for VSL VI. I'm really just trying to replicate this functionality for those rare Kontakt libs that dont let you reassign key switches and instead they are hardwired to specific keys.


----------



## A.G (Sep 10, 2014)

JT3_Jon @ Wed Sep 10 said:


> EXACTLY! I already use these "one shot" buttons on my keyboard controller for VSL VI (i.e. button one is midi CC 85 @ 10, button 2 is midi CC85 @ 20, etc) and this works great for VSL VI.



Those values 10, 20 etc of a Fixed CC# can be mapped to a KS# as well in the KSP - it's a matter of UI design and simple programing. The question is:
1. Are you a KSP programer who is looking for a solution.
2. You are not a KSP programer and you want to hire someone to make a custom script according to your requirements. If yes contact or PM the guys here.


----------



## JT3_Jon (Sep 10, 2014)

I was just curious if a solution already existed. If not (and it sounds like it doesn't) I'll just reprogram my midi controller for this particular instrument and be done with it. No need for a custom script just for me.


----------



## Big Bob (Sep 10, 2014)

> I'm really just trying to replicate this functionality for those rare Kontakt libs that dont let you reassign key switches and instead they are hardwired to specific keys.



Since you mention that your problem exists for instruments that do not allow changing the keyswitch mapping, does that mean you do have enough unused keys to handle the keyswitching but they are just not the fixed keyswitches required by the library?

If so, I'll just mention that K5 has a factory multi-script that can remap 24 midi notes to any other 24 midi notes you choose. You might be able to press this into service to work around your problem.

Regarding mapping CC events to notes, I suggested doing it with a multi-script because if you do it with an instrument script you probably will have to put it in the first script slot which may or may not be available to you with the library in question. I'll also mention that custom multiscripts can easily stipulate which midi channel or channels they will operate on so that isn't a problem.

Now, regarding your 'one shot' buttons, precisely what midi event or series of events are generated when you hit one of those buttons? For example, if you have the button programmed to generate a CC85 value of 50 and let's say that the last generated value for CC85 was already 50, what happens when you hit the button. Does it do nothing or does it always (even redundantly) generate a CC85 event with a value of 50? So, if you press this button say 3 times in a row, will it generate 3 CC85 messages each with the same value?

Rejoice,

Bob


----------



## OLB (Sep 11, 2014)

Hi Jon, 

I was in the same position as you last year. I wanted to control the keyswitches with CC's for instant triggering the articulation (and not having to go back to the note to trigger the articulation). I couldn't find any script so with almost no knowledge of Kontakt scripting I made a little custom one that does this. It works!

Choose the incoming CC controller, then you have 16 values that you can assign to a midi note. Also I've added the option to assign the velocity of that note. For example, Cinematic Strings has this functionally that you trigger a different setting when pressed soft or hard.

Theoretically you can have 5 multiscripts in a Kontakt instance, that means 80 articulations/notes if you're going wild 
I also use it sometimes to trigger an articulation with the sustain pedal. Having Spitfire's ostinatum triggered when pressed f.e. Just assign it to CC64 with value 127 and 0. 
It doesn't have a learn function but it does show you the note your playing on the keyboard.

If you're interested send me a PM and I'm happy to email you the script. 

Lennert


----------



## Big Bob (Sep 11, 2014)

Hey Jon,

There you go :D It looks like OLB has already written a script almost exactly like you want except maybe you might like to add a MIDI channel filter to it. Maybe he could add that for you if you ask him nicely :lol: 

Rejoice,

Bob


----------



## JT3_Jon (Sep 11, 2014)

WOW! Awesome guys! This looks great! Thank you all very much!! Its very much appreciated!!! You guys are awesome!!


----------



## wonshu (Sep 11, 2014)

Hi Lennert,

would you mind sharing it here?

Best,
Hans


----------



## Big Bob (Sep 12, 2014)

I think this might be a generally useful script for my toolbox so I'm going to generate something similar. But, I think I will add a MIDI channel filter and learning buttons.

I think I'll write both a multi-script and instrument script version to cover both possibilities. 

Since I'm going to do this in my 'spare' time, :lol: it may take a few days but when I get it finished, I'll post it for anyone that might be interested in it.

Rejoice,

Bob


----------



## wonshu (Sep 12, 2014)

Very generous!!

Thank you!


----------



## Big Bob (Sep 16, 2014)

I have just finished the CC to KeySw Converter scripts and I posted a link to them in a new thread. For those who might still be following this thread, here is the new link:

http://www.vi-control.net/forum/viewtop ... 30cacc3f1c

Rejoice,

Bob


----------

