# Need Help (some basic stuff - i thought, but it's not)



## Coil (Jan 5, 2013)

Hi, 

as a complete Kontakt Scripting Noop i tried to make a Custom Kontakt 4 Instrument for the imperfect samples Braunschweig Upright Library.
i want to Load the samples from the Main Instruments P1 (14 Layers) + P2 (11 Layers) and controll the Volume and Pan for each Micposition + a Mute Button for every Mic.
i startet with a new empty Instrument where i copied all the groups of the above mentined Kontakt patches.
then i set the Volume Button for the P1 Groups to MIDI CC#101 and the P2 Groups to 102.
so far so good. no i can set the Volumes of each Mic Position.
now it seams that i am to stupid to do this for the Pan positions and for the Mute Buttons.
this is my very first try with Kontakt Scripts and yes, i have searched the net and the Scripting Manual.

i only have some skills with writing actionScript and javaScript.
perhaps anybody here could give me some Tips, please.

this is the script as it looks now:


on init
{Start of GUI Generator on init definitions}
set_ui_height_px(300)
make_perfview
message("")
declare $count := 0
declare ui_knob $vol_mic1(0,127,1)
set_knob_unit($vol_mic1,$KNOB_UNIT_NONE)
set_knob_defval ($vol_mic1,500000)
set_text($vol_mic1,"Mic Position 1")
make_persistent($vol_mic1)
read_persistent_var($vol_mic1)
move_control_px($vol_mic1,420,35)

declare ui_knob $vol_mic2(0,127,1)
set_knob_unit($vol_mic2,$KNOB_UNIT_NONE)
set_knob_defval ($vol_mic2,500000)
set_text($vol_mic2,"Mic Position 2")
make_persistent($vol_mic2)
read_persistent_var($vol_mic2)
move_control_px($vol_mic2,420,150)

declare ui_knob $panMic1(1000,-1000,1)
set_knob_unit($panMic1,$KNOB_UNIT_NONE)
set_knob_defval ($panMic1,500000)
set_text($panMic1,"Pan Position Mic 1")
make_persistent($panMic1)
read_persistent_var($panMic1)
move_control_px($panMic1,520,60)

declare ui_knob $panMic2(-1000,1000,1)
set_knob_unit($panMic2,$KNOB_UNIT_NONE)
set_knob_defval ($panMic2,500000)
set_text($panMic2,"Pan Position Mic 2")
make_persistent($panMic2)
read_persistent_var($panMic2)
move_control_px($panMic2,520,180)

declare ui_label $Label_Mic1(1,1)
set_text($Label_Mic1,"Mic Position 1")
move_control_px($Label_Mic1,420,10)
set_control_par(get_ui_id($Label_Mic1),$CONTROL_PAR_WIDTH,200)
set_control_par(get_ui_id($Label_Mic1),$CONTROL_PAR_HEIGHT,20)

declare ui_label $Label_Mic2(1,1)
set_text($Label_Mic2,"Mic Position 2")
move_control_px($Label_Mic2,420,125)
set_control_par(get_ui_id($Label_Mic2),$CONTROL_PAR_WIDTH,200)
set_control_par(get_ui_id($Label_Mic2),$CONTROL_PAR_HEIGHT,20)

declare ui_switch $muteMic1
set_text($muteMic1,"Mute Mic 1")
make_persistent($muteMic1)
read_persistent_var($muteMic1)
move_control_px($muteMic1,420,80)
set_control_par(get_ui_id($muteMic1),$CONTROL_PAR_WIDTH,66)
set_control_par(get_ui_id($muteMic1),$CONTROL_PAR_HEIGHT,20)

declare ui_switch $muteMic2
set_text($muteMic2,"Mute Mic 2")
make_persistent($muteMic2)
read_persistent_var($muteMic2)
move_control_px($muteMic2,420,200)
set_control_par(get_ui_id($muteMic2),$CONTROL_PAR_WIDTH,66)
set_control_par(get_ui_id($muteMic2),$CONTROL_PAR_HEIGHT,20)
{End of GUI Generator on init definitions}
end on
on ui_control($vol_mic1)
set_controller (101, $vol_mic1)
end on
on ui_control($vol_mic2)
set_controller (102, $vol_mic2)
end on
on ui_control($muteMic1)
 set_controller(101,0) 
