# Play_note with sample offset in release callback



## nlundberg (May 23, 2014)

I can use play_note with no problem in on note callback, but it does not work in on release callback! 

Can it be done, or is sample offset only on note? Everything is set up fine with sample mod settings in Kontakt.

I am on K4 on a mac, using Nils Libergs script editor which works wonderful.

Thanks!


----------



## d.healey (May 24, 2014)

Yea you can use it in the release callback, but you need to disable Kontakt's release trigger handling.

Place this in your on init callback - SET_CONDITION(NO_SYS_SCRIPT_RLS_TRIG) {Disable Kontakt Release Triggers}

and this at the top of the on note callback
reset_rls_trig_counter($EVENT_NOTE) {Reset release trigger timer}


----------



## nlundberg (May 24, 2014)

Awesome, thanks a lot.


----------



## nlundberg (Aug 28, 2014)

I got this weird problem, double trig of the release.

I can retrieve and (fade out) one, but there is another one still in there.

init callback - SET_CONDITION(NO_SYS_SCRIPT_RLS_TRIG)
and
on note - reset_rls_trig_counter($EVENT_NOTE)
are in place.

??? It got to be an easy fix, plz help.

By the way, why is reset_rls_trig_counter() needed?


----------



## mk282 (Aug 28, 2014)

It's not absolutely needed for this sole purpose, I would say.


----------



## nlundberg (Aug 28, 2014)

Add on: Maybe it triggers double because I have main groups and also an attack group playing, so the release try to trigger a release for the attack group as well?


----------



## nlundberg (Aug 28, 2014)

The KSP documentation does not explain what it does. When would it be needed?

But I rather save your fingers from explaining that and have some advice on removing double triggers of release callback.


----------



## mk282 (Aug 28, 2014)

nlundberg @ 28.8.2014 said:


> Add on: Maybe it triggers double because I have main groups and also an attack group playing, so the release try to trigger a release for the attack group as well?



This is very likely. You should use allow_group() and disallow_group() to select which groups are going to be played in the note callback and the release callback.


----------



## d.healey (Aug 28, 2014)

nlundberg @ Thu Aug 28 said:


> By the way, why is reset_rls_trig_counter() needed?



This link should provide the information you need.
http://www.vi-control.net/forum/viewtop ... ase+sample


----------



## nlundberg (Aug 28, 2014)

---


----------



## nlundberg (Aug 28, 2014)

I think the reason might be that the. system release function is still triggering. But the group is no set to release trigger. It got stuck. 
And thanks for the thread link regarding
rel trig counter. I'll leave it in there as Bob says.


----------



## nlundberg (Sep 13, 2014)

I just want to submit that I solved this, in case anyone else has the same problem.

play_note in the release callback triggers the release callback again. To solve this I had to set some conditions in the release callback to not allow play_note on the second call.

I was trying to to make the second release callback not to happen at all, but I think this is impossible.


----------

