# Insert convolution problem (with code)



## voltaic (Nov 23, 2008)

Hi there,

I'm (a newbie and I'm) trying to control the convolution parameters (insert, slot 0) but it seems that the ON/OFF and the EFFECT_GAIN don't work. The following code is extracted from this one :
http://vi-control.net/forum/viewtopic.p ... onvolution The strange thing is that I can control the other parameters without problems. Some suggestion?

Thanks,
Marco

----------------------------------

on init
declare const $SLOT := 0

declare ui_knob $IR_output (0,1000000,1)
declare ui_button $reverb_on_off
declare !on_off_text[2]

!on_off_text[0] := "Reverb OFF"
!on_off_text[1] := "Reverb ON"

set_text($reverb_on_off, !on_off_text[$reverb_on_off])
set_text ($IR_output, "Amount")

set_knob_unit ($IR_output,$KNOB_UNIT_DB)
set_knob_defval ($IR_output, 397000)

move_control ($IR_output,2,1)
move_control ($reverb_on_off,1,1)

make_persistent ($IR_output)
make_persistent ($reverb_on_off)

$reverb_on_off :=1
$IR_output := 397000 

_set_engine_par($ENGINE_PAR_INSERT_EFFECT_OUTPUT_GAIN, $IR_output, -1, $SLOT, 1)
set_knob_label($IR_output, _get_engine_par_disp($ENGINE_PAR_INSERT_EFFECT_OUTPUT_GAIN, -1, $SLOT, 1))

end on


on ui_control ($reverb_on_off)
set_text($reverb_on_off, !on_off_text[$reverb_on_off])
_set_engine_par($ENGINE_PAR_EFFECT_BYPASS, 1 - $reverb_on_off, -1, $SLOT, 1)
end on

on ui_control ($IR_output)
_set_engine_par($ENGINE_PAR_INSERT_EFFECT_OUTPUT_GAIN, $IR_output, -1, $SLOT, 1)
set_knob_label($IR_output, _get_engine_par_disp($ENGINE_PAR_INSERT_EFFECT_OUTPUT_GAIN, -1, $SLOT, 1))
end on

--------------------------


----------



## kotori (Nov 23, 2008)

Hi Marco,

There is a GUI bug in some versions of Kontakt which causes the bypass button to not update visually although the state set by the script affects what you actually hear.