end on
on ui_control($panMic2)
end on
on ui_control($muteMic1)
end on
on ui_control($muteMic2)
end on


----------



## Big Bob (Jan 5, 2013)

*Re: need Help (some basic stuff - i think )*

Hi Coil,

I think you have sort of a hodge podge here. :lol: Your text implies that you intend to control group volume by assigning CC101 and CC102 to automate these group controls. If that is the case, your volume controls vol_mic1 and vol_mic2 should work (and they probably do). But then, you seem to use a default value of 500000 which is outside the knob's range. So, I'm not sure what your intention is here other than maybe you intended to control the group volume knobs via engine parameters?

For panning and muting you haven't explained what mechanism you intend to use to control these parameters. You could also use CC automation for this purpose (say CC103 and CC104) but then you would need to define pan_mic1 and pan_mic2 knobs to use the range from 0 to 127 as you did for the vol_mic. Since you have instead declared these knobs to produce the output range from -1000 to +1000 it almost implies that you intend to directly control the group pan knobs instead of via CC automation. If that's the case, perhaps you want to use the engine parameter control machinery? If that's the case then the knobs would need to be defined to provide the range from 0 to 1000000.

As to muting, you haven't indicated how you intend for your muting to work (other than the implication of a 0 or 1 control, which implies that you want to control some K4 button). Do you actually intend to drive the group volume to min or is there some K4 button you intended to control or what did you have in mind?

If your intention is to control all this stuff directly using engine parameters, then you will need your knob callbacks to include the necessary engine parameter commands.

So, at this point (without some clarification of what and how you want your script to control the group volume, panning, and mute functions) it's a little hard to provide more information. For example, if you said that you want your knobs and buttons to control their counterparts in the various groups entirely via engine parameters or with some hybrid combination of engine parameters and CC automation, I could perhaps post an illustrative script to get you started.

Rejoice,

Bob


----------



## Coil (Jan 5, 2013)

*Re: need Help (some basic stuff - i think )*

Hi Big Bob,

thanks a lot for your help !

to be honest, i don`t know anything abotut kontakt scripting (just start a vew hours ago) :roll: 

for the button layout i used the Musikbits Script generator (http://www.musikbits.com/generator.php) and i wasn`t sure what parameter range i should use.



> maybe you intended to control the group volume knobs via engine parameters



sadly i also never heard about engine parameter control machinery.

Basicly i start with two Kontakt Instruments (2 different Mic Positions) from the Imperfect Samples Braunschweig Upright Library.

Every Instrument includes 6 Groups.

i had copy/pasted the groups of the first instrument (mic position 1) into a new (Empty) Kontakt instrument and modified their names, because the groups of the other instrument (mic position 2) are namned the same way).
after that i copy/paste the groups of the second instrument.

than i used the script generator mentioned above and copied the script into the script editor in kontakt.

in kontakt i set every volumeknob for the first 6 groups to CC#101 and for the other 6 to CC#102.
now i am able to set the volume for both mis positions via 2 controller.

the same i want to do with a panning and mute button for each mic position.

and this is where i get lost (haha).

i asked Matt from imperfect samples some time ago if he will do something like that for his older librarys, but it seams he has not enough time while sampling new stuff.

