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

Dry/Wet control of inserts

Discussion in 'Scripting Workshop' started by t3am1, Feb 22, 2019.

  1. t3am1

    t3am1 Member

    Messages:
    101
    Eyo=)

    I wanted to send the "Dry/Wet" controls of the plate reverb insert (in slot 1 of the "insert effects") to the GUI...

    Is this possible?

    Thanks=)
     
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Yes. See the listing of engine parameters in KSP Reference.
     
  3. t3am1

    t3am1 Member

    Messages:
    101
    Hey you=)

    Thanks for confirming... )

    I searched through the ksp reference, nils quick script guide and anything online and I couldn't find it... after looking all over, I posted here, kinda hoping that some magical dragon was around:p...

    The only thing that I saw that comes close is :

    $ENGINE_PAR_SEND_EFFECT_DRY_LEVEL
    Dry amount of send effects when used in an insert chain

    and

    $ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN
    When used with send effects, this controls either:
    Wet amount of send effects when used in an insert chain
    Return amount of send effects when used in a send chain

    But this would be for the send effects slots, not the insert slots (If I read correctly)

    -

    (this is my first kontakt{heh} with the ksp - I had no troubles finding most other main script parameters in the reference manual btw...)

    thanks for being here and thanks for sharing some of your knowledge=)
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Please read again. Those commands cover both the send FX ("send chain") and insert FX ("insert chain") scenario.
     
  5. t3am1

    t3am1 Member

    Messages:
    101
    Rise n Shine:p
    Ah, thanks... It makes more sense now after some well needed sleep ;)
    so its is a mashup of send and insert functions... Guess its too late now to have seperate/independent commands for send and insert:p (so one could search the manual for "insert effects" and see a dedicated dry/wet control with the other parameters..)
    like this:
    Plate Reverb
    $ENGINE_PAR_PR_DECAY
    $ENGINE_PAR_PR_LOWSHELF
    $ENGINE_PAR_PR_HIDAMP
    $ENGINE_PAR_PR_PREDELAY
    $ENGINE_PAR_PR_STEREO
    $ENGINE_PAR_PR_WET
    $ENGINE_PAR_PR_DRY


    - so one has to firstly define if it is a send or an insert somehow...

    I assume that:
    Code:
    $ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN(80000,-1,0,1)
    would choose and set the value of the of the wet level of the plate reverb in the first slot of the insert effects to 8%..?

    Thanks for your patience;)
     
    Last edited: Feb 24, 2019
  6. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    You "define" if it's an insert or a send by loading the effect in insert FX or send FX chain. Send effects are those that are usually used in a send-return pattern: chorus, flanger, phaser, delay, reverb. All others are insert FX. However send-type FX can also be loaded as inserts, in which case instead of send/return they have dry/wet.

    No. Dry/wet parameters don't have a linear scaling at all, since it's a dB value. You cannot expect that 80000 will result in 8%. For dry/wet you would want to use knob values only up to something like 397000, because that's 0 dB, if you go higher than that you can get some nasty clipping very soon (of course depending on gain staging in the instrument etc).
     
  7. t3am1

    t3am1 Member

    Messages:
    101
    yeah, i had inserted the plate reverb into insert slot 1 - hence, defined it... I then wanted to add a knob for PR (plate reverb) wet amount on the gui... (so far it is only a wallpaper:p) - Here I could not find how to set exactly that control in the script...
    from your help and the manual , I had come to this conclusion:
    Code:
    $ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN(80000,-1,0,1)
    My thinking with $ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN(80000,-1,0,1) was :
    $ENGINEblabla-> talk to the wet slider
    800000-> 8% of total spectrum
    -1 -> parameter is on instrument level
    0 -> slot 1 (since it is zero based)
    1 -> generic (insert effect)

    reading from right to left: its an insert effect(1) in slot 1 (0) .. it is on instrument level{not in a bus} (-1) and is 8% wet (80000) pointing at the Wet level($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN)

    -interesting.. that would mean that kontakt is always parallel processing at 100% and then balancing between the output levels with the dry/wet controls..
    -Since it goes from 0-1000000, i thought that 80000 would be 8% of the total spectrum range of the wet slider.. (i can turn it up to maximum wet without clipping btw... they all have a suitable gain set for this.. ;) - thx for the heads up tho=)
    -Thanks for the 397000 0dB tip too- this will surely come in handy in the future=)


    Well, this is what I came up with so far (in theory)
    Code:
    on init
    declare ui_knob $Wet_Knob (0,1000000,1)
    $ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN(80000,-1,0,1)
    end on
    
    while I was just now searching for ksp knobs while also writing this post, I came across this video : https://www.native-instruments.com/...ur-first-knob-free-kontakt-instrument.337631/ - looks like a good helper vid...
    .. seems that I got somewhat close for a first try , but would have also missed the "on_ui_control" part at some point...lol..

    This was all a theoretical exercise... I will now go to the kontakt script editor and test this.. I will report back with my findings in a sec....;)

    Thank you very much for your help=)
     
    Last edited: Feb 24, 2019
  8. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Well you have separate adjustment of dry AND wet levels. If you keep dry at 100%, then yes, it's running FX in parallel then adding it to the dry signal.

    No. Different engine parameters have different scaling between real-world values and internal 0-1000000 range. Not all are linear.
     
  9. t3am1

    t3am1 Member

    Messages:
    101
    OK, so far so good with this here:

    Code:
    on init
    make_perfview
    set_ui_height (6)
    
    
    declare ui_knob $Knob_1 (0,1000000,1)
    set_text($Knob_1,"Wet")
    move_control($Knob_1,1,10)
    end on
    
    on ui_control ($Knob_1)
    set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, $Knob_1,-1,0,1)
    
    set_knob_label($Knob_1, get_engine_par_disp($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,-1,0,1))
    
    
    end on
    
    
    ---------------------------------------------------------------------------------------------------------------------------------
    but, something is still a little confusing.. I would like the start position to be at 80000 (8%)
    If I write it like this:
    Code:
    set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, 80000,-1,0,1)
    
    or like this:
    Code:
    set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, $Knob_1, 80000,-1,0,1)
    
    it does not work (start position is not at 80000 or I get a "red line"..)

    Do you know what is missing so that the "default" position of the knob is at 80000?

    cheers n thx=)
     
    Last edited: Feb 24, 2019
  10. t3am1

    t3am1 Member

    Messages:
    101
    Ah, thanks for that=)
    (also for reminding me that it is a wet AND dry, and not one knob for wet/dry..lol)

    I am assuming though that, in this case and for this control, 80000 would be approx. 8% of the full range... (if linear and 0=0% and 1000000=100%)
     
    Last edited: Feb 23, 2019
  11. corbo-billy

    corbo-billy NI Product Owner

    Messages:
    652
    In the init callback: $Knob_1 := 80000
     
    • Like Like x 1
  12. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Also please use CODE tags when pasting code in posts...

    80000 will be around -40 dB for this parameter, since it has a logarithmic scale. Actually it's broken in two curves, I believe, there's different scaling from 0-397000 and from 397000-1000000, because the first part covers all the way from -inf to 0 dB (-inf being around -180 dB IIRC), and the other part covers from 0 dB to 24 dB, which is much less dB to cover.


    I always use a lookup table that makes sure that dry/wet is set in % rather than dB, which makes it more linear in behavior (plus makes a single dry/wet knob making so much easier). Goes like this:

    Code:
    on init
        declare %drywet[1001] := (0, 46419, 58484, 66479, 73299, 79042, 83758, 88264, 92351, 95879, 99377, 102644, 105529, 108441, 111205, 113839, 116201, 118620, 120943, 123181, 125207, 127299, 129323, 131287, 133076, 134932, 136628, 138391, 140110, 141685, 143326, 144832, 146404, 147944, 149451, 150838, 152289, 153713, 155111, 156400, 157751, 159080, 160386, 161592, 162859, 164029, 165259, 166396, 167591, 168770, 169933, 171008, 172140, 173258, 174293, 175384, 176461, 177459, 178512, 179487, 180516, 181533, 182477, 183473, 184458, 185432, 186337, 187233, 188179, 189116, 189986, 190905, 191816, 192662, 193556, 194386, 195264, 196081, 196944, 197800, 198649, 199437, 200220, 201048, 201870, 202634, 203442, 204195, 204991, 205782, 206517, 207296, 208021, 208741, 209503, 210260, 210964, 211711, 212406, 213142, 213874, 214555, 215232, 215949, 216662, 217326, 217985, 218684, 219379, 220027, 220671, 221353, 222032, 222664, 223292, 223959, 224581, 225199, 225854, 226506, 227113, 227718, 228359, 228957, 229551, 230183, 230771, 231395, 231977, 232556, 233171, 233745, 234354, 234921, 235487, 236086, 236646, 237202, 237794, 238345, 238894, 239476, 240021, 240598, 241101, 241673, 242207, 242774, 243303, 243830, 244389, 244911, 245431, 245949, 246499, 246978, 247523, 248032, 248574, 249045, 249581, 250082, 250614, 251077, 251605, 252098, 252589, 253077, 253564, 254082, 254565, 255047, 255526, 256004, 256480, 256954, 257427, 257929, 258398, 258865, 259331, 259795, 260257, 260718, 261177, 261634, 262120, 262544, 262997, 263448, 263927, 264346, 264792, 265267, 265710, 266123, 266563, 267003, 267440, 267877, 268311, 268745, 269177, 269608, 270037, 270465, 270891, 271288, 271712, 272136, 272556, 272977, 273396, 273813, 274229, 274617, 275030, 275443, 275854, 276237, 276646, 277054, 277460, 277866, 278243, 278647, 279049, 279449, 279822, 280221, 280619, 280988, 281384, 281778, 282145, 282537, 282928, 283318, 283681, 284069, 284430, 284816, 285201, 285558, 285941, 286298, 286653, 287033, 287412, 287765, 288141, 288492, 288868, 289242, 289590, 289937, 290309, 290654, 291000, 291368, 291735, 292078, 292420, 292784, 293125, 293488, 293826, 294164, 294525, 294860, 295195, 295530, 295887, 296220, 296552, 296907, 297238, 297567, 297897, 298248, 298576, 298903, 299229, 299554, 299902, 300227, 300550, 300872, 301194, 301516, 301836, 302179, 302498, 302794, 303134, 303451, 303768, 304083, 304398, 304713, 305027, 305340, 305653, 305965, 306276, 306586, 306897, 307206, 307493, 307801, 308109, 308416, 308722, 309028, 309333, 309638, 309920, 310223, 310527, 310828, 311109, 311410, 311710, 312010, 312309, 312587, 312885, 313183, 313459, 313755, 314051, 314326, 314621, 314894, 315189, 315481, 315754, 316046, 316317, 316609, 316878, 317169, 317458, 317727, 317995, 318283, 318550, 318837, 319104, 319390, 319655, 319920, 320205, 320469, 320753, 321016, 321279, 321541, 321822, 322084, 322345, 322625, 322885, 323145, 323404, 323663, 323941, 324199, 324456, 324714, 324971, 325227, 325483, 325758, 325994, 326268, 326522, 326775, 327029, 327282, 327535, 327787, 328039, 328291, 328542, 328793, 329024, 329274, 329524, 329773, 330022, 330270, 330518, 330766, 330995, 331242, 331488, 331716, 331962, 332207, 332452, 332697, 332923, 333167, 333411, 333636, 333879, 334104, 334346, 334588, 334811, 335053, 335275, 335516, 335738, 335979, 336200, 336439, 336660, 336899, 337119, 337339, 337577, 337796, 338033, 338252, 338470, 338706, 338924, 339142, 339359, 339594, 339811, 340028, 340244, 340477, 340693, 340908, 341123, 341338, 341552, 341766, 341981, 342212, 342425, 342621, 342851, 343064, 343276, 343470, 343682, 343894, 344123, 344317, 344527, 344737, 344948, 345158, 345367, 345560, 345769, 345978, 346187, 346396, 346586, 346794, 347002, 347193, 347400, 347589, 347796, 348003, 348192, 348398, 348604, 348793, 348981, 349186, 349391, 349579, 349766, 349970, 350157, 350361, 350548, 350734, 350937, 351124, 351310, 351512, 351697, 351899, 352084, 352269, 352454, 352655, 352822, 353023, 353207, 353390, 353574, 353757, 353940, 354123, 354306, 354489, 354671, 354853, 355051, 355216, 355398, 355579, 355761, 355941, 356122, 356303, 356483, 356648, 356827, 357007, 357187, 357366, 357530, 357709, 357888, 358051, 358229, 358408, 358570, 358748, 358910, 359088, 359266, 359427, 359588, 359765, 359942, 360103, 360264, 360440, 360601, 360761, 360937, 361097, 361257, 361432, 361591, 361751, 361910, 362084, 362243, 362402, 362561, 362735, 362893, 363051, 363210, 363368, 363525, 363683, 363840, 363998, 364155, 364312, 364469, 364626, 364782, 364939, 365079, 365236, 365392, 365548, 365704, 365859, 366000, 366155, 366310, 366465, 366605, 366760, 366900, 367055, 367209, 367363, 367502, 367641, 367795, 367934, 368088, 368226, 368379, 368518, 368671, 368809, 368962, 369100, 369237, 369375, 369528, 369665, 369802, 369939, 370092, 370228, 370365, 370502, 370639, 370775, 370911, 371047, 371199, 371320, 371456, 371606, 371742, 371863, 371998, 372134, 372269, 372404, 372540, 372675, 372810, 372930, 373065, 373199, 373334, 373453, 373588, 373722, 373842, 373976, 374095, 374228, 374347, 374482, 374600, 374734, 374853, 374986, 375105, 375238, 375356, 375474, 375607, 375725, 375844, 375976, 376094, 376212, 376329, 376462, 376579, 376697, 376814, 376932, 377049, 377167, 377283, 377400, 377532, 377635, 377751, 377868, 377985, 378102, 378218, 378335, 378451, 378553, 378669, 378785, 378902, 379003, 379119, 379235, 379336, 379452, 379568, 379683, 379785, 379900, 380002, 380117, 380218, 380333, 380434, 380549, 380649, 380750, 380865, 380966, 381066, 381181, 381281, 381381, 381482, 381596, 381696, 381797, 381897, 381997, 382096, 382197, 382296, 382396, 382496, 382610, 382695, 382794, 382894, 382994, 383093, 383193, 383292, 383377, 383476, 383575, 383675, 383773, 383859, 383957, 384056, 384141, 384240, 384324, 384423, 384522, 384606, 384705, 384789, 384888, 384972, 385057, 385155, 385239, 385323, 385422, 385506, 385590, 385674, 385772, 385856, 385940, 386024, 386108, 386205, 386289, 386373, 386457, 386540, 386624, 386708, 386791, 386875, 386958, 387028, 387111, 387195, 387278, 387361, 387445, 387514, 387598, 387681, 387750, 387833, 387916, 387986, 388068, 388151, 388221, 388290, 388372, 388456, 388524, 388594, 388676, 388745, 388814, 388897, 388966, 389035, 389117, 389186, 389255, 389324, 389392, 389475, 389544, 389612, 389680, 389749, 389818, 389886, 389955, 390023, 390092, 390160, 390228, 390297, 390352, 390420, 390489, 390557, 390625, 390680, 390748, 390816, 390871, 390939, 391007, 391062, 391130, 391184, 391252, 391307, 391375, 391429, 391497, 391551, 391606, 391674, 391728, 391783, 391850, 391905, 391959, 392013, 392067, 392135, 392189, 392244, 392297, 392352, 392406, 392460, 392514, 392568, 392622, 392677, 392730, 392784, 392825, 392879, 392933, 392987, 393041, 393082, 393135, 393189, 393230, 393283, 393337, 393378, 393431, 393472, 393526, 393566, 393620, 393661, 393714, 393755, 393795, 393848, 393889, 393929, 393983, 394023, 394063, 394104, 394144, 394197, 394238, 394278, 394318, 394358, 394398, 394439, 394479, 394519, 394559, 394599, 394640, 394679, 394706, 394747, 394786, 394827, 394853, 394894, 394934, 394960, 395001, 395040, 395067, 395107, 395134, 395174, 395200, 395241, 395267, 395307, 395334, 395361, 395401, 395427, 395468, 395494, 395520, 395548, 395574, 395614, 395640, 395667, 395694, 395720, 395747, 395774, 395800, 395827, 395853, 395880, 395907, 395933, 395960, 395986, 395999, 396026, 396053, 396079, 396092, 396119, 396145, 396159, 396186, 396199, 396225, 396252, 396265, 396292, 396305, 396331, 396344, 396358, 396385, 396398, 396411, 396438, 396451, 396464, 396477, 396504, 396517, 396530, 396544, 396557, 396570, 396583, 396596, 396610, 396623, 396636, 396649, 396663, 396676, 396689, 396702, 396702, 396716, 396729, 396742, 396742, 396755, 396768, 396768, 396782, 396782, 396795, 396809, 396809, 396821, 396821, 396821, 396835, 396835, 396848, 396848, 396848, 396848, 396848, 396848, 396848, 396848, 396849, 396849, 396849, 396849, 396849, 396849, 396850)
    
        declare ui_knob $Mix (0, 1000, 10)
    
        set_knob_defval($Mix, 500)
        set_knob_unit($Mix, $KNOB_UNIT_PERCENT)
    
        make_persistent($Mix)
    end on
    
    on ui_control ($Mix)
        set_engine_par($ENGINE_PAR_SEND_EFFECT_DRY_LEVEL, %drywet[1000 - $Mix], -1, 0, 1)
        set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, %drywet[$Mix], -1, 0, 1)
    end on
     
    Last edited: Feb 23, 2019
    • Like Like x 2
  13. t3am1

    t3am1 Member

    Messages:
    101
    That did it, thx=)

    Will do=)


    interesting.. maybe the first part has a LS (slope length and steepness) Factor of x7 compared to part 2...



    Wowie man.. lol... I will have to test this one out soon.. thx =)
    -strangely, that code you pasted somehow makes sense... lol.. 2 days ago it would have still been witchcraft:p thanks=)
    - hats off to whomever noted those numbers too;) (if it was done manually)
    - I wonder why there are so many duplicate number values at the bottom though... - might be personal preference;)

    Again, thank you very much for sharing this and your help=)


    So here is the working "preliminary" code of a "wet amount knob" on the GUI for an "Insert effect" in "slot 1"
    (for use with with a 640x450px wallpaper)
    :
    Code:
    on init
    make_perfview
    set_ui_height (6)
    
    
    declare ui_knob $Knob_1 (0,1000000,1)
    set_text($Knob_1,"Wet")
    move_control($Knob_1,1,10)
    
    $Knob_1 :=205000
    set_knob_label($Knob_1, get_engine_par_disp($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,-1,0,1))
    
    end on
    
    on ui_control ($Knob_1)
    set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, $Knob_1,-1,0,1)
    
    set_knob_label($Knob_1, get_engine_par_disp($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,-1,0,1))
    
    
    end on
    
    Thank you very much for everything=)
     
    Last edited: Feb 24, 2019
  14. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    It was done using Big Bob's math library with some math twiddling, the curve results in some repeated values, it's no biggie.
     
  15. Gabriel Dib

    Gabriel Dib NI Product Owner

    Messages:
    88
    Where is this plate reverb?

    Didn't find the parameters below on the KSP reference. Am I going blind already?


     
  16. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Plate reverb is one of new effects added to Kontakt 6. :)
     
  17. Cal545

    Cal545 New Member

    Messages:
    19
    Hey,

    Looking for some advice, So I've created sliders to add my own knobs and its all coded and working well.

    My main issue is around the wet element with an effect, I added Reverb and Delay however the output was louder, came across this discussion and set them to 397000, perfect worked so thanks for that part.

    I wanted to add a slider for the rotator wet and used the $ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN at 397000 however this time it doesn't work the same, so at 397000 it wont ever go to 100% like the Reverb and Delay and when I increase to 1000000 I get the issue of it going to loud but I get the full effect. However in the insert area the Delay/Reverb wet is a slider but the rotator wet is a knob, am i missing something or do I need to do something else?

    thanks

    Cal
     
  18. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Rotator wet level is just a completely different engine parameter. That one does require (0, 1000000) range.
     
  19. Cal545

    Cal545 New Member

    Messages:
    19
    Ok cool, is there anyway to tame the output when you increase the wet on the rotator so its more consistant or is there any other methods to look at?

    Thanks
     
  20. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    You could slighty reduce the output gain as you increase the value of Wet, I suppose.