Using scripts to control other instruments

Harry LeBlanc
Harry LeBlanc Member Posts: 5 Newcomer

Okay, I'm a total newbie to kontakt scripting (though I have decades of general programming experience). I've read the ksp scripting manual (okay, I skimmed some parts), but I couldn't figure this out.

Is it possible for a script (either a script in an instrument, or a multi script) to affect events (not just midi events, but volume, pan, effects, etc) in multiple instruments in a midi? Say, e.g., to program a slider that crossfades two sounds from two different instruments together, based on slider position?

Or is each instrument's scripts limited to its own instrument, and multis just limited to pure midi manipulation?

There are tons of kontakt instruments that do something similar (e.g., Fables, Lores) with their own on-board sounds, but I already have a zillion string, brass, etc, libraries, and I'd like to script my own ad hoc instrument mixes and mashes. Is this even possible?

Thanks for help with my dumb newbie question. 🙂


  • Harry LeBlanc
    Harry LeBlanc Member Posts: 5 Newcomer

    Sorry, I didn't mean "multiple instruments in a midi" -- I meant "multiple instruments in a multi."

  • stephen24
    stephen24 Member Posts: 258 Advisor
    edited September 2023

    Yeah a multiscript will do this for you. If your instruments are on different channels, you can make e.g. a volume message on one channel trigger an inverse volume message on another. Or use a third channel to trigger both.

    Bit more tricky if you want to use the same volume controls on those instruments to give them individual expression, but with a bit of simple maths it wouldn't be any problem for an experienced programmer.

  • Harry LeBlanc
    Harry LeBlanc Member Posts: 5 Newcomer

    I've just sussed out how to do that with an xy controller. Since its values in each dimension range from 0 to 1, I simply multiply each voice's starting volume value to either the x value or 1 - the x value (to move between left & right voices), and ditto for y values for upper and lower voices). So users, mousing around on the xy pad, should be able to dynamically move between 4 voices.

    I also put together an automatic mode, where the position moves in a circle or ellipse (shaped by user input). Right now it's hardwired for one circuit per 4 bars, but I'll add gui control to that later. The trig functions actually make this pretty easy.

    I'm now at the point of needing to build a ui. I have zero graphics talent, but fortunately I have a buddy skilled at that. Next weekend I hope to finish the coding and start testing. It's looking pretty simple.

    Here's the code in its current state. Completely untested, and no gui layout at all, but the logic seems sound to me. I'd love any feedback.

    I'm planning on open sourcing this project when it's done, so feel free to share, steal, whatever.

Back To Top