What's new

Scipt Help: How to setup a user input defined CC# to control single and multiple modulators and Fx

Casey Edwards

Senior Member
This is my first attempt at scripting with KSP and I'm completely lost. I've been reading Nil's website, Google'ing like crazy, and searching YouTube and I can't figure out how to get started quite yet. I've taken classes on Java programming so I understand how programming works with loops and algorithms and such, but not quite sure how to use KSP yet.

What I'm wanting to do: Give the option to the user on the UI to pick what CC# they want to use for 2 instances.

1) Pick a CC# to control a LP Filter for faux-dynamics
2) Pick a single CC# to control multiple modulators across 3 different groups I've already programmed.

Any help would be greatly appreciated!
 
  • On init
    declare ui_value_edit $CC_LP (<min>,<max>,<stepping>)
    move_control($CC_LP,1,1)

    declare ui_value_edit $CC_Mods (<min>,<max>,<stepping>)
    move_control($CC_Mods,1,2)

    end on

This'll create two value edits on the UI, named CC_LP and CC_Mods. (Don't forget to find out the right values for the minima, maxima and stepping!)
next, via ...

  • on controller
    if($CC_NUM = $CC_LP)
    < Script >
    end if

    if($CC_NUM = $CC_Mods)
    < Script >
    end if
    end on

... you can check controller movement whether it's the same controller as assigned in CC_LP or CC_Mods (not necessary, but keeps the CPU from performing unnecessary tasks if a different controller than CC_LP or CC_Mods is moved). To get the value of the controller, use %CC[$CC_LP] for the Lowpass and %CC[$CC_Mods] for the Modulators' CC.
 
Thanks, Acall! I'm going to cross-reference your script with the KSP manual and see if I can't begin to make sense of how to use this language properly. If you have anything to add to help out feel free and thanks again!
 
Okay, so things are starting to make a little bit more sense after tossing around in the manual with your script. I'm still confused about how to handle the built-in variables, even after reading that section of the manual. Your script seems to be more user defined (which could come in handy later)

Right now I'm going to stick with something easy. I've customized 3 groups of volume controls using a different modulator on each group set to control different tables of volume with CC1. All I want to do in this script is make it to where a user can define in a small text field on the UI their own CC# if they don't want to use CC1. I've done some looking up on how groups and slot numbers start with '0' but not sure where else to go with it. When I right click on the modulator I get name:

CC_VOLUME (group 0, idx: 18, gen: -1)

my understanding from the manual is that this means Group 1, slot 18, and to ignore whether it's an insert or a send. I could be completely wrong.

(broken link removed)
 
You should be acquainted with naming modulators. This will make your scripts more readable, and alleviate the whole mod index confusion because Kontakt can crap out on it more often than not.

Let's say you have one modulator that modulates cutoff frequency of a filter you loaded in some slot. You can then right-click that modulator to rename it (but only if script editor edit mode is open!). Then, you can use this to change modulation amount of that particular modulator (let's say we named it "CC -> CUTOFF"):

set_engine_par($ENGINE_PAR_INTMOD_INTENSITY,$knob,<group index>,find_mod(<group index>,"CC -> CUTOFF"),-1)

This is valid for external modulator amounts. If you have an internal modulator (LFO, envelope, step seq, glide), you have to name both the modulator and modulation intensity strip. In this case, we get a bit of a sausage of a code line to change the modulation amount of that particular destination (let's say we named the modulator "LFO 1" and modulation amount "LFO 1 -> CUTOFF"):

set_engine_par($ENGINE_PAR_INTMOD_INTENSITY,$knob,<group index>,find_mod(<group index>,"LFO 1"),find_target(<group index>,find_mod(<group index>,"LFO 1"),"LFO 1 -> CUTOFF"))


I suggest you use "Constant" modulators for what you want to do, so that you don't have to waste CCs when you redirect one user selectable CC to whatever CC you've used to modulate whatever you wanted to be modulated.
 
Also, when you use $ENGINE_PAR_INTMOD_INTENSITY, and a knob with range 0 to 1000000, you will cover full modulation range from -100% to 100%, 0% being at 500000. If you use $ENGINE_PAR_MOD_TARGET_INTENSITY, you will have only the positive modulation amount range (0 to 100%).

I recommend using the former method.
 
Hey guys, I really appreciate the help. I definitely think I may be jumping the gun a little bit. I've found some very useful websites with some cool info that really breaks down a lot of the steps (which is something I need before I can begin to really break into things) and it's helping. Also, both of your suggestions have me looking into the KSP manual in the right places so I really appreciate that!

I think for now I need to learn to do basic coding with KSP and possibly just pay someone to do this for me for now. I know what I want to do, just not sure how to use KSP language to do so yet. How much would this cost? I have a feeling it would be less than an hours worth of coding it's so simple.

To me it looks like it should work like this since I've used the table editor in all my modulators to follow a custom pattern from 0 to 127 in each group differently but with single CC#'s due to the nature of how the patch works:

declare customCCmod
declare customCCfauxdyn

find all internal modulators I've setup across all groups and tell them to react to the user defined CC# chosen on the UI. (a la Sample Modeling, like how they can choose CC14 for growl or type in a different # when they please directly on the UI). It really seems like it should be that easy...but alas, I wouldn't know quite yet.

You guys are giving great detailed info, but honestly, I think until I see finished code to study I'm still going to be scratching my head unless I find a extremely detailed break down of what I'm looking for. Until then I'm just going to keep studying until I have that "light-bulb moment" where everything seems to start making sense.
 
As long as you're not planning to do any commercial work with the script - or anybody else reading this thread - I'm fine with helping you out like this. But I also know that others here are more dependant on making money with their scripts than me. mk282? Raptor?
 
As long as you're not planning to do any commercial work with the script - or anybody else reading this thread - I'm fine with helping you out like this. But I also know that others here are more dependant on making money with their scripts than me. mk282? Raptor?

I don't plan on selling these patches, but I do plan on using them for gigs because these patches are designed for a gap in the commercial market place I've never seen touched, and that is controllable aleatoric patches based on actual chance rather than just one-off stingers, risers, and such. I'm working on RR stabs and other things, but my main focus is realizing how I can fill in this gap for future gigs. I want to keep it private simply because I know of only one other composer who has this, and he said his ability to be 'that guy' for quick turnovers in that side of the genre has been a big selling point for his clients and a great investment. Cinesamples' CineBrass Pro is the only commercial library that I've seen touch this with their trombone split fx patch that controls the deviation with the MW. Right now I'm just in the alpha stages of creating patches and editing the audio files, but I've had some great results so far that I could see going a long way.
 
...that is controllable aleatoric patches based on actual chance rather than just one-off stingers, risers, and such. I'm working on RR stabs and other things, but my main focus is realizing how I can fill in this gap for future gigs..

There´s a language/intellectual barrier keeping me from understanding what you wrote. :)

What is controllable aleatoric patches based on actual chance? Fx patches with round robin?

Just had to ask this.
 
Top Bottom