# How to automate decay in K3?



## hbuus (Jan 17, 2010)

Let's say you have a string patch loaded in K3, which has a default decay value of 600 ms.
Now you'd like to change this value to 1.2k with automation.
How do you do this?

In K3, I have assigned 'CC #18' as source and 'decay' as destination.
But then in Cubase, I need to determine which value of CC #18 I want to send to Kontakt - value can go from 0 to 127.

Isn't there a way of making Cubase simply 'tell' Kontakt: "Please change decay value to 1.2k"?

Henrik


----------



## gmet (Jan 17, 2010)

Here you go:



> *on init*
> ``*declare* ui_knob $Decay (0,1000000,1)
> ``set_text($Decay, "Decay")
> ``set_knob_defval ($Decay,630000)
> ...



If you look at the numbers at the bottom left of K3 when you move the knob this will give you the values you need to enter should you want to change them.

Justin


----------



## hbuus (Jan 17, 2010)

Thanks, Justin. The script won't compile, however; not inside Kontakt 3's editor, nor in Nils' KScript Editor.

Is this the entire script, I mean, there are no missing lines or something?

Henrik


----------



## gmet (Jan 17, 2010)

Henrik,

When I post a script on the webpage it adds a ' character where there are spaces (indents). You have to remove these ' characters before compiling.

Justin


----------



## hbuus (Jan 17, 2010)

Ah! It compiles and works now, thanks. The script adds a button and a "dial".

But whenever I choose a decay value with the dial GUI, the value in the bottom left corner of K3 is very high.
For example when decay is set to 600.0 ms, in the bottom left corner it says: Decay = 604980
What does this number mean?
I thought the script would return a value between 0 and 127 which you could then use in Cubase automation.

Btw. it's very cool that it's possible to make this kind of stuff in Kontakt with scripting!
Perhaps I should look into how to code scripts.
I have experience coding C and C++, so I am familiar with programming.

Henrik


----------



## hbuus (Jan 17, 2010)

Ok!

In Kontakt I have set up modulation on a patch like this:

Source = CC #18
Destination = decay parameter

Thus whenever CC #18 is sent from Cubase to Kontakt, the value of the decay parameter will be changed according to the value of CC #18 (0-127, of course)

If I want the decay parameter changed only a little bit, I can send CC #18 with for example value 10.
If I want the decay parameter changed a lot, I can send CC #18 with for example value 112.

So far, so good. Or rather, not really! Because this is the problem:
You can't manipulate the decay parameter directly via automation in Cubase; you HAVE to go through the source/destination stuff.

But if I send CC #18 with a value of for example 10 to Kontakt, what will the decay parameter end up becoming?
Similarly, if I want to change the decay parameter of the selected patch to for example 600 ms, which CC #18 value (0-127) should I then send to Kontakt from Cubase?

There's just no way of knowing!

Add to this that there is an intensity slider in Kontakt which can be set from 0 to 100%......

Does it make sense what I have tried to explain here??

Henrik


----------



## Tod (Jan 17, 2010)

You could experiment by sending a few cc18 values from your DAW until you find the values your looking for. For instance, put in a cc18 from 1 to 127 and space them a quarter note apart about 60-BPM. Then as you play this watch the values on the release. 

The intensity slider adjusts the minimum output for a controller. For example useing cc11, with the intensity set at 50% and cc11 = 0 the output is -6db but if the itensity is at 100% and cc11 = 0 the output will be a -INF. At least in K2. What it does with the ahdsr envelope I don't know but I would just leave that a 100%.

If you're a c++ programer script writeing should be a breeze.


----------



## gmet (Jan 17, 2010)

Ok, I think I know what you mean; try this one:



> *on init*
> ``*declare* ui_knob $Decay (0,1000000,1)
> ``set_text($Decay, "Decay")
> ``set_knob_defval ($Decay,630000)
> ...



When you move the knob you will see the corresponding CC value in the bottom left (as Tod suggested) and know what to program in Cubase. I must admit I don't really understand what you mean by source and destination; all you have to do is send the appropriate value on CC#18.

Justin


----------



## MozillaUser (Jan 24, 2010)

Sorry if I "steal the topic", but I have a question wich is somehow related. Maybe someone in the know can enlighten me, it will spare me some experimenting time and it will be deeply appreciated.
Suppose I want to automate the decay time, or any other time of the flex. envelope. I set "per hand" the decay time to, say, 2 sec. Now I set this parameter to be modulated by, say, CC 88. So when I send a CC88 with the value of 127, I will have 2 sec decay. Question is: is the law linear? If I send a CC 88 with a half-value, say 64, will the decay time be 1 sec?

TIA
Mozil


----------



## gmet (Jan 24, 2010)

Mozil,

No it is not linear; here is the script for CC88. Move the controller or dial and read the CC value at the bottom left of Kontakt to get the value you need for each setting. This script will work for any of the envelope parameters; just set up new dials and CCs for each engine parameter:



> *on init*
> ``*declare* ui_knob $Decay (0,1000000,1)
> ``set_text($Decay, "Decay")
> ``set_knob_defval ($Decay,630000)
> ...


----------



## MozillaUser (Jan 24, 2010)

Thanks. Justin. Your da man!
best--
Mozil


----------



## hbuus (Jan 24, 2010)

Tod & Justin:

I'm having trouble getting automation to work at all between Cubase 4.5.2 and Kontakt 3/Sonivox. That's why I suddenly became quiet in this thread 

I'll look some more at it this week probably.

Thanks for your help and suggestions.

Henrik


----------



## hbuus (Feb 4, 2010)

Finally got a chance to test this:



Justin M @ Sun Jan 17 said:


> Ok, I think I know what you mean; try this one:
> 
> 
> 
> ...



This is exactly what I needed!
Appreciate the time and effort you put into this, Justin - thanks.

Best,
Henrik


----------



## gmet (Feb 4, 2010)

Henrik,

You're welcome.

Justin


----------

