# Intensity of LFOs



## jesusginard (Jan 9, 2014)

Hi there, 

I'm fighting with my script trying to control the amount of vibrato of a trumpet. 
I've set 1 multi sine lfo, 1 controls the pitch and the other controls the volume. I want a slider in the GUI to control the amount of vibrato, the intensity of the LFO. 
I'm stuck with the find_mod and find_target, I don't understand them. 

Can you give me an advice?


----------



## d.healey (Jan 9, 2014)

```
set_engine_par(ENGINE_PAR_MOD_TARGET_INTENSITY, value, group, find_mod(group, "CC_PITCH"), -1)
```

I use something like this, you'll need to include the name of the modulator - where I've put CC_PITCH. To find the name of the modulator make sure you have the script editor open (click the edit button) and then right click on the modulator intensity slider area - but not on the slider itself or the other controls, just an empty bit - and the name will be displayed.

Where I've put value put the intensity value you want, and where I've put group put the number of the group you want to affect


----------



## jesusginard (Jan 9, 2014)

Hey, thanks!
Unfortunately I'm getting a "expression expected"... I don't know why, I replaced everything: 


```
set_engine_par(ENGINE_PAR_MOD_TARGET_INTENSITY, $knob, -1, find_mod(-1, "vibrato"), -1)
```


----------



## Blackster (Jan 9, 2014)

Well, you DID declare all variables, right? It is obvious why this line does not work because everything is interpreted as strings, not expressions. 

set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY, $knob, -1, find_mod(-1, "vibrato"), -1)

And you were missing a "$" in front of ENGINE_PAR...


----------



## mk282 (Jan 9, 2014)

For LFO intensity (say, LFO was assigned to pitch and you want to adjust the modulation destination depth slider) that won't work, you need to use:


```
set_engine_par($ENGINE_PAR_INTMOD_INTENSITY,$knob,<group_id>,find_mod(<group_id>,"LFO NAME"),find_target(<group_id>,find_mod(<group_id>,"LFO NAME"),"TARGET NAME"))
```

So, in this case:





It would be:


```
set_engine_par($ENGINE_PAR_INTMOD_INTENSITY,$knob,0,find_mod(0,"LFO 1"),find_target(0,find_mod(0,"LFO 1"),"LFO 1 -> PITCH"))
```


----------



## jesusginard (Jan 10, 2014)

I'll tell you what I do exactly. 

I want to have a CC that controls the amount of vibrato. 

1. I select all groups using the "edit all groups" button. 
2. I apply an LFO to the tune knob in the source module. 
3. I change the name of the LFO to "vibrato", and the other name on the Modulation tab on the bottom for "vibrato" too. 
4. I have created a value edit where I can choose the CC that I want to control vibrato with. This is called $cc_vibrato.
5. I add this script: 


```
on controller
    if(%CC_TOUCHED[$cc_vibrato] = 1)
	  set_engine_par($ENGINE_PAR_INTMOD_INTENSITY,%CC[$cc_vibrato],-1,find_mod(-1,"vibrato"),find_target(-1,find_mod(-1,"vibrato"),"vibrato -> PITCH"))
    end if
end on
```

I get the error: object vibrato -> PITCH not found. 

I don't understand why this doesn't work.


----------



## mk282 (Jan 10, 2014)

You cannot use -1 for group index. 0 is group 1, 1 is group 2, etc. If you want to change LFO amount across multiple groups, you have to use a while loop.

Also, if this is in Kontakt 4, you cannot rename modulators across multiple groups when Edit All Groups is enabled - you have to go one by one group to do it!

You cannot use the CC the way you showed here. This function needs values from 0 to 1000000, 500000 being 0%.


You don't seem to be understanding KSP much... ~o) But there is a clear example on how to deal with modulator intensity on page 125 of K4 KSP Reference, or page 130 of K5 KSP Reference.


----------



## jesusginard (Jan 10, 2014)

mk282 @ Fri Jan 10 said:


> You cannot use -1 for group index. 0 is group 1, 1 is group 2, etc. If you want to change LFO amount across multiple groups, you have to use a while loop.
> 
> Also, if this is in Kontakt 4, you cannot rename modulators across multiple groups when Edit All Groups is enabled - you have to go one by one group to do it!
> 
> You cannot use the CC the way you showed here. This function needs values from 0 to 1000000, 500000 being 0%.



Yes, I know, that CC value has to be multiplied. 

So I would have to do a while loop to change the intensity of each group individually. I'll try that right now, thanks!


----------



## jesusginard (Jan 10, 2014)

Thanks mk282! Worked perfectly now!

Here is the code that I ended up using: 


```
on controller
    if(%CC_TOUCHED[$cc_vibrato] = 1)
		$i := 0 
		while($i < $NUM_GROUPS)
			set_engine_par($ENGINE_PAR_INTMOD_INTENSITY,500000-%CC[$cc_vibrato]*1000 ,$i,find_mod($i,"VIBRATO"),find_target($i,find_mod($i,"VIBRATO"),"VIBRATO -> PITCH"))
			inc($i)
		end while
    end if
end on
```


----------

