Help with changing Send Levels with 1 instrument

GreyVlad
GreyVlad Member Posts: 1 Newcomer

Hey All,


I got this piece of script...

....

on ui_control($KNOB)

set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,$NI_SEND_BUS,-1,0,1)

end on

...


And I'm trying to use to change the level of the send effects with just 1 knob, but I can't seem to get it to work.

Can anyone help please? I've been at this for 6 hours now.


Comments

  • Gablux
    Gablux Member Posts: 71 Member
    edited December 2022

    check this code to understand how these things work:

    on init
      declare ui_knob $knob1 (1,100,1)
      declare ui_knob $knob2 (1,100,1)
    end on
    
    on ui_control ($knob1)
      set_engine_par($ENGINE_PAR_SENDLEVEL_0, $knob1*10000, -1, 0, $NI_INSERT_BUS)	
    end on
    
    on ui_control ($knob2)
      set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, $knob2*10000, -1, 0, $NI_SEND_BUS)	
    end on
    

    Note that I set knobs range 1-100 for simplicity but the engine parameters range is 0-1000000, hence multiplying the knobs' values by 10000.

    Also to access the other send levels in the sends module, use the constants $ENGINE_PAR_SENDLEVEL_1, $ENGINE_PAR_SENDLEVEL_2, etc

    Attention to where the send module is inserted: in this case in slot 0.

    Use what I call the japanese bullet train pilot method - point at each argument (values passed by the coder) in the set_engine_par function and call it out in loud voice:

    first argument tell the function which parameter it should affect.

    second argument is the value to pass to that parameter

    third argument is which group is going to be affected. If not in the group level, then -1 (for inserts, busses, sends and main).

    fourth argument is the slot index. All of groups, instrument insert, busses, sends and main have 8 slots indexed from 0 to 7.

    last argument is used to identify the location of the affected parameter+slot, in Kontakt 6 we use constants for that:

    insert -> $NI_INSERT_BUS

    send -> $NI_SEND_BUS

    busses -> $NI_BUS_OFFSET+bus_index (0-15)

    main -> $ NI_MAIN_BUS

    groups -> -1

Back To Top