so i thought i`ll give it a try (bad idea >8o )

anyway, i like the look, even when it does not work :D


----------



## TBAudio (Jan 5, 2013)

*Re: need Help (some basic stuff - i think )*

Hey Coil,

From what you described, I tried my best to imagine what you are looking for. I put this script together in a bit of a haste so I hope it works. I know my script might not make a lot of sense in some places, but hopefully you can work out what you need.

-Casey


```
on init
    make_perfview
    set_script_title("Upright Mic Mixer")
    message("")
    set_ui_height_px(300)
    
    declare $i
    
    declare ui_switch $mute1
    set_text($mute1,"Mute 1")
    move_control_px($mute1,420,80)
    make_persistent($mute1)
    
    declare ui_switch $mute2
    set_text($mute2,"Mute 2")
    move_control_px($mute2,420,200)
    make_persistent($mute2)
    
    declare ui_knob $mic1(0,1000000,1)
    set_knob_unit($mic1,$KNOB_UNIT_DB)
    $mic1 := get_engine_par($ENGINE_PAR_VOLUME,0,-1,-1)
    set_knob_label($mic1,get_engine_par_disp($ENGINE_PAR_VOLUME,0,-1,-1))
    set_text($mic1,"Mic 1")
    move_control_px($mic1,420,35)
    make_persistent($mic1)
    
    declare ui_knob $mic2(0,1000000,1)
    set_knob_unit($mic2,$KNOB_UNIT_DB)
    $mic2 := get_engine_par($ENGINE_PAR_VOLUME,6,-1,-1)
    set_knob_label($mic2,get_engine_par_disp($ENGINE_PAR_VOLUME,6,-1,-1))
    set_text($mic2,"Mic 2")
    move_control_px($mic2,420,150)
    make_persistent($mic2)
    
    declare ui_knob $pan1(0,1000000,1)
    $pan1 := get_engine_par($ENGINE_PAR_PAN,0,-1,-1)
    set_knob_label($pan1,get_engine_par_disp($ENGINE_PAR_PAN,0,-1,-1))
    set_text($pan1,"Pan 1")
    move_control_px($pan1,520,60)
    make_persistent($pan1)
    
    declare ui_knob $pan2(0,1000000,1)
    $pan2 := get_engine_par($ENGINE_PAR_PAN,6,-1,-1)
    set_knob_label($pan2,get_engine_par_disp($ENGINE_PAR_PAN,6,-1,-1))
    set_text($pan2,"Pan 2")
    move_control_px($pan2,520,180)
    make_persistent($pan2)
    
end on

on ui_control($mute1)
    $i := 0
    while ($i < 6)
        select($mute1)
            case 0
                set_engine_par($ENGINE_PAR_VOLUME,$mic1,$i,-1,-1)
            case 1
                set_engine_par($ENGINE_PAR_VOLUME,0,$i,-1,-1)
        end select
        inc($i)
    end while
    set_knob_label($mic1,get_engine_par_disp($ENGINE_PAR_VOLUME,0,-1,-1))
end on

on ui_control($mute2)
    $i := 6
    while ($i < 12)
        select($mute2)
            case 0
                set_engine_par($ENGINE_PAR_VOLUME,$mic2,$i,-1,-1)
            case 1
                set_engine_par($ENGINE_PAR_VOLUME,0,$i,-1,-1)
        end select
        inc($i)
    end while
    set_knob_label($mic2,get_engine_par_disp($ENGINE_PAR_VOLUME,6,-1,-1))
end on

on ui_control($mic1)
    if ($mute1 = 1)
        exit
    end if
    $i := 0
    while ($i < 6)
        set_engine_par($ENGINE_PAR_VOLUME,$mic1,$i,-1,-1)
        inc($i)
    end while
    set_knob_label($mic1,get_engine_par_disp($ENGINE_PAR_VOLUME,0,-1,-1))
end on

on ui_control($mic2)
    if ($mute2 = 1)
        exit
    end if
    $i := 6
    while ($i < 12)
        set_engine_par($ENGINE_PAR_VOLUME,$mic2,$i,-1,-1)
        inc($i)
    end while
    set_knob_label($mic2,get_engine_par_disp($ENGINE_PAR_VOLUME,6,-1,-1))
end on

on ui_control($pan1)
    $i := 0
    while($i < 6)
        set_engine_par($ENGINE_PAR_PAN,$pan1,$i,-1,-1)
        inc($i)
    end while
    set_knob_label($pan1,get_engine_par_disp($ENGINE_PAR_PAN,0,-1,-1))
end on

on ui_control($pan2)
    $i := 6
    while($i < 12)
        set_engine_par($ENGINE_PAR_PAN,$pan2,$i,-1,-1)
        inc($i)
    end while
    set_knob_label($pan2,get_engine_par_disp($ENGINE_PAR_PAN,6,-1,-1))
