What's new

Kontakt stucks on loading own scripted instrument

Janos McKennitt

New Member
At the moment I am scripting an own instrument and I am - more or less - finished with it. Now: Everytime I load my DAW projects (where I used multiple instances of this instrument) Cubase/Kontakt stucks on loading these instances and I can't access the project.
Sometimes I also get memory corruption errors (but not everytime).

It works quite well when loading the instrument in a clean project or in Kontakt standalone. It happens just when I load existing projects. Fun thing is: when I first load a clean project and open my library there and afterwards load my problem-projects - they load without any problem. Like it has to be loaded one time into RAM to get over some kind of hurdle.

I'm pretty sure it relies on a mistake in the script (duh!). Maybe it happens when recalling the last state of the instances. Did I get it right to:
- "make persistent" every button/knob/variable I want to be stored after closing Kontakt (at the end of the ICB), then
- read it and
- adjust the button/sliders, etc. to get the state when recalling it.

For example:
on init
{all the declarations and stuff here}

  make_persistent($Rev_slider)  {Reverb send - slider}
  make_persistent($Dist_slider)  {Distortion amount - slider}

 set_engine_par($ENGINE_PAR_SENDLEVEL_1, $Rev_slider, -1, 7, 0)
 set_engine_par($ENGINE_PAR_SK_DRIVE, $Dist_slider, -1, 3, 1)
end on
Does anyone have an idea or does this behaviour sounds familiar? I can provide the instrument and the script, but I thought before I post a lot of code lines maybe it is possible to narrow down the problem. I'm using Cubase 10 and Kontakt 5.8.1 btw.


Active Member
Probably not the cause, however I noticed two opening brackets in the following line:


Maybe it is your antivirus; add an exception for all Kontakt files (i.e. NKI, NKM etc) as well as the program itself.
Janos McKennitt

Janos McKennitt

New Member
Thanks for your posts. After hours I found my (stupid) mistake: I put in the set_engine_pars for the envelopes twice when recalling the states. Don't know why I didn't saw this earlier. And I made sure that every set_engine_par is definitely in the end. I can't say why but this did the trick. But thanks for your replies!
Top Bottom