# Kontakt question regarding knobs



## Justin Miller (Dec 11, 2012)

Hi, I was wondering how I can make a knob I've scripted to appear on the user interface controllable by the mouse. For example, I've created the knob in the script and I've made the close mic volume of certain groups controlled by CC 122. Then I assign the knob to CC 122 by right clicking on the user interface. I'm wondering if there's a script to assign a knob to a CC, as I can't control the parameters with the mouse right now, I can only control them with the knob assigned on my midi keyboard.


----------



## Blackster (Dec 11, 2012)

Justin Miller @ Tue Dec 11 said:


> Hi, I was wondering how I can make a knob I've scripted to appear on the user interface controllable by the mouse. For example, I've created the knob in the script and I've made the close mic volume of certain groups controlled by CC 122. Then I assign the knob to CC 122 by right clicking on the user interface. I'm wondering if there's a script to assign a knob to a CC, as I can't control the parameters with the mouse right now, I can only control them with the knob assigned on my midi keyboard.



That's not so hard to achieve. Here is a short example from the KSP reference manual:

on controller
if ($CC_NUM = 122)
{do whatever you want, e.g. controlling the volume via set_engine_par}
{and do this: $YourKnob := get_engine_par(volume)}
end if
end on

If you want to send data by using the mouse, you have to use a callback for the knob, like

on $YourKnob
set_engine_par(wahtever you wanna do)
end on

I was not very specific (because it's late and I'm tired) but I hope you understand what I'm trying to say


----------



## Justin Miller (Dec 11, 2012)

Hey Blackster, thanks for helping me again. Unfortunately, I still can't get it to work correctly. Basically, my UI has two faders for a close mic and a stage mic (percussion library) and I can't control the faders with the mouse, but I can with my midi controller. The close mics are obviously in separate groups, about 4 per instrument because of round-robin. So I just need to find out how to control multiple groups' amp volumes from the UI knob on the front panel. Here the opening part of the script I did:

{APELLA PERC i - Script by J Miller - last update: 12/11/12}

{Declared and Constant}

on init

set_control_par_str($INST_ICON_ID,$CONTROL_PAR_PICTURE,"Apella Metronome 2")
declare $rrfar := 1
make_persistent($rrfar)
declare $rrclose := 1
make_persistent($rrclose)
declare $ID

declare ui_slider $Fader1 (0,50)
$ID := get_ui_id($Fader1)
set_control_par_str($ID, $CONTROL_PAR_PICTURE, "pv_band_master_fx_eq_fader")
move_control_px($Fader1,559,44)
declare ui_slider $Fader2 (0,50) 
$ID := get_ui_id($Fader2)
set_control_par_str($ID, $CONTROL_PAR_PICTURE, "pv_band_master_fx_eq_fader")
move_control_px($Fader2,586,44)

declare ui_slider $Slider(-50,50)
$ID := get_ui_id($Slider)
set_control_par_str($ID, $CONTROL_PAR_PICTURE, "pv_world_knob_small") 
move_control_px($Slider,434,44 )
declare ui_slider $Slider2(-50,50)
$ID := get_ui_id($Slider2)
set_control_par_str($ID, $CONTROL_PAR_PICTURE, "pv_world_knob_small")
move_control_px($Slider2,480,44 )
declare ui_slider $Slider3(-50,50)
$ID := get_ui_id($Slider3)
set_control_par_str($ID, $CONTROL_PAR_PICTURE, "pv_world_knob_small")
move_control_px($Slider3,434,83 )
declare ui_slider $Slider4(-50,50)
$ID := get_ui_id($Slider4)
set_control_par_str($ID, $CONTROL_PAR_PICTURE, "pv_world_knob_small")
move_control_px($Slider4,480,83 )


set_controller(1,0) {CLOSE MICS volume}
set_controller(122,113) {FAR MICS volume}
set_controller(26,63)	{FAR MICS pan}
set_controller(46,1)	{TOM 1 pan}
set_controller(21,25)	{TOM 2 pan}
set_controller(109,103) {TOM 3 pan}
set_controller(83,127)	{TOM 4 pan}
set_ui_height_px(133)	
make_perfview

end on


----------



## mk282 (Dec 13, 2012)

The way you're doing it is kinda ass-backwards.

You should first script the sliders regularly, so they change the volume of the groups without using CCs, and then you should right-click the sliders on the scripted interface to MIDI learn them to a CC.

Let's say the first 4 groups are close mic, the second 4 groups are stage mic. This is how the script would look:

http://pastebin.com/raw.php?i=GwVyGXDY

Now you can MIDI learn the sliders to a CC if you want.


----------



## synapse21 (Jul 15, 2015)

I'm working on this exact scenario. However, my Groups are out of order based on how I created them in the first place. Rather than re-create/re-order them, how could I script the volume controls for specific Groups?

For instance: Groups 1-3 and 7-18 are Mic Position 1 while Groups 4-6 and 19-30 are Mic Position 2. How would this look for two sliders?


----------



## d.healey (Jul 15, 2015)

Oh this is an old post - and why is it in the commercial announcements forum? Anyway - If I were you I would use the group monitor window (not the group editor) and rearrange the groups. But the other way to get around this issue is to use some sensibly named arrays and put the group numbers in them, then you can just loop through the array of groups related to each slider.

So you would make an array called %mic1[14] := (1,2,3,7,8,9,10,11,12,13,14,15,16,17,18) and now you can control those mic 1 groups with your slider.

If you're using Nils' editor then this is a good time to use a "family" to group all you mic position arrays, I talk about this in my Kontakt scripting tutorial series.


----------

