# Controlling "named" modulator 'amounts' from within a script



## Thonex (Oct 25, 2010)

Hi Gang,

For the life of me... I can't figure this out. 

Say I'd like to assign 2 different modulation amount sliders to the *same* single LFO Mod source: *LFO (rectangle)*. I know you can assign _different_ modulators and by naming the actual modulator, you can use the "find_mod" command to control the slider (amount) within a scrip. But I want to have access to multiple modulation amounts to the same "existing" modulator... which you can do (see below).... but you can't rename the same source Modulator with different "amount" names. 

*HOWEVER*, while snooping around, I found you can actually re-name the modulator's "amount" modules -- with the script editor open, you can right-click on the "LFO (rectangular)" name and assign a name to that module (thanks Benjamin for showing this to me!!). I named them "test_1" and "test_2"... but you can only see the renamed field of "test_2" below.

Does anyone know how to access these modules and control the "amount" sliders from within a script using the find_mod (for test_1 and test_2) as shown shown below? Remember, these sliders control the SAME modulator (this is important) and therefore are assigned to the same modulator (LFO -- Rectangular).

Just for clarity's sake, were talking about 2 "amount" modules (shown below) controlling a single LFO (rectangle) modulator (not shown below). 

Thanks for any help.

Cheers,

Andrew K


----------



## polypx (Oct 25, 2010)

Andrew, 

I don't have an example in front of me, but to do this you need to combine find_mod AND find_target.

The mod will be the same for both, but the target will be different. 

Also, whenever you add a new modulator, Kontakt occasionally resets the names of ones you've manually named earlier. Watch out for this bug.

cheers
Dan

*EDIT*

something like this:
set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,$my_slider,$group_number,find_mod($group_number,"LFO-Rectangle"),find_target($group_number, find_mod($group_number,"LFO-Rectangle"), "test_2"))


----------



## EvilDragon (Oct 25, 2010)

You can check out the example NKI (v4.1.1) from here: http://www.mediafire.com/?v2xk0yf5i2a8eet


It's a sausage of code needed to approach it by name, whereas it would've been MUCH more useful if Kontakt simply had a "debug" mode like Reaktor, in which we could just see the IDs of each modulator, modulation amount slot, etc...


Hope this helped!


----------



## polypx (Oct 25, 2010)

> sausage of code



Ha! That's really funny. True, but funny.


----------



## Thonex (Oct 25, 2010)

Thanks guys!!!! :D 

You guys are the best!! 

.... will try it now....




polypx @ Mon Oct 25 said:


> Also, whenever you add a new modulator, Kontakt occasionally resets the names of ones you've manually named earlier. Watch out for this bug.



heh... yeah... I already saw that cute little bug!! Not sure... maybe when you rightclick without the KSP editor open?



EvilDragon @ Mon Oct 25 said:


> You can check out the example NKI (v4.1.1) from here: http://www.mediafire.com/?v2xk0yf5i2a8eet



Thanks Evil!!!

I'm gonna head over there right now... and I love sausage... the kind you buy in the store (get your head out of the gutter :lol: )

Cheers mates!!

Andrew K


----------



## polypx (Oct 25, 2010)

Thanks Mario, I was hoping you'd found a safe method. 

But it seems to happen to me here both if the script editor is open OR closed. If I assign an "existing" LFO, the names go to null.

Dang.


----------



## Dynamitec (Oct 25, 2010)

EvilDragon @ Mon Oct 25 said:


> You can check out the example NKI (v4.1.1) from here: http://www.mediafire.com/?v2xk0yf5i2a8eet
> 
> 
> It's a sausage of code needed to approach it by name, whereas it would've been MUCH more useful if Kontakt simply had a "debug" mode like Reaktor, in which we could just see the IDs of each modulator, modulation amount slot, etc...
> ...



Excellent idea! I'm going to request this one! 

Biggest problem with accessing modulators by name is, that you can't rename modulators of a bunch of groups at once. If you have hundred groups with 4 modulators in them you'll going to have some fun renaming them (sometimes building everything up again from scratch might be faster...


----------



## EvilDragon (Oct 25, 2010)

...and that is exactly why Debug mode would totally rock. 

BTW I think Blake might have already requested that. I know I did talk about the idea with him, too.


----------



## Thonex (Oct 25, 2010)

Yeah... this is buggy as hell!!!!

If you add more then 4 or 5 amount sliders... forget it.

Thanks guys... and thanks Evil... you're example was clean and EXCELLENT!!

Cheers,

Andrew K


----------



## EvilDragon (Oct 25, 2010)

No prob, Andrew, I'm glad I could help in some way! o-[][]-o


----------



## sonaht (Dec 14, 2011)

Hi guys,

Taken from the discussion in this newer thread:

http://www.vi-control.net/forum/viewtopic.php?p=3601914

I wanted to post my reply in here too:

There is a new "under the hood" feature in Kontakt 5.0.1 and if you right click in a modulator (with the Script Edit window open) you now can see the name as well as the group number, id, and generic value for both the modulator and modulation destination. This way you can avoid the find_mod, find_target sausage of a code 

Please see attached pictures:














I also uploaded the script and nki file that Evil Dragon had originally posted on this link(modified to show how to add these numbers in the command

```
set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,$Amount,<group>,fi nd_mod(<group>,"ENV 1"),find_target(<group>,find_mod(<group>,"ENV 1"),"ENV 1 -> PITCH"))
```
 You can download it from here:
http://pinartoprak.com/KSP/Approaching_Modulators_5.0.1.zip (Approaching Modulators 5.0.1.zip) 



Best,
Thanos


----------



## mk282 (Dec 14, 2011)

It would be TONS easier if we didn't need to have the Script Edit window open for that right-click dialog to happen...

Also - even though find_mod()/target() make a sausage, I found that these commands can be really effective when combined with string arrays and some while loops


----------