Strange about the $ENGINE_PAR_INSERT_EFFECT_OUTPUT_GAIN. Have you also tried $ENGINE_PAR_SEND_EFFECT_DRY_LEVEL and $ENGINE_PAR_SEND_EFFECT_DRY_LEVEL? (yes, I know it's loaded as an insert effect, but trying never hurts...)

Nils


----------



## voltaic (Nov 23, 2008)

Hi Nils,

thanks thanks thanks  I've tryied by using $ENGINE_PAR_SEND_EFFECT_DRY_LEVEL and it works! In any case it's a bit strange..I hope that this bug will not cause some crashes. :roll: Thanks again

Marco


----------



## gmet (Nov 24, 2008)

Guys,

I found out about this strange anomaly (using $ENGINE_PAR_SEND for inserts) when I wrote the script you refer to at the top of the page. One of those wonderful undocumented bug type KSP things!!

Justin


----------



## voltaic (Dec 1, 2008)

*Re: Insert convolution problem V2 (with code)*

Hi there,

I've nearly completed my first script and I have a final problem with the convolution parameters. With an empty convolution FX everything work fine (I can send / receive the knob values) but when I load an IR sample the values are transmitted badly. It seems that my knobs send the values with a long delay. For example, I move my ER_size knob to 50% and Kontakt shows different values (like a slow slot machine) and set itself to a different value.

I've tried by placing the convolution in insert and send slot and with 2 different versions of kontakt, I've loaded a 16/24 bit sample..but the result is the same. The strange thing is that the sole knob that is not affected by this problem is my Dry knob. Nils suggested me to use $ENGINE_PAR_SEND_EFFECT_DRY_LEVEL instead of $ENGINE_PAR_INSERT_EFFECT_OUTPUT_GAIN even if I was placing the convolution FX in an insert slot. This is my code...I sincerely hope that I'm mistaking and that it's not another bug..some suggestions?

Thanks,
Marco

---------------- insert convolution version

on init

declare const $SLOT := 0

declare ui_knob $LR_size (0,1000000,1)
set_text ($LR_size, "Early Size")

set_knob_unit ($LR_size,$KNOB_UNIT_PERCENT)
set_knob_defval ($LR_size, 630859)

move_control ($LR_size,3,3)
make_persistent ($LR_size)


$LR_size := _get_engine_par ($ENGINE_PAR_IRC_LENGTH_RATIO_LR,-1,$SLOT,1)

set_knob_label($LR_size, _get_engine_par_disp($ENGINE_PAR_IRC_LENGTH_RATIO_LR,-1,$SLOT,1))
_set_engine_par($ENGINE_PAR_IRC_LENGTH_RATIO_LR, $LR_size,-1,$SLOT,1)

end on 


on ui_control ($LR_size)
_set_engine_par($ENGINE_PAR_IRC_LENGTH_RATIO_LR, $LR_size,-1,$SLOT,1)
set_knob_label($LR_size, _get_engine_par_disp($ENGINE_PAR_IRC_LENGTH_RATIO_LR,-1,$SLOT,1))
end on

----------------


----------



## voltaic (Dec 1, 2008)

*Re: Insert convolution problem (with code) - SOLVED*

SOLVED: the problem was caused by a folder conflict in my kontakt library.

Marco


----------



## Nickie Fønshauge (Dec 5, 2008)

*Re: Insert convolution problem (with code) - SOLVED*



voltaic @ 1st December 2008 said:


> SOLVED: the problem was caused by a folder conflict in my kontakt library.
> 
> Marco


Solved how? When I try your script in both K2.2.4 and K3 I get the same lagging behaviour, you report. It seems to stem from a slow update of the wave graphics, even when the convolution FX is not visible.


----------



## voltaic (Dec 6, 2008)

Hi Nickie,

In effect I've not solved the problem because I think my code has not a problem. I mean that this slow update of the UR sample occurs only with long IR samples (<4 sec). I've tried with short impulses and the code works fine. Considering that I'm using a not so recent CPU, I'm not able to understand if this slow update is caused by my machine or by the Kontakt engine. I'm using an AMD 3500+ CPU..your one?

Marco


----------



## Nickie Fønshauge (Dec 6, 2008)

Hi Marco,

My CPU is a Core 2 Duo 2.14 GHz; not the fastest, but not exactly slow either. You seem to be right, that the larger the IR the bigger the lag. This would be consistent with the GUI slowdown caused by large scripts.

A workaround could be the following code; it is not perfect, only better.

*on init* 

*declare* *const* $SLOT := 0 
*declare* *const* $knob_smoothing := 200000

*declare* ui_knob $LR_size (0,1000000,1) 
set_text ($LR_size, "Early Size") 
*declare* $temp_LR_size

set_knob_unit ($LR_size,$KNOB_UNIT_PERCENT) 
set_knob_defval ($LR_size, 630859) 

move_control ($LR_size,3,3) 
make_persistent ($LR_size) 


$LR_size := _get_engine_par ($ENGINE_PAR_IRC_LENGTH_RATIO_LR,-1,$SLOT,1) 

set_knob_label($LR_size, _get_engine_par_disp($ENGINE_PAR_IRC_LENGTH_RATIO_LR,-1,$SLOT,1)) 
_set_engine_par($ENGINE_PAR_IRC_LENGTH_RATIO_LR, $LR_size,-1,$SLOT,1) 

*end on* 


*on ui_control* ($LR_size) 
``$temp_LR_size := $LR_size
``wait($knob_smoothing)
``*while* $temp_LR_size # $LR_size
````$temp_LR_size := $LR_size
````wait($knob_smoothing)
``*end while*
``_set_engine_par($ENGINE_PAR_IRC_LENGTH_RATIO_LR, $LR_size,-1,$SLOT,1) 
``wait($knob_smoothing)
``set_knob_label($LR_size, _get_engine_par_disp($ENGINE_PAR_IRC_LENGTH_RATIO_LR,-1,$SLOT,1)) 
*end on*


----------

