# Kontakt 5 note off bug



## jdawg (Mar 26, 2014)

i was wondering if kontakt 5 still has that lagging bug where note_off($event_id) doesn't visually lift off the keys on the gui keyboard. o=? o=?


----------



## mk282 (Mar 26, 2014)

I must say I didn't even notice that in K4...


----------



## jdawg (Mar 26, 2014)

it works fine in k4, but for some reason, K5 note_off suddenly doesn't lift the keys on the GUI anymore, making it visually quite ugly. Know of a work around in k5? or is this not a bug anymore. Im still on k5.2 cause of osx limitations.


----------



## mk282 (Mar 26, 2014)

I don't think this happens in all cases, because I can't reproduce it here...


----------



## jdawg (Apr 3, 2014)

So I did a quick test and this is 100% a bug, even in K5.3.1 (latest version) 

In k4 this worked perfectly, old notes where visually released, now in K5, the keyboard visuals no longer keep up, making older libraries look like they are jamming. And making my little project look a bit clunkier. 





> on init
> declare $last_id_1
> declare $eventid_1
> end on
> ...



again, this works perfectly in k4, its just k5 which seems to break it. does anyone out there have a quick fix to get this to work as expected? where the older notes are released?


Thanking you
o-[][]-o


----------



## Big Bob (Apr 3, 2014)

Running standalone with an instrument and your script loaded I can't repro your problem with either K4 or K5 (although my K5 is 5.1.0.6066 because I'm on XP and can't go any higher :cry: ).

Could you please describe your test procedure that causes the problem you have reported?

Rejoice,

Bob


----------



## jdawg (Apr 3, 2014)

Hey Bob, from what I can tell, this problem kicks in at 5.2 and beyond, as I used to not have it. and then boom got hit. 

Basically what your currently experiencing is the desired behaviour, every note you play, kills the visual aspect of the previous one (releasing it)

in more current versions of k5, the audible note_off function is indeed working. But the keyboard is remaining stuck. 

so If i play D-E-F-G-A and then let go, only the "A" key is visually released, like the included screenshot. 

Is there a little trick somewhere to hotfix this?[/img]


----------



## polypx (Apr 3, 2014)

I get the bug in Kontakt 5.3 but not in 5.1, standalone.


----------



## jdawg (Apr 3, 2014)

atleast I am not crazy. 

any thoughts to a better solution? perhaps just avoiding the note_off function all together in the future and just making do with fade_out ?


----------



## polypx (Apr 3, 2014)

fade_out($last_id, 10, 1)

That seems to work properly here... 

EDIT - sorry, didn't see your last post there. Yeah, maybe fade out is preferable, although that doesn't trigger a release call back I don't think ? You may or may not need that for what you're doing.


----------



## jdawg (Apr 3, 2014)

just switching it out isnt working, but theres a hell of alot of play_notes going on, ill have an experiment and see if i can get it working. 

what a pain, why kontaktt why you slowly getting worse :|


----------



## jdawg (Apr 3, 2014)

I think I have worked it out



> n init
> declare $Current_Note
> declare $eventid_1
> declare $last_id_1
> ...




although super simplified, this is kinda of the same result. except the fade value is manually inputted instead of just reading from the envelope. :roll:


----------



## polypx (Apr 3, 2014)

```
on note
ignore_event($EVENT_ID)
$Current_Note := $EVENT_NOTE
fade_out($Play_id, 30, 1)
$Play_id := play_note($Current_Note,40,-1,-1)
change_vol($Play_id,$PLAY_VOL,1)
end on
```

That what you need ?

cheers, 
Dan


----------



## jdawg (Apr 3, 2014)

so if my envelope release was 340ms 

I set the fade out too fade_out($id,340000, 1) 

But it just doesn't sound the same, you can almost hear the audio abruptly stop, where as with the envelope its pretty smooth cause of its concave fade shape. Is there any way to imitate the fade "shape" from an envelope? 

Surely someone has had to do that before. o=? o=? although you never know, maybe Im the only one dumb enough to update to k5.2+

Its actually all a bit laggy too with occasional hanging notes. Maybe 80% as good as when it was note_off this is probably the most annoying bug ive found in kontakt


----------



## gpax (Apr 3, 2014)

