# Stopping a release note from being triggered?



## Hans Adamson (Sep 6, 2010)

Is there any way to stop a release note from being triggered? The release is Kontakt's own release programming and I want to selectively stop release triggers from a script.

Thanks,
Hans


----------



## gmet (Sep 6, 2010)

Hans,

You can use the info in the following thread to control release groups:

http://www.vi-control.net/forum/viewtop ... ht=#178475

It essentially involves using 'SET_CONDITION(NO_SYS_SCRIPT_RLS_TRIG'

Hope it helps

Justin


----------



## Hans Adamson (Sep 6, 2010)

Thanks Justin,

So I would have to disable Kontakt's release triggering completely and use an all scripted one? There's no trick to stop individual release trigger notes without having to re-write it all?

Thanks


----------



## Hans Adamson (Sep 6, 2010)

I am having a problem with endless loops when using the simplified version. The play_note seems to trigger another release which produces another play_note and so on??:

on init 
SET_CONDITION(NO_SYS_SCRIPT_RLS_TRIG) 
declare $normal_group { normal groups } 
declare $release_group { release groups } 
declare $OFF_ID { release sample ID } 
end on 

on release 
 { activate release groups and deactivate normal groups } 
disallow_group($ALL_GROUPS) 
$release_group := 0 
while ($release_group <= $NUM_GROUPS-1) 
if (_get_engine_par($ENGINE_PAR_RELEASE_TRIGGER, $release_group, -1, -1) # 0) 
allow_group($release_group) 
end if 
inc($release_group) 
end while 
 { "manually" trigger release sample with same pitch and velocity as original event }  
$OFF_ID := play_note($EVENT_NOTE, $EVENT_VELOCITY, 0, 0) 
end on


----------



## gmet (Sep 7, 2010)

Hans,

Sorry about the delay in replying. I had to go to work!

A couple of points about your script.

You need some reference in the note_on so that the correct release is played. Also don't foget that you need to instruct Kontakt to send a note-off before activating any release sample.

i.e. the line: $OFF_ID := play_note($EVENT_NOTE, $EVENT_VELOCITY, 0, 0) - you should reference the $EVENT_ID, $EVENT_NOTE & $EVENT_VELOCITY at the note_on:

$EVENT_ID = $parent_id
$EVENT_NOTE = $note_no
$EVENT_VELOCITY = $vel

then on_release:

note_off ($EVENT_ID) 
{rest of the script}
if ($EVENT_ID = $parent_id) 
$OFF_ID := play_note($note_no, $vel, 0, 0)

Hope you understand this as I am away from my studio computer (i.e. this is off the top of my head)

Justin


----------



## Hans Adamson (Sep 7, 2010)

Thanks Justin,

I see what you're saying. Will do so. Thanks!

/Hans


----------



## Hans Adamson (Sep 10, 2010)

Justin,

I am still getting endless release trigger loops. I have tried your script and get endless loops also there. I simplified your script to troubleshoot it. Any ideas how to get rid of the endless loops? I am using only the script below:


on init 
SET_CONDITION(NO_SYS_SCRIPT_RLS_TRIG) 
declare $normal_group {normal groups} 
declare $release_group {release groups} 
declare $normal_voice 
declare $release_voice 
declare $parent_id 
declare $Retune {retune by steps} 
declare $Velocity {change velocity} 
declare $new_tuning {retune by cents} 
declare $new_pan {change panning} 
end on 

on note 
$parent_id := $EVENT_ID 

disallow_group($ALL_GROUPS) 
allow_group(0)
allow_group(18) 
allow_group(19) 
allow_group(20) 
allow_group(21) 
ignore_event ($EVENT_ID)
$normal_voice := play_note(64,64,0,0) 
end on 


on release 
note_off ($normal_voice) 
if ($EVENT_ID = $parent_id) 
disallow_group($ALL_GROUPS) 

allow_group(27)
 allow_group(28) 
allow_group(29) 
allow_group(30) 
allow_group(45) 

$release_voice := play_note(64,64,0,0) 
end if
allow_group($ALL_GROUPS) 
end on


----------



## Hans Adamson (Sep 10, 2010)

OK,
Something else is going on. I created a test instrument with only two groups, one "normal" and one release group, and there is no trigger loop then. So the script works with a simple test instrument. (o) 
/Hans


----------



## Hans Adamson (Sep 10, 2010)

The cause for the endless loops seems to be that I had checked round robin on the release groups. Allowing just a single release group cured the problem. Anyone knows more about this problem, please let me know.
/Hans


----------



## Hans Adamson (Sep 10, 2010)

This problem got weirder and weirder, but I think I have gotten to the underlyòg   åý²g   åý³g   åý´g   åýµg   åý¶g   åý·g   åý¸g   åý¹g   åýºg   åý»g   åý¼g   åý½g   åý¾h   åýÅh   åýÆh   åýÇh   åýÈh   åýÉh   åýÊh   åýËh   åýÌh   åýÍh   åýÎh   åýÏh   åýÐh   åýÑh   åýÒh   åýÓh   åýÔh   åýÕh   åýÖh   åý×h   åýØh   åýÙh   åýÚh   åýÛh   åýÜh   åýÝh   åýÞh   åýßh   åýàh   åýáh   åýâh   åýãh   åýäh   åýåh   åýæh   åýçh   åýèh   åýéh   åýêh   åýëh   åýìh   åýíh   åýîh   åýïh   åýðh   åýñh   åýòh   åýóh   åýôh   åýõh   åýöh   åý÷h   åýøi   åýùi   å


----------



## gmet (Sep 11, 2010)

Hi Hans, I was not ignoring you; just in the land of 'counting sheep' - it's the time zone difference.

A few points.
1. Your script example above does not distinguish between normal and release groups.
2. From your explanation it sounds like it is a problem with the way the instrument is setup rather than a script problem.
3. If you still get endless loops you can issue a note off to the release sample after it has triggered:



> fade_out($Group(45),100000,1)
> or
> note_off ($Group(45))



Here is another script that Nils wrote some time back. It displays whether groups are setup as normal or release depending on their prefix/suffix of rls,rt,release etc (which is a good way of naming release groups). I'm sure he won't mind me posting it as I can't find the original thread. I have added a button to the second version to show how you can control (in this case mute) release groups with this method.

J


----------



## kotori (Sep 11, 2010)

Synesthesia @ Sat Sep 11 said:


> But you need to instruct the script to ignore the release ID or you will get a release connected to your script triggered RT.



I'm not sure of that. If you trigger a note from the release callback I think Kontakt will typically not invoke the release callback for that note. If the release sample is triggered from the "on note" callback one however needs to be careful, like you say.


----------



## Hans Adamson (Sep 11, 2010)

Thanks guys for helping!

I think I've got it working OK now. The problem was not in the scripting but in the zone properties of some of the release groups. Double-clicking on a zone brings up the loop window, and if the wave is dimmed, the loop is activated. It can be turned off below the graph, and the setting can be transferred to all selected zones in the group. The symptom of this is the same as of a scripting error causing a loop.... (o)


----------



## Hans Adamson (Sep 11, 2010)

Something about custom release trigger scripting does not sound as good as the default release handling: Crossfades between sustain and release sample are not as smooth. The scripted release triggers sound abrupt and noisy, as if they were not crossfaded according to the settings. Anyone else noticed this?


----------



## gmet (Sep 12, 2010)

Hans,

If you do something during note(on) playback, you then have to mirror this with the note off and release.

e.g. If you start a note at CC1=127 and then fade to say CC1=64; you then need to tell Kontakt to either mirror this at note off/release, or, start the note off/release at the final value of the note(on) itself.

Hope this makes sense.

J


----------



## Hans Adamson (Sep 12, 2010)

Justin M @ Sun Sep 12 said:


> Hans,
> 
> If you do something during note(on) playback, you then have to mirror this with the note off and release.
> 
> ...


Thanks Justin,
The samples do not have velocity/volume mapping and no CC is used. The only thing I can imagine could be the culprit would be a double trigger of each release trigger, but I don't think that is happening. In the end when I listen and compare a version with the built-in release triggers to a version of the instrument with scripted release triggers, the built-in just sounds better and more incorporated in the note ending.


----------



## Synesthesia (Sep 12, 2010)

Nils, I'm pretty sure it is, an is mentioned in the manual somewhere. 

Hans - try inserting a command to ignore the RT note on that you have generated and see if that helps. 

I'm pretty sure I heard the double RT and that's how I ended up discovering this anomoly.


----------



## kotori (Sep 12, 2010)

Synesthesia @ Sun Sep 12 said:


> Nils, I'm pretty sure it is, an is mentioned in the manual somewhere.
> (...)
> I'm pretty sure I heard the double RT and that's how I ended up discovering this anomoly.



The manual says: "_note_off() is equivalent to releasing a key, thus it will always trigger a release callback_". This is a bit misleading since it's generally true only for the cases where it would actually be possible to release the key, i.e. when the event is not user-generated.

The reason you have heard double RTs is probably because of the fact that even a note which is ignored in the note callback will generate a release callback.

Try this script:

```
on init
  SET_CONDITION(NO_SYS_SCRIPT_RLS_TRIG)
  declare ui_label $debug(5, 6)
  declare $last_parent_id
  declare $child_id
  declare $release_id
end on

on note
  {ignore_event(EVENT_ID)}   { <-- even if this is activated, we will get releases for
                                   both the incoming and the generated note }  
  $last_parent_id := $EVENT_ID    
  $child_id := play_note($EVENT_NOTE, $EVENT_VELOCITY, 0, -1)
  
  set_text($debug, "")
  add_text_line($debug, "on note: " & $EVENT_ID)
  add_text_line($debug, "played extra note in note callback: " & $child_id)
end on

on release
  add_text_line($debug, "on release: " & $EVENT_ID)
  if ($EVENT_ID = $last_parent_id or $EVENT_ID = $child_id)
    $release_id := play_note($EVENT_NOTE, $EVENT_VELOCITY, 0, 0)
    wait(40000)
    note_off($release_id)
    add_text_line($debug, "played release: " & $release_id)
  end if
end on
```


----------

