# Groups causing confusion



## sneakyalien (Sep 17, 2010)

Hi all,
I have an issue with groups and basically I am confused at the moment.
I have 3 groups each containg samples.Group1 and 2 are passing through an ahdsr volume envelope and the problem is I want group 3 to pass through the same ahdsr but for some reason that I cannot figure out group 3 does not follow the contours of the envelope of group 1 and 2.

Can any one shed any light on this for me please.
Thanks guys.
Steve.


----------



## snapshot (Sep 17, 2010)

Hi !

are you sure that first and second group are affected by the same envelope process ? i mean ,while you move those knobs its affecting both groups the same time ?

maybe you need to press Edit All Groups from group editor ?

K


----------



## EvilDragon (Sep 17, 2010)

I guess that modulator IDs are different for those envelopes. For example, if you first created volume envelope for groups 1 and 2, they get assigned a modulator ID of 0. Then if you added, for example, a velocity modulator, it gets modulator ID of 1.

If you reversed that process for group 3, it means that now velocity has a modulator ID of 0 and envelope gets ID 1. Only modulators of the same ID will respond to moving one control in any group when Edit All Groups is turned on. My recommendation is to remove volume envelopes in all 3 groups, turn Edit All Groups on, and then add the envelope again. This time, they will all move in tandem together, if Edit All Groups is on.


----------



## sneakyalien (Sep 18, 2010)

Hi guys,thanks for the replies.
I think you are right here but there is defintly something I am doing wrong.
I have had a look at my groups and there was a seperate ahdsr for group 3 so i deleted all ahdsr's for both groups I then carefully went through each group and removed any modulators such as velocity's etc and then I selected edit all groups and created another ahdsr but the same problem arises in that group 3 does not seem to follow the contours of the ahdsr for groups 1 and 2.
I then clicked on group 3 and sure enough there is a seperate ahdsr to the ahdsr for groups 1 and 2.
I have absolutley no idea why it is creating a seperate ahdsr for group 3.
Any ideas?


----------



## EvilDragon (Sep 18, 2010)

No ideas anymore. Something's messing up with modulator IDs. I guess it's a Kontakt bug.

Try duplicating group 2, delete all zones in the duplicate, then MOVE all zones from group 3 to the duplicated group 2. Now delete old group 3 and rename the duplicated group 2 to group 3. I guess the envelopes should be linked now.


----------



## sneakyalien (Sep 18, 2010)

I definitly think it is something in the sript that is causing this because I did the following:-

Started a new instrument and copied across the 3 groups to the new instrument and set up an ahdsr and sure enough it controlled all 3 groups as you would expect.
I then copied the script to the new instrument and applied it and sure enough groups 1 and 2 were controlled by the envelope but group 3 now had a seperate ahdsr.
I have looked at the script for hours but cannot seem to see anything in there that is causing this but I am not exactly a programmer and have cobbled this script together from the NI synth script-Someone once said a good way of learning scripting is pulling apart other peoples scripts and seeing how they tick so I have jumped in at the deep end onto rocks I think.
Best regards,
Steve.


----------



## EvilDragon (Sep 18, 2010)

This is only the initialization callback - positioning and changing the looks of controls.

What's more interesting are actual UI control callbacks. Find the paragraphs that start with:

on ui_control($vol_a_adsr)
on ui_control($vol_r_adsr)

and paste those here.


----------



## sneakyalien (Sep 18, 2010)

Hi Evil Dragon,thanks for the reply.
Yes my string synth only has attack and decay so I removed the referrences to sustain decay etc.
I think I have fixed this problem I had to delare a $group3 variable and assign that as follows
on ui_control ($vol_a_adsr)
_set_engine_par ($ENGINE_PAR_ATTACK, $vol_a_adsr, $grp1_idx, $vol_env_idx, -1)
_set_engine_par ($ENGINE_PAR_ATTACK, $vol_a_adsr, $grp2_idx, $vol_env_idx, -1)
_set_engine_par ($ENGINE_PAR_ATTACK, $vol_a_adsr, $grp3_idx, $vol_env_idx, -1)
end on




on ui_control ($vol_r_adsr)
_set_engine_par ($ENGINE_PAR_RELEASE, $vol_r_adsr, $grp1_idx, $vol_env_idx, -1)
_set_engine_par ($ENGINE_PAR_RELEASE, $vol_r_adsr, $grp2_idx, $vol_env_idx, -1)
_set_engine_par ($ENGINE_PAR_RELEASE, $vol_r_adsr, $grp3_idx, $vol_env_idx, -1)
end on

I could not put all the script in the post before due to character size restrictions.
The inclusion of $grp3_idx seems to have fixed it.
Thanks for all your help,I'm slowly beginning to get my head around this scripting but think I have a very long way to go yet,I'm liking it though and I definitly think pulling scripts apart is helping me get a basic understanding of how things are put together and seeing how the pro's do it.
Do you know of any settings that allow Kontakt to behave like a paraphonic string synth in terms of articulating chords?I would like a chord to end abruptly when another chord is played just like on a real string synth.
Wonder if NI have plans to do something like this in an update.
Thanks again,
Steve.


----------



## EvilDragon (Sep 18, 2010)

FYI, if you want to paste large amounts of text, use www.pastebin.com.

You could've done it with a while loop as well, this way you'd only have to declare just one variable instead of 3:

on ui_control ($vol_a_adsr)
$count := 0
while ($count < $NUM_GROUPS)
set_engine_par ($ENGINE_PAR_ATTACK, $vol_a_adsr, $count, $vol_env_idx, -1)
end on



AFAIK Kontakt has no way of setting paraphonic envelope behavior currently, and I'm not sure if NI has it in their mind at all. My guess is it won't happen. I can't see a way of scripting that behavior in.


----------



## sneakyalien (Sep 18, 2010)

Thanks everyone for all the replies Ive got the basis of a string machine working now.
Yeah,your use of while loops does make more sense-will leave it for the time being whilst it is working and then experiment with the while loops.

Thanks.
Steve.


----------



## polypx (Sep 18, 2010)

The paraphonic idea is interesting.

You MIGHT be able to script paraphonic envelope behaviour if you delete Kontakt's envelope and script your own? 

If you simply want a chord to stop any currently ringing notes, that's quite a simple script. But a complete paraphonic EG would be quite tricky.

Intriguing idea though. I'm going to be wondering about this for the rest of the day.


----------



## sneakyalien (Sep 19, 2010)

Polypx,yes I have been thinking about it for weeks-I was imagining someway of stopping the release portion of ahdsr as soon as a new key on the keyboard is pressed.
I need to get me a good book on scripting,have had one suggested to me so going to go for it.
Hopefully I can come up with the script.
I'm sure there is some code wizard out there who has already done something similar.
Best regards,
Steve.


----------

