KSP: setting the note length for a delayed note


#1

Hi Folks,
I am still pretty new to scripting in Kontakt and I am creating a custom delay with my own samples at the moment.I want the delay lines to be as long as the played note but can´t get it to work.
I tried:

on note

~real_par_time := int_to_real($k_par_time)*2.5
$int_par_time :=real_to_int(~real_par_time)
disallow_group($ALL_GROUPS)
ignore_event ($EVENT_ID)
wait ($int_par_time)
allow_group (0)
play_note ($EVENT_NOTE, $EVENT_VELOCITY,0,0)
wait (mf_get_event_par($EVENT_NOTE,$EVENT_PAR_NOTE_LENGTH))
note_off ($EVENT_ID)

end on

AND

on note

~real_par_time := int_to_real($k_par_time)*2.5
$int_par_time :=real_to_int(~real_par_time)
disallow_group($ALL_GROUPS)
ignore_event ($EVENT_ID)
wait ($int_par_time)
allow_group (0)
play_note ($EVENT_NOTE, $EVENT_VELOCITY,0,mf_get_event_par($EVENT_NOTE,$EVENT_PAR_NOTE_LENGTH))

end on

But both seem to play the whole sample or just… much longer as expected and there is no further
explanation in the manual how

$EVENT_PAR_NOTE_LENGTH)

works.

Thanks in advance!

Stay tuned
Max