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

Solved Multi Instrument CC control question

Discussion in 'Scripting Workshop' started by JED LARSON, Oct 13, 2020.

  1. JED LARSON

    JED LARSON NI Product Owner

    Messages:
    32
    Is there a way to have the notes of a Kontakt multi instrument (three synthesizers for example) responding to incoming midi channel #1, #2 and #3, but have all three synths respond to CC data (continuous controller cc7 volume for instance) coming in from only midi channel #1? (my DAW controller info doesn't allow CC data to send to 'all').
     
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Yes, you can duplicate MIDI messages with a multiscript.

    Example:

    Code:
    on init
        declare $i
    end on
    
    on midi_in
        if ($MIDI_CHANNEL = 0)
            if ($MIDI_COMMAND = $MIDI_COMMAND_CC)
                $i := 1
                while ($i < 16)
                    set_midi($MIDI_CHANNEL, $MIDI_COMMAND, $MIDI_BYTE_1, $MIDI_BYTE_2)
                    inc($i)
                end while
            end if
        end if
    end on
     
  3. JED LARSON

    JED LARSON NI Product Owner

    Messages:
    32
    Thanks Evildragon. Interesting. I'm totally new to custom scripts. Is there a quick way (tutorial?) to get up to speed on how to modify my three instruments to do this (and thus put your code in place)?
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    You don't need to modify your instruments at all. Just open up the multiscript area by clicking KSP button in top right of Kontakt and paste above script in then apply it.
     
  5. JED LARSON

    JED LARSON NI Product Owner

    Messages:
    32
    I gave it a try, and it doesn't seem to be multiplying the Midi chan 1 CC info onto the two other instruments (that are set to chan 2 and 3). That is, the CC7 fader on the kontakt instruments on chan 2 and 3 aren't moving to the DAW CC7 data (...but the fader on chan 1 is still). Any thoughts? Here's a pic.

    upload_2020-10-15_10-24-12.png
     

    Attached Files:

  6. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Oh, I made a typo!

    Inside the while loop, change $MIDI_COMMAND to $i. The it will work.
     
  7. JED LARSON

    JED LARSON NI Product Owner

    Messages:
    32
    I tried the following (but didn't seem to work). Any further thoughts? Did I make the correct adjustment? (I'm not sure if I need to restart Cubase for it to take effect?)

    on init
    declare $i
    end on

    on midi_in
    if ($MIDI_CHANNEL = 0)
    if ($MIDI_COMMAND = $MIDI_COMMAND_CC)
    $i := 1
    while ($i < 16)
    set_midi($MIDI_CHANNEL, $i, $MIDI_BYTE_1, $MIDI_BYTE_2)
    inc($i)
    end while
    end if
    end if
    end on
     
  8. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    And sorry, my head is somewhere else. Please change $MIDI_CHANNEL to $i, not $MIDI_COMMAND. :D

    (No, you don't need to restart Cubase.)
     
  9. JED LARSON

    JED LARSON NI Product Owner

    Messages:
    32
    Brilliant. Works like a charm. This saves me so much time (with redundant cc lines). Thanks much!!

    One last question. Could you make a script that includes Pitchbend as well? (that is, Pitchbend info coming in on chan 1, but applied to chan 1, 2 & 3)
     
  10. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    if ($MIDI_COMMAND = $MIDI_COMMAND_CC or $MIDI_COMMAND = $MIDI_COMMAND_PITCH_BEND)
     
  11. JED LARSON

    JED LARSON NI Product Owner

    Messages:
    32
    Perfect. Thanks again. And thanks for introducing the KSP panel to me, I'll be digging further into that in the future.
     
  12. JED LARSON

    JED LARSON NI Product Owner

    Messages:
    32
    Thanks again evildragon for you help. I have a similar issue I need to resolve if you think you can help out.

    I have three Instrument Bank instruments, set to receive on midi channel 1,2&3 in a single instance of Kontakt. I need to send program changes from midi channel 1 (in my DAW), but have all three Instrument Bank respond to those midi ch1 program changes.

    Like the solution you came up with above (with CC data), is there a KSP script that could send midi ch1 program changes to channels 1,2&3?
     
  13. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Sure, very easy:

    Code:
    on midi_in
        if ($MIDI_CHANNEL = 0 and $MIDI_COMMAND = $MIDI_COMMAND_PROGRAM_CHANGE)
            set_midi(1, $MIDI_COMMAND, $MIDI_BYTE_1, $MIDI_BYTE_2)
            set_midi(2, $MIDI_COMMAND, $MIDI_BYTE_1, $MIDI_BYTE_2)
        end if
    end on
     
  14. JED LARSON

    JED LARSON NI Product Owner

    Messages:
    32
    Beautiful. I’ve got a virtual microtonal pipe organ that I’ll be pulling stops on (changing instrument banks). This will make it all work.
     
  15. JED LARSON

    JED LARSON NI Product Owner

    Messages:
    32
    It appears that my Instrument Bank is not responding to Midi Volume (cc7) or Pan, coming from Cubase. (but my kontakt instruments are). Any thoughts?
     
  16. JED LARSON

    JED LARSON NI Product Owner

    Messages:
    32
    Oh, sorry, the instruments inside the bank are responding. Sorry about that.
    p.s The Instrument Bank is responding to the KSP script you gave for Program Change (thanks again).