How to make the "Tune" Knob move in semitones? And control it in high resolution

nowiamone Member Posts: 14 Newcomer
edited August 2022 in Scripting Workshop

I want to tell the Tune-Knob to move up/down differently. Not in 0.01 or 0.1 steps, but 1.0, which means in semitones. I m using Komplete Kontrol 2.7.2 to host Kontakt, because i m using the KK S MK2 Keyboard.

I ve found a script for the semitone movement, which works for MidiAssignments, like Midi cc11 - but it also brings some issues with it.

Source for the script:

The Script:

on controller

if ($CC_NUM = 11)


end if

end on

I need help with at least 2 issues here, please help:

  1. It is nice to have "Tune" assigned to the Touch-Strip. But: how do i adjust the range of the tuning? I want to narrow it down to 25 Semitones, so that each tiny LED of the Touchstrip represents 1 semitone-movement, and the middle is 0. This would make hitting the right tuning much easier than how it works now, which is too much movement of semitones with just one touch. How do i achieve that? Sadly, i have no knowledge of scripting. And the only non-script option i found is the "From % to %" Values in the Kontakt Interfaces "Midi Automation" Tab, but this doesn't help! I really hate that the first 6 LEDS are -36 semitones, and the last 6 LEDS are +36 semitones! That limits the range of control drastically, and makes hitting the "0.0" really hard. If anything, i would like to control the midrange (between -12 and +12) in more detail, and the values below/above in less detailed resolution....
  2. my favorite Drum from Native Instruments Discovery Series - Middle East, the "Darbuka", has already all 5 Script-Slots used, and they seem to be non-editable. I can't insert the script there! What a pity! Could someone test that please, and tell me what to do?

Is there another way to make the Tune move in different steps (1 instead of 0.01) aside from the above script?

3. how would the script look, if instead of CC11 it shall adress the first Knob (#000 Host Automation-Parameter) of the Komplete Kontrol Keyboard? By the way, i can't even assign "Tune" to my KK-S49MK2 Keyboard-Knobs via "Automation-Host Automation" Assignment, because the Darbuka Drums have NON-REMOVEABLE Assignments for the first 45 Automation-Parameters! Would be nice if someone can check if that's the case on his/her system, too.


  • Jeremy_NI
    Jeremy_NI Customer Care Posts: 7,045 mod

    @EvilDragon Any idea on this one?

  • Reid115
    Reid115 Member Posts: 47 Member
    Answer ✓

    As for the first issue, just do some simple math. Convert the 128 value to a 25 value using real numbers and then cast it to an integer so it snaps to the semitones, like so:

    on controller
        if ($CC_NUM = 11)
            set_engine_par($ENGINE_PAR_TUNE, 500000 + real_to_int(25.0 * int_to_real(%CC[11] - 64) / 128.0) * 13889, -1, -1, -1)
        end if
    end on
  • soundtrax
    soundtrax Member Posts: 14 Member

    Questions 2 + 3: The Darbouka scripts are actually editable. You could use the last script slot (there's nothing important there) - click on the "Apply from..." menu and change it to 'Editor/Patch'. Then it is possible to paste your new code into it.

    It is also possible to change the host automation assignments - just open the "Main" script and copy the whole script into a text or code editor. Search for this line:


    Change the Automation ID number from 0 to 46 (or whatever).

    Now you can paste the edited code back into the nki ("Apply from..." must be set to Editor/Patch again)

  • stephen24
    stephen24 Member Posts: 145 Advisor
    edited August 2022

    on controller

     if ($CC_NUM = 11)


     end if

    end on

    (best answer)

  • EvilDragon
    EvilDragon Moderator Posts: 946 mod
    edited August 2022

    This will work nicely, but there's actually no need to do real to int and vice versa conversions. This will work just as well: 500000 + ((25 * (%CC[$CC_NUM] - 64)) / 128) * 13889.

    Marking yours as best answer since it's using the input arguments (range = 25 semitones) directly and is more undestandable as a consequence. The only thing that is not explained is 13889, but that's a simple deduction of 500000 ep / 36 st = 13888.888...

  • rattala
    rattala Member Posts: 5 Newcomer

    Hi everybody, how can I get the Tune master Knob at group level to be controlled by increment of an exact semitone for each step and for a range of 2 octaves (+1 and -1 OCT) without any CC11 parameter but just the tune knob itself?

    It seemed to be "trivial" if I use a custom Knob with built-in graphics because I think to be able to use:

    declare ui_knob $<variable-name> (<min>,<max>,<display-ratio>)

    but how can I get the same result witha knob with custom graphics that's in reality a slider control that has only min and max parameters if I'm not wrong ?

    thanks a lot for any help, sorry I'm a newbie with KSP :-(

Back To Top