Kontakt Scripting - Kontakt Custom Script Collection

Discussion in 'AudioSex Academy' started by Alraun, Nov 7, 2014.

  1. Alraun

    Alraun Member

    Joined:
    Sep 17, 2012
    Messages:
    414
    Likes Received:
    13
    [​IMG] KSP - Kontakt Custom Script Collection

    Welcome to this new section in AudioSex Academy, a place to share our self-made Kontakt UI Scripts.

    I make the start and will give you some fruits of my homework within the next weeks.
    EQ’s, Filter, Effects and more. Each of my own scripts has customized controls (knobs, buttons, menus, pics).
    To liven the whole thing up, i won’t just give you the hieroglyphs. *no*
    You get the scripts ready for action, embedded in a nki, together with all resources. It makes understanding easier for beginners.
    And we have no function to hide the script, what means that it could otherwise wind up in a very long thread.

    You can use these modules as templates to build your own customized UI in Kontakt or as learning tool for your studies.
    If you have scripted a special function, a control, whatever, and you are open and willing to share it with the community - this is the place for it. :wink:

    1) The first script is a special Panic Button originally made for and dedicated to Catalyst, who encouraged me to start this thread.
    For this one i don’t give you a preview. *no* If you want to know what this special button is about and what it does….here is the button in action.
    It’s a Bypass. The effect combines ancient wisdom with modern americanism. :rofl: Lol. Check out all 5 script slots. Press the button. Have fun! :mates:

    Download KSP Panic Button

    2) The next goodie is a package of three differently scripted EQ’s, two 3-Band EQ's, each with two labels and……
    *yes*……a fully customized Solid-EQ in a one-label version showing the values.

    Download KSP EQ Module

    Preview:
    [​IMG] [​IMG] [​IMG]

    Tools: Buttons, knobs, pics are made on Mac with following software: Art Text 2, Graphic Converter, JKnobman.
    Sound: 30 sec. sample on C1 by Alraun
     
    • Interesting Interesting x 3
    • Like Like x 1
    • List
  2.  
  3. Sohill

    Sohill Noisemaker

    Joined:
    Nov 17, 2013
    Messages:
    59
    Likes Received:
    3
    Great thanks for these :wink:
     
  4. fiction

    fiction Audiosexual

    Joined:
    Jun 21, 2011
    Messages:
    1,889
    Likes Received:
    687
    Nice!

    For the less gifted amongst us, here you'll find some pre-made knobs, faders, buttons, switches...

    Knob Gallery:
    http://www.g200kg.com/en/software/knobman.html

    Small but useful collection:
    http://www.lesliesanford.com/KnobManStuff/KnobManStuff.shtml
     
    • Interesting Interesting x 2
    • List
  5. Catalyst

    Catalyst Audiosexual

    Joined:
    May 28, 2012
    Messages:
    5,810
    Likes Received:
    801
    This is amazing Alraun, thank you so much for this thread. A useful resource for anyone getting their feet wet with Kontakt scripting. Very grateful for your time in putting this together mate. You rock! [​IMG]
     
  6. Alraun

    Alraun Member

    Joined:
    Sep 17, 2012
    Messages:
    414
    Likes Received:
    13
    Scripting infos for beginners[​IMG]

    The first thing you might take a look at is NI’s KSP Reference Manual. Some people report it as not enough understandable for beginners and they state,
    that the older Kontakt 3 Script Language Manual was more helpful for them to read. Another old manual giving interesting basics is the
    Kontakt 4 Player Developer Guide. You can find both manuals somewhere as legal download or load them from here:
    KSP Manuals Download

    Book: „KSP“ by Mike Novy. Expensive, but good.

    Forums:
    NI Scripting Workshop
    v.i. control forum

    Others:
    Nils Liberg's Scripts
    ADSR Kontakt Tutorials
    Yummybeats Kontakt Scripting

    Script Editor: The text editor Sublime Text 3 (win+Mac) is very common. It is used together with Nils Liberg’s SublimeKSP extension.



    Forum Link to SublimeKSP Plugin Download
     
    • Interesting Interesting x 2
    • List
  7. Alraun

    Alraun Member

    Joined:
    Sep 17, 2012
    Messages:
    414
    Likes Received:
    13
    3) Third script is an Envelope ACHDSR module with value labels

    [​IMG]

    [​IMG]

    Download KSP ACHDSR module

    [​IMG]
    Tipp Preconfigured movement of the controls (mouse behaviour) is too fast or slow for your own needs? For example the movements in my own scripts are set to very slow, because i already have a very fast mouse/trackpad movement. So in case it is too slow for you, open the script and make a search for the strings containing:
    [​IMG] $CONTROL_PAR_MOUSE_BEHAVIOUR
    The range is from -5000(linear) to +5000( circular). For most people it's best set from -500 to -1500. Try it out.
     
    • Interesting Interesting x 2
    • Love it! Love it! x 1
    • List
  8. Catalyst

    Catalyst Audiosexual

    Joined:
    May 28, 2012
    Messages:
    5,810
    Likes Received:
    801
    Thanks again Alraun, this is great work my friend. :mates:
     
  9. Clandestine

    Clandestine Platinum Record

    Joined:
    Nov 11, 2013
    Messages:
    717
    Likes Received:
    151
    Graphics Look fantastic! Is this a Group Modulation Script or one for controlling an instrument? Looks really good & also a really usefull script. Nice One :wink:
     
  10. Catalyst

    Catalyst Audiosexual

    Joined:
    May 28, 2012
    Messages:
    5,810
    Likes Received:
    801
    Graphics are an interesting choice huh? :wink:
     
  11. Clandestine

    Clandestine Platinum Record

    Joined:
    Nov 11, 2013
    Messages:
    717
    Likes Received:
    151
    Definitely! Fits really well :wink: Great choice!

    Also I would like to congratulate Alaun on starting an area that I am damn sure will be a fantastic help & learning resource to those wanting to learn the most powerful sampler's most powerful asset ( if that makes sense)

    Excellent section indeed & will be a great learning & reference tool *yes*

    I for one think it's brilliant as there aren't that many easy ways to learn this stuff & all credit for the ideas & putting it into practice :bow:
     
  12. Alraun

    Alraun Member

    Joined:
    Sep 17, 2012
    Messages:
    414
    Likes Received:
    13
    It's on instrument level (all groups).
     
  13. Alraun

    Alraun Member

    Joined:
    Sep 17, 2012
    Messages:
    414
    Likes Received:
    13
  14. Alraun

    Alraun Member

    Joined:
    Sep 17, 2012
    Messages:
    414
    Likes Received:
    13
    • Like Like x 1
    • Useful Useful x 1
    • List
  15. Clandestine

    Clandestine Platinum Record

    Joined:
    Nov 11, 2013
    Messages:
    717
    Likes Received:
    151
    It looks cool & that but on the script you have (put/left?) a factory Tonal Chord script that is active in script slot 2.

    This means if I add samples to this script it will play 1-3-5 intervals of any given note for a single note.

    Was just wondering if there a reason for this as in you building a whole instrument or it from another instrument or there deliberately or by accident?

    Is just it could be real confusing as the background covering the active script as that not set to the same height.

    Therefore if u can't see it but it's there.

    So if someone to add samples like I said it will play chords & they might not realise why.

    Just a thought unless it deliberate of course.

    Looks good tho :thumbsup:
     
  16. Alraun

    Alraun Member

    Joined:
    Sep 17, 2012
    Messages:
    414
    Likes Received:
    13
    @User 137, oops.... Thanks for telling. :wink: Wasn't intentional. I don't know why the second slot is occupied. Leftover of...whatever.... :dunno:
    It's a Kontakt factory script. Second slot can be deleted.
     
  17. Alraun

    Alraun Member

    Joined:
    Sep 17, 2012
    Messages:
    414
    Likes Received:
    13
    6) IR Menu 1
    This is an example how to script a simple dropdown menu for Impulse Responses.
    It let's you choose between 20 different types of IR samples or bypassing the convolution effect.
    IR's are already embedded in the .nkr, so this script is fully functional.

    [​IMG]

    Download KSP IR Menu 1


    P.S. New link to script 4) = Pitch module available! Please download it again.
    Former pitch knob was not working properly. It is now fixed and does no more value parameter jumping while getting tuned. *yes*
     
    • Interesting Interesting x 1
    • Useful Useful x 1
    • List
  18. Rhodes

    Rhodes Audiosexual

    Joined:
    Feb 4, 2015
    Messages:
    928
    Likes Received:
    558
    Fantastic!

    Thank You very much.
    I was getting tired of my lame scripts with prehistoric knobs (partially ripped from other old instruments)
     
  19. Catalyst

    Catalyst Audiosexual

    Joined:
    May 28, 2012
    Messages:
    5,810
    Likes Received:
    801
    Alraun is back in town?
     
  20. Clandestine

    Clandestine Platinum Record

    Joined:
    Nov 11, 2013
    Messages:
    717
    Likes Received:
    151
    Nice one Alraun always good to see a different way of doing stuff *yes*

    Thought it would be a logical place to put up one of my own & hope u don't mind and not interfering *no* but it also is a similar way of doing the same thing you have highlighted. You could even use the code in conjunction with your script to control a digital reverb on slot 4 of the instrument Insert FX group. For different slots you would change your numbers in the script accordingly.

    Anyway it might help some folk trying to learn KSP & if so then cool.

    A different approach would be say to use a preset array. This can then also act as a menu & also change your controls according to your array values.

    They are invaluable in KSP & can be used stored as say NKA's in the data folder to set values for Tables etc.

    An example of one for a reverb control would read as below.

    Code:
    on init
    
    make_perfview
    set_ui_height (8)
    message ("")
    set_control_par_str($INST_ICON_ID, $CONTROL_PAR_PICTURE, "icon_1")
    set_control_par_str($INST_WALLPAPER_ID, $CONTROL_PAR_PICTURE, "wallpaper_blackbox_1")
    
    {---DECLARE CONSTANTS---}
    
    declare const $DIGrev_slot:=4
    
    {----SETUP ARRAYS---}
    {---SETUP DIG REV PRESET ARRAY---}
    
    declare $DIG_rev_selected
    declare %DIGrev_presets_array...
    [7*20+1]:=(1,421692,433731,0,1000000,500000,800000,500000,...
    396850,510184,233333,180000,473333,866667,660000,... 
    396850,396850,70316,16667,0,800000,233333,...
    396850,396850,456983,163333,0,1000000,900000,...
    396850,396850,423650,863333,586667,786667,613333,...
    396850,396850,866667,0,173333,1000000,806667,...
    396850,396850,890316,1000000,1000000,1000000,613333,...
    396850,396850,816983,1000000,0,1000000,653333,...
    396850,396850,243650,443333,493333,0,473333,...
    396850,399994,230316,1000000,0,1000000,1000000,...
    396850,230179,700000,280000,226667,1000000,793333,...
    396850,386673,890316,1000000,740000,1000000,533333,...
    396850,396850,753333,946667,300000,780000,773333,...
    396850,396850,373333,100000,220000,1000000,233333,...
    396850,396850,400000,786667,66667,780000,513333,...
    396850,396850,340000,486667,66667,780000,513333,...
    396850,510184,0,526667,240000,633333,1000000,...
    396850,410187,1000000,153333,160000,1000000,160000,...
    396850,399994,1000000,1000000,420000,106667,333333,...
    396850,396850,890316,863333,586667,786667,613333)
    
    {---DIG PRESET MENU---}
    
    declare ui_menu $DIGrev_presets
    add_menu_item($DIGrev_presets,"Default",0)
    add_menu_item($DIGrev_presets,"Bassverb",1)
    add_menu_item($DIGrev_presets,"Bright Room",2)
    add_menu_item($DIGrev_presets,"Drum Room",3)
    add_menu_item($DIGrev_presets,"Cellar",4)
    add_menu_item($DIGrev_presets,"Delay-ish",5)
    add_menu_item($DIGrev_presets,"Faraway",6)
    add_menu_item($DIGrev_presets,"Grand Hall",7)
    add_menu_item($DIGrev_presets,"Hall 1",8)
    add_menu_item($DIGrev_presets,"Mysterious",9)
    add_menu_item($DIGrev_presets,"Subtle",10)
    add_menu_item($DIGrev_presets,"Hall 2",11)
    add_menu_item($DIGrev_presets,"Pianoverb",12)
    add_menu_item($DIGrev_presets,"Reflections",13)
    add_menu_item($DIGrev_presets,"Roomverb 1",14)
    add_menu_item($DIGrev_presets,"Roomverb 2",15)
    add_menu_item($DIGrev_presets,"Roomverb 3",16)
    add_menu_item($DIGrev_presets,"Slapback",17)
    add_menu_item($DIGrev_presets,"Tunnel Slapback",18)
    add_menu_item($DIGrev_presets,"Warehouse",19)
    
    set_control_par_str(get_ui_id($DIGrev_presets),$CONTROL_PAR_PICTURE,"dropdown_7_100x19_2")
    set_control_par(get_ui_id($DIGrev_presets),$CONTROL_PAR_FONT_TYPE,19)
    make_persistent($DIGrev_presets)
    $DIG_rev_selected := get_control_par(get_ui_id($DIGrev_presets),$CONTROL_PAR_SELECTED_ITEM_IDX)+1
    
    {---DIGTIAL REVERB---}
    
    declare ui_knob $DIGREVdry(0,1000000,1000)
    declare ui_knob $DIGREVwet(0,1000000,1000)
    declare ui_knob $DIGREVpredly(0,1000000,1000)
    declare ui_knob $DIGIREVsize(0,1000000,1000)
    declare ui_knob $DIGIREVdamping(0,1000000,1000)
    
    move_control($DIGREVdry,3,1)
    move_control($DIGREVwet,3,3)
    move_control($DIGREVpredly,3,5)
    move_control($DIGIREVsize,3,7)
    move_control($DIGIREVdamping,3,9)
    
    set_knob_label($DIGREVdry, get_engine_par_disp($ENGINE_PAR_SEND_EFFECT_DRY_LEVEL,-1,$DIGREV_slot,1))
    set_knob_label($DIGREVwet, get_engine_par_disp($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,-1,$DIGREV_slot,1))
    set_knob_label($DIGREVpredly, get_engine_par_disp($ENGINE_PAR_RV_PREDELAY,-1,$DIGREV_slot,1))
    set_knob_label($DIGIREVsize, get_engine_par_disp($ENGINE_PAR_RV_SIZE,-1,$DIGREV_slot,1))
    set_knob_label($DIGIREVdamping, get_engine_par_disp($ENGINE_PAR_RV_DAMPING,-1,$DIGREV_slot,1))
    
    set_knob_defval($DIGREVdry,396851)
    set_knob_defval($DIGREVwet,396851)
    set_knob_defval($DIGREVpredly,576983)
    set_knob_defval($DIGIREVsize,750000)
    set_knob_defval($DIGIREVdamping,500000)
    
    set_text($DIGREVdry,"Dry")
    set_text($DIGREVwet,"Wet")
    set_text($DIGREVpredly,"Predelay")
    set_text($DIGIREVsize,"Size")
    set_text($DIGIREVdamping,"Damping")
    
    set_knob_unit($DIGREVdry, $KNOB_UNIT_DB)
    set_knob_unit($DIGREVwet, $KNOB_UNIT_DB)
    set_knob_unit($DIGREVpredly, $KNOB_UNIT_MS)
    set_knob_unit($DIGIREVsize, $KNOB_UNIT_PERCENT)
    set_knob_unit($DIGIREVdamping, $KNOB_UNIT_PERCENT)
    
    $DIGREVdry:=_get_engine_par($ENGINE_PAR_SEND_EFFECT_DRY_LEVEL,-1,$DIGREV_slot,1)
    $DIGREVwet:=_get_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,-1,$DIGREV_slot,1)
    $DIGREVpredly:=_get_engine_par($ENGINE_PAR_RV_PREDELAY,-1,$DIGREV_slot,1)
    $DIGIREVsize:=_get_engine_par($ENGINE_PAR_RV_SIZE,-1,$DIGREV_slot,1)
    $DIGIREVdamping:=_get_engine_par($ENGINE_PAR_RV_DAMPING,-1,$DIGREV_slot,1)
    
    set_control_par(get_ui_id($DIGREVdry),$CONTROL_PAR_MOUSE_BEHAVIOUR,-500)
    set_control_par(get_ui_id($DIGREVwet),$CONTROL_PAR_MOUSE_BEHAVIOUR,-500)
    set_control_par(get_ui_id($DIGREVpredly),$CONTROL_PAR_MOUSE_BEHAVIOUR,-500)
    set_control_par(get_ui_id($DIGIREVsize),$CONTROL_PAR_MOUSE_BEHAVIOUR,-500)
    set_control_par(get_ui_id($DIGIREVdamping),$CONTROL_PAR_MOUSE_BEHAVIOUR,-500)
    
    make_persistent($DIGREVdry)
    make_persistent($DIGREVwet)
    make_persistent($DIGREVpredly)
    make_persistent($DIGIREVsize)
    make_persistent($DIGIREVdamping)
    
    read_persistent_var($DIGREVdry)
    read_persistent_var($DIGREVwet)
    read_persistent_var($DIGREVpredly)
    read_persistent_var($DIGIREVsize)
    read_persistent_var($DIGIREVdamping)
    
    end on
    
    {---DIGREV PRESETS---}
    
    on ui_control($DIGrev_presets)
    $DIG_rev_selected := get_control_par(get_ui_id($DIGrev_presets),$CONTROL_PAR_SELECTED_ITEM_IDX)+1
    set_engine_par($ENGINE_PAR_SEND_EFFECT_DRY_LEVEL,%DIGrev_presets_array[1+(7*($DIG_rev_selected-1))],-1,$DIGrev_slot,1)
    set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,%DIGrev_presets_array[2+(7*($DIG_rev_selected-1))],-1,$DIGrev_slot,1)
    set_engine_par($ENGINE_PAR_RV_PREDELAY,%DIGrev_presets_array[3+(7*($DIG_rev_selected-1))],-1,$DIGrev_slot,1)
    set_engine_par($ENGINE_PAR_RV_SIZE,%DIGrev_presets_array[4+(7*($DIG_rev_selected-1))],-1,$DIGrev_slot,1)
    set_engine_par($ENGINE_PAR_RV_DAMPING,%DIGrev_presets_array[5+(7*($DIG_rev_selected-1))],-1,$DIGrev_slot,1)
    set_engine_par($ENGINE_PAR_RV_STEREO,%DIGrev_presets_array[6+(7*($DIG_rev_selected-1))],-1,$DIGrev_slot,1)
    set_engine_par($ENGINE_PAR_RV_COLOUR,%DIGrev_presets_array[7+(7*($DIG_rev_selected-1))],-1,$DIGrev_slot,1)
    
    set_knob_label($DIGREVdry, get_engine_par_disp($ENGINE_PAR_SEND_EFFECT_DRY_LEVEL,-1,$DIGREV_slot,1))
    set_knob_label($DIGREVwet, get_engine_par_disp($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,-1,$DIGREV_slot,1))
    set_knob_label($DIGREVpredly, get_engine_par_disp($ENGINE_PAR_RV_PREDELAY,-1,$DIGREV_slot,1))
    set_knob_label($DIGIREVsize, get_engine_par_disp($ENGINE_PAR_RV_SIZE,-1,$DIGREV_slot,1))
    set_knob_label($DIGIREVdamping, get_engine_par_disp($ENGINE_PAR_RV_DAMPING,-1,$DIGREV_slot,1))
    
    end on
    
    {---DIGITAL REVERB---}
    
    on ui_control($DIGREVdry)
    _set_engine_par($ENGINE_PAR_SEND_EFFECT_DRY_LEVEL,$DIGREVdry,-1,$DIGREV_slot,1)
    set_knob_label($DIGREVdry, get_engine_par_disp($ENGINE_PAR_SEND_EFFECT_DRY_LEVEL,-1,$DIGREV_slot,1))
    end on
    
    on ui_control($DIGREVwet)
    _set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,$DIGREVwet,-1,$DIGREV_slot,1)
    set_knob_label($DIGREVwet, get_engine_par_disp($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,-1,$DIGREV_slot,1))
    end on
    
    on ui_control($DIGREVpredly)
    _set_engine_par($ENGINE_PAR_RV_PREDELAY,$DIGREVpredly,-1,$DIGREV_slot,1)
    set_knob_label($DIGREVpredly, get_engine_par_disp($ENGINE_PAR_RV_PREDELAY,-1,$DIGREV_slot,1))
    end on
    
    on ui_control($DIGIREVsize)
    _set_engine_par($ENGINE_PAR_RV_SIZE,$DIGIREVsize,-1,$DIGREV_slot,1)
    set_knob_label($DIGIREVsize, get_engine_par_disp($ENGINE_PAR_RV_SIZE,-1,$DIGREV_slot,1))
    end on
    
    on ui_control($DIGIREVdamping)
    _set_engine_par($ENGINE_PAR_RV_DAMPING,$DIGIREVdamping,-1,$DIGREV_slot,1)
    set_knob_label($DIGIREVdamping, get_engine_par_disp($ENGINE_PAR_RV_DAMPING,-1,$DIGREV_slot,1))
    end on
    This would act similar to yours but would control say a digital reverb in slot 4 of the Instrument Insert FX. Arrays come in handy as they give you automatic control over the parameters of the reverb by selecting the item from the dropdown. They also useful as I mentioned for Tables etc & for stroring your own presets.

    Basically you firstly set up your ARRAY. That is all the numbers one after the other. This tells Kontakt the value to set the control. To find this value in an empty script slot use the command

    Code:
    on init 
    
    message(get_engine_par( $ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,-1,1,0)) 
    
    end on 
    Hit apply & in the bottm left corner will appear the number you need to use for your array. Obviously with different controls you will point Kontakt to the engine parameter with a different command i.e $ENGINE_PAR_CH_DEPTH for chorus depth etc, etc.

    Once u have set up a few they become invaluable tools in setting up Preset functions & loading & storing parameters for Tables, Arpeggiators etc.

    They very useful & can be used to control anything really but in a more precise fashion.

    There are of course quicker ways of declaring the same command & different methods but this just one that I wrote quickly.

    With custom graphics you of course have to modify the script accordingly but just about any sort of basic setup is possible.

    Anyway hopefully it might help someone out there trying to learn KSP like myself LOL!

    Just thought it would make a good addition & seemed a logical place to do it :wink:
     
    • Interesting Interesting x 1
    • Useful Useful x 1
    • List
  21. Moonlight

    Moonlight Audiosexual

    Joined:
    Jun 12, 2011
    Messages:
    2,470
    Likes Received:
    760
    Location:
    Earth
    A collection of basics without any "candy" such as graphics would be great for beginners.
    eg:
    how to access and modify:
    Filter,
    Effect Parameters.
    Envelope
    Persistence of Values
    How to copy all Parameters of an engine to another

    Cheers
     
Loading...
Similar Threads - Kontakt Scripting Kontakt Forum Date
KSP Kontakt scripting issues with custom knob and velocity value to mirror on play note (visual FX) Kontakt Mar 21, 2023
Kontakt Scripting Kontakt Jul 27, 2017
Tutorials for Kontakt Scripting? Kontakt Jun 26, 2017
Kontakt Scripting - Building an Instrument From Scratch AudioSex Academy Aug 5, 2015
Scripting Tools For Kontakt 5 Kontakt Jul 26, 2015
Loading...