end on
```

edit - Fixed "Mic 2" and "Pan 2" loading incorrect knob position when applying the script for the first time.

edit 2 - Removed some redundant stuff from the init callback. (That "if mute is" stuff wasn't needed)

last edit - I changed the gui positions to the settings you used.


----------



## Coil (Jan 5, 2013)

*Re: need Help (some basic stuff - i think )*

Hey TBAudio,

thanks a lot o=? 

i will try it as soon as possible (it`s still late here).


----------



## Big Bob (Jan 5, 2013)

*Re: need Help (some basic stuff - i think )*

Hi Coil and Casey:

Since Casey has already taken the time to post an illustrative script, I think I will go do something else and allow you two guys to have some fun' trying to get on the same page'. :lol: 

I will make only the following additional comments to those I already posted.

Casey's script is more or less an engine parameter control illustration and because of that it will not require assigning CC101 and CC102 as automation CCs. Maybe that's better or maybe it's not in case there was some reason for involving these CCs other than as a means of controlling the group knobs. Of course the CC automation method has the advantage that you can control all six groups without needing to use a while-loop. And if you don't mind assigning another pair of CCs to the corresponding Pan knobs, you could control panning the same way. Using this scheme of course greatly simplifies the ui_control callback code since all that it needs to do is to set one CC value to control each set of 6 groups.

The muting situation could also be handled this way by using something like:


```
on ui_control($mute_Mic1)
  if ($mute_Mic1 = 1)
    set_controller(101,0)
  else
    set_controller(101,$vol_mic1)
  end if
end on

on ui_control($vol_mic1)
  if $mute_Mic1 = 0
    set_controller(101,$vol_mic1)
  end if
end on
```

Of course you will still have to add some code so the knobs will display dB and panning position correctly. With the above simple approach they will simply display the CC value from 0 to 127. But, it wouldn't be hard to add some code to correct this.

