1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

HOW TO: MODULATION IN KONTAKT VIA KSP

Discussion in 'Scripting Workshop' started by EvilDragon, Jan 6, 2016.

  1. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Correct, using the engine parameter command mentioned in the original post.
     
  2. Sound Aesthetics Sampling

    Sound Aesthetics Sampling New Member

    Messages:
    20
    Hi there. I got a problem with external modulators. If i want to assign the keyposition to the Pan for improved realism this work all fine, but i would like to have a slider, that controls the intensity of this modulator. I am more a sounddesigner than a programmer. And the modulation stuff was the only thing i couldnt handle by searching the forum posts.
     
  3. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    This is explained in the first post, please read it :)
     
  4. CK_S

    CK_S NI Product Owner

    Messages:
    73
    i get expression expected error here... strange because the ui control works

    Code:
    set_control_par_str ($slider3143302,$CONTROL_PAR_LABEL,...
        get_engine_par_disp($ENGINE_PAR_INTMOD_INTENSITY,1,find_mod(1,"LFO_SINE"),find_target(1,find_mod(1,"LFO_SINE"),
    
    "LFO_SINE_PITCH"))
    set_text ($LFOINTVal,get_engine_par_disp($ENGINE_PAR_MOD_TARGET_INTENSITY,1,find_mod(1,"LFO_SINE") ,find_target
    
    (1,find_mod(1,"LFO_SINE"), "LFO_SINE_PITCH"))
    
     
  5. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    You're missing one ending parenthesis in both lines.
     
    • Like Like x 1
  6. CK_S

    CK_S NI Product Owner

    Messages:
    73
    Hi again ,I was thinking if there is a way to copy paste the names of the mods that i rename because i can't and i have to type each one again to the .nki presets i have made
     
  7. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    You can only copy groups out, then all associated modulators go with them.
     
  8. BenjMarx

    BenjMarx New Member

    Messages:
    8
    Quick Question:

    I have successfully set up LFOs to my pan knobs, but the pan knob UI are not showing that they are oscillating to the rate of the LFO. The groups are panning exactly as they should, but the UI knobs themselves don't show it.

    I've tried this:
    Code:
    $SmoothPan := get_engine_par(ENGINE_PAR_PAN, 3, 2, 0)
    but it doesn't seem to work.

    Thoughts anyone? Thanks for your time!

    -Ben
     
  9. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Scripted knobs are not supposed to show the modulation in the ring at all (if you're talking about ui_knob).
     
  10. BenjMarx

    BenjMarx New Member

    Messages:
    8
    I guess technically I have them declared as sliders, not knobs. My apologies! Does that affect my question?

    Are you saying that the ui element won't reflect how it's being modulated in the performance view?

    As always, thank you so much for your wisdom, EvilDragon!
     
  11. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    It doesn't affect your question.

    That is correct.

    Scripted controls have no means to get to modulation data from internal modulators, so you cannot show it dynamically as you can see the internal knobs in Kontakt's edit mode.
     
  12. BenjMarx

    BenjMarx New Member

    Messages:
    8
    Ah, that's a small bummer. Thanks again for your time, EvilDragon!
     
  13. cbmtrx

    cbmtrx NI Product Owner

    Messages:
    226
    Hands up everyone who thinks the KSP manual should be written like this. :thumbsup:
     
  14. Nick Dawes

    Nick Dawes New Member

    Messages:
    3
    I'm very new to scripting and I have found this this forum amazingly useful, thank 'EvilDragon' for this particular post. I'm trying to do a very basic custom knob(slider) to control LFO frequency but nothing is happening. I've scripting other knobs to work perfectly but this eludes me so far.
    I'm renamed the LFO to LFO 1 and it is the second Mod I'm using after AHDSR, right clicking the LFO mod shows 'LFO1 (group 0 idx 1 gen 0)

    my script is:

    on ui_control($Tremolo)
    set_engine_par($ENGINE_PAR_INTMOD_FREQUENCY,$Tremolo,0,find_mod(1,"LFO 1"),-1)
    end on

    Does anyone have any tips as to what might be wrong here?
     
  15. corbo-billy

    corbo-billy NI Product Owner

    Messages:
    652
    And in your case, why not just put the number 1 in place of the find_mod(1,"LFO 1") ?
     
  16. Nick Dawes

    Nick Dawes New Member

    Messages:
    3
    That works great, thank you so much for your help!
     
  17. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Group index needs to be the same in set_engine_par part and in find_mod part. You had a mismatch there, 0 for one and 1 for the other. Both should be either 0 or 1. They have to match. In your case they have to be 0. See explanation of find_mod in KSP reference.

    Also, you right clicking on the LFO to get those numbers, this applies only when you want to change LFO parameters (rate, etc.). If you want to adjust mod amount and get THOSE numbers, you need to right click the background of the mod amount slider itself.
     
  18. Nick Dawes

    Nick Dawes New Member

    Messages:
    3
    Great, Thanks for the explanation I understand now. I'm now going to add a bypass toggle button for this LFO using the
    set_entine_par($ENGINE_PAR_INTMOD_BYPASS
    Hopefully it'll be quite straight forward.
     
  19. cbmtrx

    cbmtrx NI Product Owner

    Messages:
    226
    Look at ED's very first example. He's pointing to an LFO in Group 2 (so identified with a 1). Now compare your code.
     
  20. Frederick Rae

    Frederick Rae NI Product Owner

    Messages:
    37
    Ok, I've read this and other pages, spent hours on the problem and I'm getting nowhere.

    I'm extremely new to scripting so apologies in advance for posting what is likely a simple problem and thank you for any help.
    I'm simply trying to link this perfview knob to my LFO Freq which is modulating a filter cutoff in my first slot.
    I've renamed my LFO to "LFO_1", but my kontakt message says that it cannot find it, likely due to the wrong index entry, which the modulator says is 1 when I right click? See picture
    After following the steps and changing things around, but the following code is where i'm currently at.


    on init



    make_perfview

    set_script_title("LFO")


    declare $mod_idx

    $mod_idx := find_mod(1,"LFO_1")


    declare $count


    declare ui_knob $LFO1FREQ (0,1000000,1)

    move_control($LFO1FREQ, 1, 1)

    set_text($LFO1FREQ, "Freq")

    set_knob_unit($LFO1FREQ, $KNOB_UNIT_HZ)

    make_persistent($LFO1FREQ)

    read_persistent_var($LFO1FREQ)


    end on


    on ui_control($LFO1FREQ)



    $count := 0

    while ($count < $NUM_GROUPS)

    set_engine_par($ENGINE_PAR_INTMOD_FREQUENCY,$LFO1FREQ,0,find_mod(1,"LFO_1"),-1)

    inc($count)

    end while


    set_knob_label($LFO1FREQ, get_engine_par_disp($ENGINE_PAR_INTMOD_FREQUENCY, 0,find_mod(1,"LFO_1"),-1))

    end on
     

    Attached Files:

    Last edited: May 3, 2020