Kontakt Script to change Instrument and keyrange with modulation

lzr1945
lzr1945 Member Posts: 8 Member
edited April 4 in Scripting Workshop

This is an interesting problem. I need a script to change Kontakt Instruments depending on keyrange, and the keyrange will dynamically change with modulation CC#1. This is to select which notes along a guitar fretboard are to be played according to fret positions 0 through 17 assigned by mod wheel.

One monophonic instrument has been created for each of the 6 guitar strings. Each instrument contains 23 sample zones for the notes along the neck. Using modulation to switch between the 6 string instruments is cumbersome and unnatural. It is more natural to switch between 18 fret position groups, with sample notes assigned from the 6 instruments.

Creating 18 fret position groups rather than 6 string groups is not practical. With 10 articulations that would require 180 groups each with 29 note zones!

Is it possible to write a script to switch between Kontakt Instruments specified by keyrange, and, to dynamically change the specified keyrange with CC#1? A while loop might work, but I'm a novice with Kontakt KSP.

An example to illustrate the problem, fret position 0 (open fret) contains the following notes, where S = string number Instrument (1 thru 6), and Z = note zone (1 thru 23). Increasing the modwheel position will increment all of the zones by 1 in this matrix to increment to fret position 1, and so on:


S6-Z1, S5-Z1, S4-Z1, S3-Z1, S2-Z1, S1-Z1
S6-Z2, S5-Z2, S4-Z2, S3-Z2, S2-Z2, S1-Z2
S6-Z3, S5-Z3, S4-Z3, S3-Z3, S2-Z3, S1-Z3
S6-Z4, S5-Z4, S4-Z4, S3-Z4, S2-Z4, S1-Z4
S6-Z5, S5-Z5, S4-Z5, <none>, S2-Z5, S1-(Z5 thru Z22)

Comments

  • lzr1945
    lzr1945 Member Posts: 8 Member

    Does anyone have an idea how to accomplish something like this?

  • theodorech
    theodorech Member Posts: 86 Member

    Why not combine all six string instruments into a single .nki file and switch between the groups using either the modwheel or keyswitches? This approach doesn't require any KSP scripting, as everything can be handled directly through the Group Options.

    ezgif-8f78c20f3fadb5.gif
  • lzr1945
    lzr1945 Member Posts: 8 Member
    edited April 10

    The sampled guitar has more than 8000 zones that will not fit into a single instruments. And it would not be practical to manage that many groups in one instruments.

  • theodorech
    theodorech Member Posts: 86 Member

    You can’t load 8000 zones into one instrument? Who says that? Most deep-sampled guitar libs out there have 15k+ samples, easy. The usual way is just to map everything manually, then use the mod wheel to trigger the right group depending on its position.

    As far as I know, there’s no script or multiscript that lets you switch between totally different Kontakt instruments in a single instance. You’d either need to set that up in your DAW, like using keyswitches to switch between instances, or just build everything into one instrument.

  • stephen24
    stephen24 Member Posts: 449 Pro

    If you have a separate channel for each instrument, you could write a multiscript in which a cc directs the notes to the required channel. Can't see any advantage over groups, and you would probably increase the risk of hanging notes.

    And I'm sure you could easily write an instrument script which changed a keyswitch key to note_off (using %KEY_DOWN) > keyswitch > note_on.

Back To Top