And, Casey, apparently your muting implementation is also 'an attempt' to drive the corresponding group volume knobs to -inf and then preclude further volume adjustment while in a muted state. I say the code appears to be 'an attempt' in that direction (similar to my example above) because I think you will need to add something to actually set the volume ep to zero (which I don't see upon a quick superficial read). Of course I may have missed something, it wouldn't be the first time. :oops: 

Anyway, I think I'll just sit this one out and let you guys try to come together on it.

Rejoice,

Bob


----------



## TBAudio (Jan 5, 2013)

*Re: need Help (some basic stuff - i think )*

Hey Bob,

Good to see you again. I didn't mean to interrupt you giving a helping hand, I just thought I would try and ease the load a bit. You are very much correct in that I abandoned the use of CC's as was in the OP. The reason I chose to do so was because I was remembering my first attempts at scripting and a similar encounter with the gui generator :oops: . In that mind set I changed the approach, but Coil could very well have had bigger plans for the CC's and in that case my script is more or less useless to him. I hope that is not the case and he will be happy using midi learn instead.

As for needing to set the Volume ep to 0 with mute. Unless I'm missing something, which I could be, I think I have taken care of that. The mute button handles changing the ep while the volume knob will just exit if it is on, which leaves the ep at 0. If I'm missing something please let me know. I do have a backwards approach sometimes for better or worse, but I'm pretty sure the script should be working as intended.

Cheers,
Casey


----------



## Big Bob (Jan 5, 2013)

*Re: need Help (some basic stuff - i think )*

Hi Casey,



> As for needing to set the Volume ep to 0 with mute. Unless I'm missing something, which I could be, I think I have taken care of that. The mute button handles changing the ep while the volume knob will just exit if it is on, which leaves the ep at 0. If I'm missing something please let me know.



My bad, I see it now in the select-case construct. I told you I often miss things when I do a quick read :oops: 

The only other thing I'll point out then is that the CC approach also suffers from poorer resolution since it only provides 128 steps. That's not very smooth and its unlikely to track very well over the volume and panning range. So if you would try to make the panel knobs display the same thing as the group knobs, there would be some values for which the panel knobs could not accurately represent the group knobs. For example, one may not be able to achieve a 'center pan' position because 64 might produce something like 1L or 1R rather than 0.

So overall, I think the ep approach is best but I just mentioned that Coil may have had some undisclosed reason for using the CCs. But, if he just did that to find some way to control the group knobs, then by all means do it with ep control and get the finer resolution. It's the way I would do it but to each his own.

Anyway, carry on guys.

Rejoice,

Bob


----------



## Coil (Jan 6, 2013)

*Re: need Help (some basic stuff - i think )*

Hey TBAudio,

your Script is working just perfect !

Thank you very much !

(o::o) 

I really have to change "some basic stuff" in the Title (o) 

also thank you very much Big Bob o-[][]-o 

i think i will try the same Thing for the Baby White Grand Library, which comes witch 3 Mic positions.

while i have lots of Piano Libraries, the Imperfect Samples Lib´s are still my favorite ones.

again, thanks a lot o=?


----------



## Coil (Jan 6, 2013)

*Re: need Help (some basic stuff - i think )*

ok, it worked for the first Time and perhaps there is something i should have to think before:

both of the mic positions includes 6 Groups.
in the first Group there are the sustain samples, the last 5 groups are for the release samples.

with the TBAudio script all 6 Groups are assigned to the Mic Positions Volume knob and after moving the Knob, the release Groups are all set to the same Volume Level, togehter with the Release Samples.

the result is, that it sonds like triggering every note twice, once when i press a key and once when i release the Key.

i tried to understand TBAudios script and many things are similar to ActionScript, where i`m a little bit firm with.

so, in my understanding, the following code will give me direct access the group Volume Level



> set_engine_par($ENGINE_PAR_VOLUME,$mic1,$i,-1,-1)



and with 



> while ($i < 6)
> set_engine_par($ENGINE_PAR_VOLUME,$mic1,$i,-1,-1)
> inc($i)
> end while



i set all 6 Groups to the same Volume Level, right ?

so perhaps the best idea is to change the 6 Groups Volume Controls relative to their basic settings.

I´m not sure, but i don`t think i can use the following code for that:



> <relative-bit>
> ￼If the relative bit is set to 0, the amount is absolute, i.e. the amount overwrites any previous set values of that event.
> If it is set to 1, the amount is relative to the actual value of the event.
> The different implications are only relevant with more than one change_vol() statement applied to the same event.



i hope anybody can follow my kind of english :roll:


----------



## TBAudio (Jan 6, 2013)

Hey again Coil,

Darn, I knew it would be to simple to work like that. we'll after looking at the picture in the latest post and what you described it appears that the problem is not really a volume issue but a group trigger issue.

It would seem that the release groups are all based on velocity or are using some round robin technique. I started to write a script which controls the group allow state during note presses and releases, but then I thought that maybe the group start options in the patch may be unique. 

I can help you work out the kinks, but can you please check if there are any group start options setup for the release groups. Once I know how those are setup or not, I should be able to wright some note logic to correct the issue and get you moving along.

P.S "set_engine_par($ENGINE_PAR_VOLUME,$mic1,$i,-1,-1)" does indeed control the group volume, where "$i" represents the group index.

edit - Please search the kontakt manual for "Release Trigger:" I believe this products groups were setup using that method. So understanding their settings is key to moving forward. when used appropriately, the "rls. trig. counter" modulator should handle the relative volumes of the release groups. But are the release groups just key up samples? that is what I'm not understanding, as a piano obviously has a natural decay even with sustain engaged.

edit 2 - Maybe it would be best to just send me your patch without the samples so I can see what is going on under the hood. The more I think about it, the more I'm confusing myself with all the different possibility's.

Cheers,
Casey


----------



## Coil (Jan 6, 2013)

Thank you so much !

The Group Start Options on all 12 Groups are set to always.

The Volume Knobs in the Original Instrument Groups are set to

Mic Position 1


sustain Layers +2.0
release one -48.2
release two -22.4
release four -22.2
release five -20.8
release six -21.1

Mic Position 2


sustain Layers +3.5
release one -48.2
release two -24.8
release four -22.2
release five -20.8
release six -24.1


----------



## TBAudio (Jan 6, 2013)

We'll in that case, I may have been over thinking things as usual. I can think of three possible solutions but I could be over thinking this again. One of the more senior members might be able to offer a clearer solution.

1. You could like you mentioned control the volume relative to there original position. you could do this simply by adding the offsets to an array and the apply it in the current loops iterations. However, I fear this way would often turn the lowest groups down to 0 and though it might sound subjectively ok, it would most likely lose a lot of dynamics and or harmonic detail.

2. The change_vol you mentioned is actually an event command. It is used to change the volume of a certain note (event) irrespective of any group volume settings. So, I'm thinking yes the offsets could be applied here, but I personally would need a bit of trial and error time to get it working in that fashion.

3. Probably the easiest method if it can work is to apply the offsets at the sample level in the mapping editor. The problem with this however is that the each key possibly has a different volume. If the volume is set to 0 in the mapping editor though, it should be no problem.

I have never worked much with older instrument patches. I have never encountered this kind of issue with the group volume parameters being setup in that fashion. I will think about it some more, but without trial and error, I'm not sure I have an easy solution.

Cheers,
Casey


----------



## TBAudio (Jan 6, 2013)

Ok, had a quick thought.

I just realized that if you have Kontakt 5, you can solve your problem very quickly by simply leaving the group volumes alone and using the bus. it would also make the use of loops unneeded. You could send the first 6 groups to bus 1, and the second 6 groups to bus two. Then redirect the script to control the bus instead. I would gladly show you how to do this and how it simplifies the entire script if you have K5

-Casey


----------



## Coil (Jan 6, 2013)

sadly i am a Kontakt 4 user :?

ok, after a long search i found the Kontakt Script Language Manual but it seams that there is only one for the Kontakt 2 Version available.

this hopefully makes some things clearer for me to understand.


----------



## TBAudio (Jan 6, 2013)

Back again,

So I'm kinda scared to post this as it might expose my lack of experience in some ways. I would normally need to test something like this to see if it is working, I usually always miss something on my first pass. But I put this script together and I hope it solves the volume issue. I decided to try and apply the volume changes on the event level. Please let me know if this works for you, or if it works at all for that matter. You will need to adjust to volumes of both mics to test.

here you go:

```
on init
    make_perfview
    set_script_title("Upright Mic Mixer")
    message("")
    set_ui_height_px(300)
    
    declare $i
    declare polyphonic $a
    
    declare %group_id[12]
    declare %group_vol[12]
    %group_vol[0] := 2000
    %group_vol[1] := -48200
    %group_vol[2] := -22400
    %group_vol[3] := -22200
    %group_vol[4] := -20800
    %group_vol[5] := -24100
    %group_vol[6] := 3500
    %group_vol[7] := -48200
    %group_vol[8] := -24800
    %group_vol[9] := -22200
    %group_vol[10] := -20800
    %group_vol[11] := -24100
    
    declare ui_switch $mute1
    set_text($mute1,"Mute 1")
    move_control_px($mute1,420,80)
    make_persistent($mute1)
    
    declare ui_switch $mute2
    set_text($mute2,"Mute 2")
    move_control_px($mute2,420,200)
    make_persistent($mute2)
    
    declare ui_knob $mic1(0,1000000,1)
    set_knob_unit($mic1,$KNOB_UNIT_DB)
    $mic1 := get_engine_par($ENGINE_PAR_VOLUME,0,-1,-1)
    set_knob_label($mic1,get_engine_par_disp($ENGINE_PAR_VOLUME,0,-1,-1))
    set_text($mic1,"Mic 1")
    move_control_px($mic1,420,35)
    make_persistent($mic1)
    
    declare ui_knob $mic2(0,1000000,1)
    set_knob_unit($mic2,$KNOB_UNIT_DB)
    $mic2 := get_engine_par($ENGINE_PAR_VOLUME,6,-1,-1)
    set_knob_label($mic2,get_engine_par_disp($ENGINE_PAR_VOLUME,6,-1,-1))
    set_text($mic2,"Mic 2")
    move_control_px($mic2,420,150)
    make_persistent($mic2)
    
    declare ui_knob $pan1(0,1000000,1)
    $pan1 := get_engine_par($ENGINE_PAR_PAN,0,-1,-1)
    set_knob_label($pan1,get_engine_par_disp($ENGINE_PAR_PAN,0,-1,-1))
    set_text($pan1,"Pan 1")
    move_control_px($pan1,520,60)
    make_persistent($pan1)
    
    declare ui_knob $pan2(0,1000000,1)
    $pan2 := get_engine_par($ENGINE_PAR_PAN,6,-1,-1)
    set_knob_label($pan2,get_engine_par_disp($ENGINE_PAR_PAN,6,-1,-1))
    set_text($pan2,"Pan 2")
    move_control_px($pan2,520,180)
    make_persistent($pan2)
    
end on

on note
    ignore_event($EVENT_ID)
    $a := 0
    while($a < 12)
        disallow_group($ALL_GROUPS)
        allow_group($a)
        %group_id[$a] := play_note($EVENT_NOTE ,$EVENT_VELOCITY,0,-1)
        change_vol (%group_id[$a],%group_vol[$a],1)
        inc($a)
    end while
end on

on ui_control($mute1)
    $i := 0
    while ($i < 6)
        select($mute1)
            case 0
                set_engine_par($ENGINE_PAR_VOLUME,$mic1,$i,-1,-1)
            case 1
                set_engine_par($ENGINE_PAR_VOLUME,0,$i,-1,-1)
        end select
        inc($i)
    end while
    set_knob_label($mic1,get_engine_par_disp($ENGINE_PAR_VOLUME,0,-1,-1))
end on

on ui_control($mute2)
    $i := 6
    while ($i < 12)
        select($mute2)
            case 0
                set_engine_par($ENGINE_PAR_VOLUME,$mic2,$i,-1,-1)
            case 1
                set_engine_par($ENGINE_PAR_VOLUME,0,$i,-1,-1)
        end select
        inc($i)
    end while
    set_knob_label($mic2,get_engine_par_disp($ENGINE_PAR_VOLUME,6,-1,-1))
end on

on ui_control($mic1)
    if ($mute1 = 1)
        exit
    end if
    $i := 0
    while ($i < 6)
        set_engine_par($ENGINE_PAR_VOLUME,$mic1,$i,-1,-1)
        inc($i)
    end while
    set_knob_label($mic1,get_engine_par_disp($ENGINE_PAR_VOLUME,0,-1,-1))
end on

on ui_control($mic2)
    if ($mute2 = 1)
        exit
    end if
    $i := 6
    while ($i < 12)
        set_engine_par($ENGINE_PAR_VOLUME,$mic2,$i,-1,-1)
        inc($i)
    end while
    set_knob_label($mic2,get_engine_par_disp($ENGINE_PAR_VOLUME,6,-1,-1))
end on

on ui_control($pan1)
    $i := 0
    while($i < 6)
        set_engine_par($ENGINE_PAR_PAN,$pan1,$i,-1,-1)
        inc($i)
    end while
    set_knob_label($pan1,get_engine_par_disp($ENGINE_PAR_PAN,0,-1,-1))
end on

on ui_control($pan2)
    $i := 6
    while($i < 12)
        set_engine_par($ENGINE_PAR_PAN,$pan2,$i,-1,-1)
        inc($i)
    end while
    set_knob_label($pan2,get_engine_par_disp($ENGINE_PAR_PAN,6,-1,-1))
end on
```

Best of luck,
Casey


----------



## Coil (Jan 6, 2013)

ok, now the Volumes for the Mic 1 Position are all set to a equal Level, also so for the Mic 2 Position >8o :mrgreen:

The Mute Buttons and the Pan Knobs are working as expected.


----------



## TBAudio (Jan 6, 2013)

I'm not quite sure from that last post if it's working or not, but I'm going to assume not and post one last quick fix. If this doesn't work, I hope someone else can offer some advice.

change the "change_vol" bit in the last script i sent to this and let me know what happens. I was thinking this would be redundant, but I need a break to clear my head.


```
change_vol(%group_id[$a],get_event_par($EVENT_ID,$EVENT_PAR_VOLUME) + %group_vol[$a],1)
```

Just delete the old line and add this one. hope it works.

-Casey


----------



## Coil (Jan 6, 2013)

i will try it as soon as possible !


----------



## Coil (Jan 11, 2013)

Thank you very much guys o=?


----------

