Kontakt scripting

KORG SOLO KONTAKT SCRIPTING

This is the script of korg solo for peoples Interested in programming who want to benefit from it. Using it or modifying it As needed Or ctreat his own library.

on init 
    make_perfview
    set_script_title("Korg Solo")
    set_ui_height_px(260)

    declare ui_knob $attack(0, 100, 1)
    set_control_par_str(get_ui_id($attack),  $CONTROL_PAR_PICTURE, "Knob 02")
    set_control_par_str(get_ui_id($attack),$CONTROL_PAR_TEXT,"ATTACK")
    set_control_par(get_ui_id($attack),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    move_control_px($attack,  20, 180)
    make_persistent($attack)
   
    declare ui_knob $sendlevel(0, 100, 1)
    set_control_par_str(get_ui_id($sendlevel),  $CONTROL_PAR_PICTURE, "Knob 02")
    set_control_par_str(get_ui_id($sendlevel),$CONTROL_PAR_TEXT,"REVERB")
    set_control_par(get_ui_id($sendlevel),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    move_control_px($sendlevel,  110, 180)
    make_persistent($sendlevel)
   
    declare ui_knob $sendleveltwo(0, 100, 1) 
    set_control_par_str(get_ui_id($sendleveltwo),  $CONTROL_PAR_PICTURE, "Knob 02")
    set_control_par_str(get_ui_id($sendleveltwo),$CONTROL_PAR_TEXT,"DELAY")
    set_control_par(get_ui_id($sendleveltwo),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    move_control_px($sendleveltwo,  200, 180)
    make_persistent($sendleveltwo)

(You can add new knobs as needed in the same format just change the name after the dollar symbol Or change their location through the dimensions in    move_control_px ) don’t past to the script
   
    declare ui_button $group1
    set_control_par(get_ui_id($group1),$CONTROL_PAR_HEIGHT,15)
    set_control_par(get_ui_id($group1),$CONTROL_PAR_WIDTH,60)
    set_control_par(get_ui_id($group1),$CONTROL_PAR_FONT_TYPE,3)
    set_control_par_str(get_ui_id($group1),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($group1),$CONTROL_PAR_PICTURE,"switch01")
   
    declare ui_button $group2
    set_control_par(get_ui_id($group2),$CONTROL_PAR_HEIGHT,15)
    set_control_par(get_ui_id($group2),$CONTROL_PAR_WIDTH,60)
    set_control_par(get_ui_id($group2),$CONTROL_PAR_FONT_TYPE,3)
    set_control_par_str(get_ui_id($group2),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($group2),$CONTROL_PAR_PICTURE,"switch01")
   
    declare ui_button $group3
    set_control_par(get_ui_id($group3),$CONTROL_PAR_HEIGHT,15)
    set_control_par(get_ui_id($group3),$CONTROL_PAR_WIDTH,60)
    set_control_par(get_ui_id($group3),$CONTROL_PAR_FONT_TYPE,3)
    set_control_par_str(get_ui_id($group3),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($group3),$CONTROL_PAR_PICTURE,"switch01")
   
    declare ui_button $group4
    set_control_par(get_ui_id($group4),$CONTROL_PAR_HEIGHT,15)
    set_control_par(get_ui_id($group4),$CONTROL_PAR_WIDTH,60)
    set_control_par(get_ui_id($group4),$CONTROL_PAR_FONT_TYPE,3)
    set_control_par_str(get_ui_id($group4),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($group4),$CONTROL_PAR_PICTURE,"switch01")
   
    declare ui_button $group5
    set_control_par(get_ui_id($group5),$CONTROL_PAR_HEIGHT,15)
    set_control_par(get_ui_id($group5),$CONTROL_PAR_WIDTH,60)
    set_control_par(get_ui_id($group5),$CONTROL_PAR_FONT_TYPE,3)
    set_control_par_str(get_ui_id($group5),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($group5),$CONTROL_PAR_PICTURE,"switch01")
   
       
    declare ui_button $group6
    set_control_par(get_ui_id($group6),$CONTROL_PAR_HEIGHT,15)
    set_control_par(get_ui_id($group6),$CONTROL_PAR_WIDTH,60)
    set_control_par(get_ui_id($group6),$CONTROL_PAR_FONT_TYPE,3)
    set_control_par_str(get_ui_id($group6),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($group6),$CONTROL_PAR_PICTURE,"switch01")
   
    declare ui_button $group7
    set_control_par(get_ui_id($group7),$CONTROL_PAR_HEIGHT,15)
    set_control_par(get_ui_id($group7),$CONTROL_PAR_WIDTH,60)
    set_control_par(get_ui_id($group7),$CONTROL_PAR_FONT_TYPE,3)
    set_control_par_str(get_ui_id($group7),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($group7),$CONTROL_PAR_PICTURE,"switch01")
   
    declare ui_button $group8
    set_control_par(get_ui_id($group8),$CONTROL_PAR_HEIGHT,15)
    set_control_par(get_ui_id($group8),$CONTROL_PAR_WIDTH,60)
    set_control_par(get_ui_id($group8),$CONTROL_PAR_FONT_TYPE,3)
    set_control_par_str(get_ui_id($group8),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($group8),$CONTROL_PAR_PICTURE,"switch01")
   
    declare ui_button $group9
    set_control_par(get_ui_id($group9),$CONTROL_PAR_HEIGHT,15)
    set_control_par(get_ui_id($group9),$CONTROL_PAR_WIDTH,60)
    set_control_par(get_ui_id($group9),$CONTROL_PAR_FONT_TYPE,3)
    set_control_par_str(get_ui_id($group9),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($group9),$CONTROL_PAR_PICTURE,"switch01")
   
    declare ui_button $group10
    set_control_par(get_ui_id($group10),$CONTROL_PAR_HEIGHT,15)
    set_control_par(get_ui_id($group10),$CONTROL_PAR_WIDTH,60)
    set_control_par(get_ui_id($group10),$CONTROL_PAR_FONT_TYPE,3)
    set_control_par_str(get_ui_id($group10),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($group10),$CONTROL_PAR_PICTURE,"switch01")
   
    declare ui_button $group11
    set_control_par(get_ui_id($group11),$CONTROL_PAR_HEIGHT,15)
    set_control_par(get_ui_id($group11),$CONTROL_PAR_WIDTH,60)
    set_control_par(get_ui_id($group11),$CONTROL_PAR_FONT_TYPE,3)
    set_control_par_str(get_ui_id($group11),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($group11),$CONTROL_PAR_PICTURE,"switch01")
   
    declare ui_button $group12
    set_control_par(get_ui_id($group12),$CONTROL_PAR_HEIGHT,15)
    set_control_par(get_ui_id($group12),$CONTROL_PAR_WIDTH,60)
    set_control_par(get_ui_id($group12),$CONTROL_PAR_FONT_TYPE,3)
    set_control_par_str(get_ui_id($group12),$CONTROL_PAR_TEXT,"")
    set_control_par_str(get_ui_id($group12),$CONTROL_PAR_PICTURE,"switch01")
   
   
   
    move_control_px($group1,20,20)
    move_control_px($group2,90,20)
    move_control_px($group3,160,20)
    move_control_px($group4,230,20)
    move_control_px($group5,20,60)
    move_control_px($group6,90,60)
    move_control_px($group7,160,60)
    move_control_px($group8,230,60)
    move_control_px($group9,20,100)
    move_control_px($group10,90,100)
    move_control_px($group11,160,100)
    move_control_px($group12,230,100)
   
   
    make_persistent($group1)
    make_persistent($group2)
    make_persistent($group3)
    make_persistent($group4)
    make_persistent($group5)
    make_persistent($group6)
    make_persistent($group7)
    make_persistent($group8)
    make_persistent($group9)
    make_persistent($group10)
    make_persistent($group11)
    make_persistent($group12)

(You can add new buttons as needed in the same format just change the name after the dollar symbol Or change their location through the dimensions in    move_control_px) don’t past to the script

   
   
    declare $i
    declare %black[5] := (1,3,6,8,10)
    declare ui_switch $C
    declare ui_switch $Db
    declare ui_switch $D
    declare ui_switch $Eb
    declare ui_switch $E
    declare ui_switch $F
    declare ui_switch $Gb
    declare ui_switch $G
    declare ui_switch $Ab
    declare ui_switch $A
    declare ui_switch $Bb
    declare ui_switch $B
    $i := 0
    while ($i < 12)
        if (search(%black,$i mod 12) # -1)
            if ($i > 5)
                set_control_par(get_ui_id($C) + $i,$CONTROL_PAR_POS_X,320 + (16 * $i))
            else
                set_control_par(get_ui_id($C) + $i,$CONTROL_PAR_POS_X,310 + (16 * $i))
            end if
            set_control_par(get_ui_id($C) + $i,$CONTROL_PAR_POS_Y,182)
        else
            if ($i > 4)
                set_control_par(get_ui_id($C) + $i,$CONTROL_PAR_POS_X,320 + (16 * $i))
            else
                set_control_par(get_ui_id($C) + $i,$CONTROL_PAR_POS_X,310 + (16 * $i))
            end if
            set_control_par(get_ui_id($C) + $i,$CONTROL_PAR_POS_Y,202)
        end if
        set_control_par(get_ui_id($C)+$i,$CONTROL_PAR_HEIGHT,15)
        set_control_par(get_ui_id($C)+$i,$CONTROL_PAR_WIDTH,25)
        set_control_par(get_ui_id($C)+$i,$CONTROL_PAR_FONT_TYPE,3)
        set_control_par_str(get_ui_id($C)+$i,$CONTROL_PAR_TEXT,"")
        set_control_par_str(get_ui_id($C)+$i,$CONTROL_PAR_PICTURE,"switch01")
        set_control_par_str(get_ui_id($C)+$i,$CONTROL_PAR_AUTOMATION_NAME,"Tune note")
        inc($i)
    end while
   
   
    make_persistent($C)
    make_persistent($Db)
    make_persistent($D)
    make_persistent($Eb)
    make_persistent($E)
    make_persistent($F)
    make_persistent($Gb)
    make_persistent($G)
    make_persistent($Ab)
    make_persistent($A)
    make_persistent($Bb)
    make_persistent($B)
   
    declare ui_knob $mwrig(0,100,1)
    $mwrig := -50
    make_persistent($mwrig)
    _read_persistent_var($mwrig)
    set_control_help($mwrig,"This knob controls tune amount in cents -50 +0")
    set_knob_defval($mwrig,-50)
    set_control_par_str(get_ui_id($mwrig),$CONTROL_PAR_PICTURE,"Knob 02")
    set_control_par_str(get_ui_id($mwrig),$CONTROL_PAR_TEXT,"AMOUNT")
    set_control_par(get_ui_id($mwrig),$CONTROL_PAR_MOUSE_BEHAVIOUR,-750)
    set_control_par(get_ui_id($mwrig),$CONTROL_PAR_POS_X,540)
    set_control_par(get_ui_id($mwrig),$CONTROL_PAR_POS_Y,180)
    set_control_par_str(get_ui_id($mwrig),$CONTROL_PAR_AUTOMATION_NAME,"Tune amount")
   
   
end on

on ui_control($group1)
    note_off($ALL_EVENTS)
    set_controller(1,0)
    $group1:=1
    $group2:=0
    $group3:=0
    $group4:=0
    $group5:=0
    $group6:=0
    $group7:=0
    $group8:=0
    $group9:=0
    $group10:=0
    $group11:=0
    $group12:=0
end on

on ui_control($group2)
    note_off($ALL_EVENTS)
    set_controller(1,0)
    $group1:=0
    $group2:=1
    $group3:=0
    $group4:=0
    $group5:=0
    $group6:=0
    $group7:=0
    $group8:=0
    $group9:=0
    $group10:=0
    $group11:=0
    $group12:=0
end on

on ui_control($group3)
    note_off($ALL_EVENTS)
    set_controller(1,0)
    $group1:=0
    $group2:=0
    $group3:=1
    $group4:=0
    $group5:=0
    $group6:=0
    $group7:=0
    $group8:=0
    $group9:=0
    $group10:=0
    $group11:=0
    $group12:=0
end on

on ui_control($group4)
    note_off($ALL_EVENTS)
    set_controller(1,0)
    $group1:=0
    $group2:=0
    $group3:=0
    $group4:=1
    $group5:=0
    $group6:=0
    $group7:=0
    $group8:=0
    $group9:=0
    $group10:=0
    $group11:=0
    $group12:=0
end on

on ui_control($group5)
    note_off($ALL_EVENTS)
    set_controller(1,0)
    $group1:=0
    $group2:=0
    $group3:=0
    $group4:=0
    $group5:=1
    $group6:=0
    $group7:=0
    $group8:=0
    $group9:=0
    $group10:=0
    $group11:=0
    $group12:=0
end on

on ui_control($group6)
    note_off($ALL_EVENTS)
    set_controller(1,0)
    $group1:=0
    $group2:=0
    $group3:=0
    $group4:=0
    $group5:=0
    $group6:=1
    $group7:=0
    $group8:=0
    $group9:=0
    $group10:=0
    $group11:=0
    $group12:=0
end on

on ui_control($group7)
    note_off($ALL_EVENTS)
    set_controller(1,0)
    $group1:=0
    $group2:=0
    $group3:=0
    $group4:=0
    $group5:=0
    $group6:=0
    $group7:=1
    $group8:=0
    $group9:=0
    $group10:=0
    $group11:=0
    $group12:=0
end on

on ui_control($group8)
    note_off($ALL_EVENTS)
    set_controller(1,0)
    $group1:=0
    $group2:=0
    $group3:=0
    $group4:=0
    $group5:=0
    $group6:=0
    $group7:=0
    $group8:=1
    $group9:=0
    $group10:=0
    $group11:=0
    $group12:=0
end on

on ui_control($group9)
    note_off($ALL_EVENTS)
    set_controller(1,0)
    $group1:=0
    $group2:=0
    $group3:=0
    $group4:=0
    $group5:=0
    $group6:=0
    $group7:=0
    $group8:=0
    $group9:=1
    $group10:=0
    $group11:=0
    $group12:=0
end on

on ui_control($group10)
    note_off($ALL_EVENTS)
    set_controller(1,0)
    $group1:=0
    $group2:=0
    $group3:=0
    $group4:=0
    $group5:=0
    $group6:=0
    $group7:=0
    $group8:=0
    $group9:=0
    $group10:=1
    $group11:=0
    $group12:=0
end on

on ui_control($group11)
    note_off($ALL_EVENTS)
    set_controller(1,0)
    $group1:=0
    $group2:=0
    $group3:=0
    $group4:=0
    $group5:=0
    $group6:=0
    $group7:=0
    $group8:=0
    $group9:=0
    $group10:=0
    $group11:=1
    $group12:=0
end on

on ui_control($group12)
    note_off($ALL_EVENTS)
    set_controller(1,0)
    $group1:=0
    $group2:=0
    $group3:=0
    $group4:=0
    $group5:=0
    $group6:=0
    $group7:=0
    $group8:=0
    $group9:=0
    $group10:=0
    $group11:=0
    $group12:=1
end on

(If you add new buttons don't forget to add their work in control like old buttons) don’t past to the script

on ui_control($attack)
    set_engine_par($ENGINE_PAR_ATTACK,$attack,0,0,0)
end on
on ui_control($sendlevel)
    set_engine_par($ENGINE_PAR_SENDLEVEL_0,$sendlevel,-1,7,-1)
end on
on ui_control($sendleveltwo)
    set_engine_par($ENGINE_PAR_SENDLEVEL_1,$sendleveltwo,-1,7,-1)
end on

(If you add new knobs don't forget to add their work in control like old knobs) don’t past to the script


on note
      disallow_group($ALL_GROUPS)
      if ($group1 = 1)
        allow_group(0)
      end if
     
      if ($group2 = 1)
        allow_group(1)
      end if
      
      if ($group3 = 1)
        allow_group(2)
      end if
     
      if ($group4 = 1)
        allow_group(3)
      end if
     
      if ($group5 = 1)
        allow_group(4)
      end if
     
      if ($group6 = 1)
        allow_group(5)
      end if
     
      if ($group7 = 1)
        allow_group(6)
      end if
     
      if ($group8 = 1)
        allow_group(7)
      end if
     
      if ($group9 = 1)
        allow_group(8)
      end if
     
      if ($group10 = 1)
        allow_group(9)
      end if
     
      if ($group11 = 1)
        allow_group(10)
      end if
     
      if ($group12 = 1)
        allow_group(11)
      end if      
       
       
    if (get_control_par(get_ui_id($C) + $EVENT_NOTE mod 12,$CONTROL_PAR_VALUE) = 1)
        change_tune($EVENT_ID,$mwrig * 1000,0)
    end if
end on

(If you add new buttons don't forget to add their groups, Each button has its own group) don’t past to the script

Do not forget to add the effects in the sandboxes as follows
Reverb in the first square and Delay in the second square, Attack is working automatically with AHDSR
This script is valid for all versions of kontakt.






CREATING


Scripting  BOUZIANE MOHAMMED FAYCEL