# Kontakt Release Trigger



## guranbanan (Dec 21, 2014)

Hi!

I have a problem with Kontakt's release trigger. If I have a group containing release samples and activates it using the "release trigger" button in the group editor Kontakt triggers the samples whenever the note stops - not actually when I release the key. So, for instance, when using the sustain pedal the release samples won't play until the pedal is released (and thus stopping the notes). Exactly the opposite of a real piano - on which you hear the key noise when letting go of the key and not when you release the pedal. The same thing happens if you, in the script editor, set the notes to play for a certain amount of time (using play_note). The release samples get activated when the notes stop - not when I release the key.

I thought I might work around this by triggering the release samples using script instead. The problem with this is that now the samples get triggered when I release the keys AND whenever the notes stop.

Is there a way to make sure the samples only get triggered on an actual key release?


----------



## Luca Capozzi (Dec 22, 2014)

if you're scripting the release samples behavior, disable the release trigger of their group and do everything via script.


----------



## guranbanan (Dec 22, 2014)

Thanks, but the problem remains. I deactivated the "release trigger" button in the group settings but still, Kontakt decides to trigger samples both when the notes stop and when releasing the key. (Except for when using the sustain pedal, strangely. Then it triggers samples only when I release the key and not when releasing the pedal - but - it triggers two voices at the same time!)

This is what my release callback looks like:


```
on release
disallow_group($ALL_GROUPS)
allow_group(1)
play_note($EVENT_NOTE,$EVENT_VELOCITY,0,-1)
end on
```

Edit: I would like to add that I've also tried using SET_CONDITION(NO_SYS_SCRIPT_RLS_TRIG) with no success.


----------



## guranbanan (Dec 22, 2014)

I solved it by controlling the note-offs aswell. So in the release callback I call the note-off function on the id corresponding to the key.

Is this really the way it's suppose to work, though?


----------



## ScoringFilm (Dec 22, 2014)

@guranbanan

This best way is to control all events and let the code decide which are the release groups:



> *on init*
> ``SET_CONDITION(NO_SYS_SCRIPT_RLS_TRIG)
> ``*declare* $normal_group _{normal groups}_
> ``*declare* $release_group _{release groups}_
> ...


----------



## guranbanan (Dec 26, 2014)

Hi! Sorry for the late reply. I had to take a break from the scripting, christmas came between 
I still haven't had time to actually test your code but it looks as if the principle is about the same as my "workaround" (probably shouldn't call it that since this behaviour is, as opposed to what I first thought, expected).

Anyway, thanks for the code - I'll be sure to test it and hopefully learn more about the release triggering in Kontakt.

(One thing I have no clue of is the rls_trigger_counter. What does it count? The number of simultaneous release samples or something like that?)


----------

