The effect trick worked but I have no idea how to do what you suggested with the lookup array.Yes, when you remove zones, it doesn't reclaim back zone IDs so that they could be reused, it just keeps incrementing them. There's a trick to reset zone ID counter back to zero, though. Remove all zones from the instrument, then load an effect, any effect, to any slot, then undo one step back. Now when you drop new samples in they will start from zone ID 0.
In ANY case, messing with zone IDs like this is never a good idea. You should always properly retrieve zone IDs and put them in a lookup array only after your instrument is completely mapped out!
Also just to understand, the code as is in the NKI you posted works properly only if Zone ID 0 corresponds to Group 0 and so on.... correct?
I have to do a sort of list with all ID's and corresponding groups?
I tried with longer samples, 3D waveform and bigger and I had to increase the wait time to 200000 in order to make it work properly.OK it seems there is a direct correlation between loading the samples and waveforms being drawn. If the sample was still in the process of loading while you executed setting the waveform in script, the waveform won't be updated. That's why the wait() helps. There's also a difference between regular HDDs and SSDs in this case - SSDs are faster so, it's obvious they'd probably work better in this case.
Actually last night I managed to make it not work for me too, but only in one particular case: after loading the NKI, go straight for Group 3. It wouldn't refresh the waveform. But if I selected ANY other group except group 3 after loading the NKI, it would update the waveform properly.
Then I moved the NKI to an SSD, and Group 3 changed waveform immediately after loading the NKI, so that was all fine!
It seems it would be great if purge_group() command were made async aware, so that we actually know when stuff is done loading, so that we can do GUI-related stuff that ties into sample loading (like showing waveforms) properly.
I was also experimenting with adding an envelope or LFO to the position knob. Is there a way to actually see those position changes reflected in the ui waveform as you see when you manually move the position knob with the ui_control callback?Yeah, that's no good. Well, I'm told there have been some issues in showing wavetable waveforms in certain cases, and some of those cases have been remedied (but this is not in the official 6.0.4 release), so in the next Kontakt update we might see some improvements here.
I was also experimenting with adding an envelope or LFO to the position knob. Is there a way to actually see those position changes reflected in the ui waveform as you see when you manually move the position knob with the ui_control callback?
I was meaning if it is possible with a script to see that knob movement we see in instrument edit mode also in our own GUI when we activate an LFO?The light around the knob will move according to modulation, in instrument edit mode. That's normal for any modulatable parameter.