# Release stage of ahdsr



## sneakyalien (Oct 4, 2010)

Hi all,quick question.
Is there a method of detecting which notes are in the release stage of ahdsr?
I basically want to cut off any notes abruptly when a new set of notes are played but I only want to cut the notes off abruptly if they are in the release stage of ahdsr,any notes still being held would still play.

Thanks guys,
Steve.


----------



## polypx (Oct 4, 2010)

Steve,

Not a quick and easy method, but I think you'd have to compare two things for each note.
(ie. check all notes from 1 to 127 in a while loop)

By querying the event_status, you can find out if a note is still "active".
($EVENT_STATUS_NOTE_QUEUE)

By checking the same note in the $KEY_DOWN array, you can check if the key is still being held down.

If it was in the first, but not in the second, you could fade it out (ie stop it).
If it was in both, do nothing.

cheers
Dan


----------



## sneakyalien (Oct 5, 2010)

Thanks Dan,yeah that seems a good way to do it-will experiment with the the script and see if I can get it to work.
Thanks for the reply.
Steve. o-[][]-o


----------



## sneakyalien (Oct 5, 2010)

Hi,Polypx does $EVENT_STATUS_NOTE_QUEUE return a 1 if any notes are on?
I'm not too certain how I could reference each note 1-127 against $EVENT_STATUS_NOTE_QUEUE.
Can $EVENT_STATUS_NOTE_QUEUE be referenced as an array?

I have looked through my NI scripting documents and cannot find any synopsis on $EVENT_STATUS_NOTE_QUEUE.
Do you know where this is referenced in amanual?
thanks


----------



## EvilDragon (Oct 5, 2010)

Manual page 70, event_status(). 

Basically, event_status(MIDI NOTE NUMBER) will return $EVENT_STATUS_NOTE_QUEUE if that MIDI NOTE NUMBER is active, or $EVENT_STATUS_INACTIVE if it's not active.

That parameter is actually a 2-bit bitmask, which has these states:

00 -> $EVENT_STATUS_INACTIVE
01 -> $EVENT_STATUS_NOTE_QUEUE
11 -> $EVENT_STATUS_MIDI_QUEUE (for multiscripts)


----------



## sneakyalien (Oct 5, 2010)

Thanks Mario,
If I get this script working I will post it in case someone else needs a paraphonic synth polyphony emulator. o-[][]-o


----------



## sneakyalien (Oct 5, 2010)

I must be looking in the wrong manual as I still cannot find it.
I have NI's Kontakt 4 developer guide,the manual that comes with Kontakt in the help and KSP reference.

I may be being slightly thick though :oops:


----------



## polypx (Oct 5, 2010)

With Kontakt 4.1 open, in standalone, open the manual KSP Reference Manual from the Help menu.

Either search for "event_status", or go to page 70, as Mario mentioned.


----------



## sneakyalien (Oct 5, 2010)

Thanks guys,found it.It was me being a complete gimp.


----------

