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

Pitch Bend Range via Script

Discussion in 'Scripting Workshop' started by James Worster, May 8, 2018.

  1. James Worster

    James Worster NI Product Owner

    Messages:
    87
    I'm trying to alter the pitch bend range via a script.

    I have a modulation amount slider for the pitch bend range (mod source: "pitch bend", mod destination: "pitch") called "PB_PITCH", but I can't figure out how to refer to this in the "set_engine_par" command.

    Usually the name of the modulator itself would be used to specify the mod index, but since the modulation source "pitch bend" is a permanent thing, I can't right click on it and give it a name.

    This is as far as I've got:

    Code:
    set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY, $sliderBendRange, 0, ...
    Thanks for the help!
     
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Please read the sticky thread which mentions everything about how to do modulation in KSP.

    You can. Any mod destination can be renamed.
     
  3. James Worster

    James Worster NI Product Owner

    Messages:
    87
    Had a look at that but still can't seem to figure it out...

    I'm sure I'm being very stupid, but where do I rename the pitch mod source?

    I get how to rename the target... i.e. the little target strip in the Source section, but not how to rename the actual mod source.

    I understand how you'd do it if for example you had an LFO modulator linked to the pitch (since I could rename the LFO)... but just can't figure out how to do it with pitch bend as the source.

    Hopefully that makes sense!

    Cheers man
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    The target strip IS the mod source. External modulators like MIDI CC, pitch bend, aftertouch, don't have a "source" per se (they're external, not internal like LFO, envelopes, so they don't show in the bottom Modulation section).
     
  5. James Worster

    James Worster NI Product Owner

    Messages:
    87
    Got it! Thanks a lot!
     
  6. Breakma

    Breakma New Member

    Messages:
    4
    Good evening !
    I am actually constructing a cello instrument in Kontakt and i was wondering how to script the slider for the Pitch range (from 0 to 12 st) so i can modify it in the performance view (the pitch bend applies to all of my 3 groups)
    I just began scripting in Kontakt for the record o_O
    Many thanks !
     
  7. medusa

    medusa NI Product Owner

    Messages:
    239
    You should read Mario's sticky thread on modulation, but most of the time this script will work:


    Code:
    on init
    make_perfview
    declare %depth[13] := (500000, 719904, 775202, 814980, 845738, 873260, 897935, 917619, 937443, 955086, 970104, 986011, 1000000)
    declare ui_knob $Range (0,12,1)
    set_knob_unit ($Range, $KNOB_UNIT_ST)
    declare $i
    make_persistent ($Range)
    end on
    
    on ui_control ($Range)
    $i := 0
    while ($i < $NUM_GROUPS)
    set_engine_par($ENGINE_PAR_INTMOD_INTENSITY, %depth[$Range],$i,find_mod($i,"PB_PITCH"),-1)
    inc($i)
    end while
    end on
    
     
    • Like Like x 1
  8. Gabriel Dib

    Gabriel Dib NI Product Owner

    Messages:
    88
    Hi Medusa,
    Where did you get the numbers for the depth array from?
    I tested, they are precise. I am curious how you came up with them. I am trying to figure out how to come up with the numbers to go all the way to 24 semitones up. Evil Dragon says 1130000 is 24 semitones, but how to calculate the ones in the middle, between 12 and 24?

    Cheers

    gd


     
  9. medusa

    medusa NI Product Owner

    Messages:
    239
    I totally didn't know you could go beyond 12 semitones like that, so you'll have to wait for Evil Dragon to chime in with the numbers.
    I probably got that 12 step array from him in the first place.

    Usually if I want to go beyond 12 I just use two seperate PB assignments and combine them.... but going beyond 1,000,000 is amazing and much cooler.

    I wonder how many other Kontakt parameters can go above 1,000,000 ?
     
  10. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Filter cutoffs can, for example (except old pre-K5 filters). But I think that's just a visual thing - if you check the filters audibly, they probably aren't going too far out of bounds.
     
    Last edited: Apr 7, 2019
  11. medusa

    medusa NI Product Owner

    Messages:
    239
    Ok, but do you have the numbers for two octaves pitch bend, by semitone? That would be awesome....
     
  12. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
  13. medusa

    medusa NI Product Owner

    Messages:
    239
    That's brilliant Mario, thanks for the link! I had no idea that could be done.
     
  14. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Me neither, until I once had one zero too much defined on a slider and crashed Kontakt because it was set to change pitch by 3000 semitones or something :D
     
  15. WocherMusic

    WocherMusic NI Product Owner

    Messages:
    35
    May I allow myself to unbury this thread?
    Is there a way to do this action with a ui_slider as well? I know sliders can't have 12 steps like a knob can, but a knob can't be customized. Probably it won't work, but just to confirm.

    Oh, and by the way – I didn't get what medusa's numbers should achieve (thank you anyway for posting them, they were my first hint!) but if someone would like to have a pitch bend knob that ranges 12 semitones from 0 to 12, here are the values: Evil Dragon's old post
     
    Last edited: Dec 18, 2021
  16. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Of course you can just replace ui_knob with ui_slider and it will work. You also need to remove/adapt the set_knob_ functions.
     
    • Like Like x 1