This visual glitch began right after the 5.2 update last July, and it has since been confirmed to me by every instrument developer I've mentioned it to. It appears to be inherent with any legato instrument (at least each one I use). Curiously, it has not been remedied with subsequent updates, though functionally it seems benign. It is visually disconcerting, though. 

G


----------



## jdawg (Apr 3, 2014)

it really is gpax just makes me angry haha

i guess we will have to live with it until NI fixes it : (


----------



## jdawg (Apr 4, 2014)

okay looking for someone smart to help me here, i thought i had it working, but it still doesnt work anywhere near like note_off does 

take this example

FIRST WITH NOTE OFF - this works exactly like wanted, monophonic with envelop release set to 300ms, if you play a scale fast without releasing any keys its still works



> on init
> 
> declare $Current_Note
> declare $Play_id
> ...



Against this example
NOW WITH FADE OUT - if you play with held notes too fast you hear polyphony, many notes quick stacking before fading out :(



> on init
> 
> declare $Current_Note
> declare $Play_id
> ...




is there a smart way to get rid of this? perhaps storing like 12 notes in an array and fading each of those independantly? not sure how to do that though

Atm its not acting the same as an envelope and note off would, and thats the goal. 

any heroes to help?
o=? o=?


----------



## mk282 (Apr 4, 2014)

Why are you fading out BEFORE generating the $play_id?

Did you try setting $play_id as a polyphonic variable?


----------



## polypx (Apr 4, 2014)

I tried stepping through an array, but to me it sounds the same.

Here's what I tried:

```
on init
declare $Current_Note
declare $Play_id
declare ui_slider $PLAY_VOL (0,10000)
declare %list[12]
declare $i:= 0
declare $j
end on

on note
ignore_event($EVENT_ID)
$i := ($i + 1) mod 12
if ($i = 0)
$j := 11
else
$j := $i -1
end if
fade_out(%list[$j], 250000, 1)

%list[$i] := play_note($EVENT_NOTE,40,-1,-1)
change_vol(%list[$i],$PLAY_VOL,1)
end on
```

But I wonder if the difference we're hearing is just the different curve between fade_out and a release envelope? If I set the fade out faster, it seems to work properly to me.

cheers
Dan


----------



## jdawg (Apr 4, 2014)

So here is my attempt at trying to explain the issue within some more context. 

I have 3 different play notes, being triggered under different circumstances and times. 

note_off works perfectly even if you hold down a series of note or even try play a chord, it remains monophonic, where as fade out, hangs some notes, has overlaps, if you try play a chord, the chord actually sounds for a short while, and just feels buggy in comparison the script and the patch has both note off and fade out implemented, you just need to click the ui switch to choose which one your hearing. I thought this would be a great way to compare. Things really fall apart if you keep notes held down, and or play really fast. This is where note off wins. 

Have a play and rain the wisdom down. ITs really messing with my head at this point. : ( 



> on init
> declare $Current_Note
> declare $eventid_1
> declare $last_id_1
> ...





PATCH IS HERE

http://www.sendspace.com/file/1cv5n0


----------



## polypx (Apr 4, 2014)

Hey JD

I noticed something in your code.

If you replace:


```
if($FADE = 1)
note_off($last_id_1)
$last_id_1 := $EVENT_ID
else
fade_out($Pre_id, 300000, 1)
fade_out($During_id, 600000, 1)
fade_out($Post_id, 400000, 1)
end if
```

with:


```
if($FADE = 1)
note_off($Pre_id)
note_off($During_id)
note_off($Post_id)
else
fade_out($Pre_id, 300000, 1)
fade_out($During_id, 600000, 1)
fade_out($Post_id, 400000, 1)
end if
```

The key-stuck problem goes away, so you can use NOTE OFF mode.

But yeah, there's still a difference in the sound. That wait statement is making things worse, but even with that taken out there's a difference.

cheers, Dan


----------



## jdawg (Apr 4, 2014)

So I tried that fix, and it works, but a quick issue I'm finding with it is that its stacking notes. 

So if for instance you play a scale (with that fix in place) and you dont let go of any notes, the last note POST is actually playing like 4 times ontop of itself. Causing it to be a little louder and phase slightly.


----------



## polypx (Apr 4, 2014)

even if you remove the wait statement? (wait 5*5000)

The wait statement is cause a lot of problems for me here; stuck notes, etc. 
I don't think you can keep that in a mono-mode type script.


----------

