# Looking for a Multiscript that sets the MIDI Channel



## dfhagai (Oct 9, 2015)

Hi,

When I play a Kontakt multi that contains different instruments on different channels, the notes are played on all instruments (cubase track is set to "any" midi channel), but the CC's are only sent on channel 1...

I'm looking for a multi-script that will allow me to choose the MIDI channels for the MIDI CC's, in parallel.

Does anybody knows if it exists?

Thanks 
HD


----------



## d.healey (Oct 9, 2015)

Doesn't the transformer multi script do this?


----------



## FriFlo (Oct 9, 2015)

First of all: when you set the instrument to "any midi channel", channel one is just the default on that instrument, when that instrument is record enabled. You can in fact send on any channel by just connecting midi tracks to that instrument and setting their individual channels. But if you want the input of channel one to be sent to channel 1-16 inside Kontakt, you need a multi script for that, indeed. I don't know a script, but if you put one day of learning scripting, this is very easy to get done ...


----------



## dfhagai (Oct 9, 2015)

I've learned a lot of scripting last year, and made some great things (using David's excellent vids).
Then, I've stopped scripting for a couple of months and forgot everything, I swear it's true 

"Doesn't the transformer multi script do this?"

Hi David, unfortunately It doesn't allow using multiple MIDI tracks in parallel, and it doesn't have an option to choose "any" as a parameter.

FWIW, LASS ARC script has the ability to MIDI Thru the CC's to all Channels.

Once you guys see what I've got cooking....I have to get this thing working


----------



## FriFlo (Oct 9, 2015)

It's like swimming! You will get into it quickly, if you have done it before!  Just be very particular, what kind of midi transformation you want to achieve and you will be done with 10 - 20 lines of easy code. As long as you don't want to do complicated stuff like keyswitching between different channels without hanging notes ...
You might look for existing scripts that do this, but most of the time, you will only find something close, but not quite what you need. Doing it yourself will be easier in this case.


----------



## FriFlo (Oct 9, 2015)

With this easy skript CC 1 is sent over all 16 midi channels, if recieved on channel 1. Just copy it into the first slot. From there you can easily adjust, what you exactly need. Enjoy!

```
on midi_in
      if ($MIDI_COMMAND = $MIDI_COMMAND_CC and $MIDI_BYTE_1 = 1)
        set_midi (1,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (2,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (3,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (4,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (5,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (6,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (7,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (8,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (9,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (10,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (11,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (12,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (13,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (14,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)
        set_midi (15,$MIDI_COMMAND_CC,$MIDI_BYTE_1,$MIDI_BYTE_2)

end if
end on
```


----------



## dfhagai (Oct 9, 2015)

FriFlo, your getting a credit from me on my upcoming Youtube video, where I'll probably use this script as a starting point for an interesting concept I'm working on - YOU ARE KING!

BTW, how come the script transmits channel 16 if it's not mentioned there at all?


----------



## dfhagai (Oct 9, 2015)

I get it, Zero indexing?


----------



## FriFlo (Oct 9, 2015)

dfhagai said:


> I get it, Zero indexing?


Jup! Channel 0 = 1, 15 = 16.


----------



## dfhagai (Oct 9, 2015)

Thank you very much, I've already started adding functions and refinements...
Seems you've got me into scripting again, and it feels good


----------



## dfhagai (Oct 10, 2015)

Ok, made it!!!

I've created 5 selectable CC's plus Pitchbend, Aftertouch and Notes.
The table to the right of each controller allows you to choose the MIDI channels for that CC.

what do you think of the layout?






I like to share my script with you guys in case you find it useful, here's the https://app.box.com/s/wolo89gmm931iskwit6mxhmflbxtm46g (link).

I have a two questions regarding the code please:


On the "On MIDI" section, I repeat the following code block 9 times:
if ($MIDI_COMMAND = $MIDI_COMMAND_CC and $MIDI_BYTE_1 = *$1st_cc*)
$i := 0
while ($i < 16)
if (*%1st_cc*[$i] > 0)
set_midi ($i,$MIDI_COMMAND_CC,*$1st_cc*,$MIDI_BYTE_2)
inc ($i)
else
inc ($i)
end if
end while
end if

I want to replace it with a Function, and only change the variables and tables (I've marked them in *bold*).
Is it at all possible? it is a good practice?

2. Even though I've defined the table values to 1, it still moves freely between 0 and 1. can I turn it into a proper switch?

Thanks guys,
HD


----------



## EvilDragon (Oct 10, 2015)

1. You should probably use get_control_par_str() for that.

2. No, you can't.


----------



## dfhagai (Oct 10, 2015)

Thanks Mr. Evil


----------



## dfhagai (Oct 11, 2015)

And here's an https://app.box.com/s/wolo89gmm931iskwit6mxhmflbxtm46g (improved version):






New Features
- Added the ability to turn of the note filtering out (which is great if you want to preserve the notes original midi channels, e.g when working within your DAW in "Any" channel mode).

- Added Control help.


Future ideas:
- User presets in the upcoming version, so you could save your favorite configurations.

If you have any comments, or interesting ideas, please share them 
HD


----------



## FriFlo (Oct 12, 2015)

So, what do you intend to do with it? You promised a video!


----------



## dfhagai (Oct 12, 2015)

It's a simple yet very effective idea for Cubase 8 users.
I hope to make the video during the week.
Trust me FriFlo, I will inform you


----------



## dfhagai (May 27, 2018)

A couple of years later...A https://www.hagaid.com/downloads (new version)is out!


----------

