# Scripting Solo or Mute



## thumky (Sep 1, 2012)

Hi,
Anyone know how to script a "Solo" or "Mute" on an instrument.
I'm using Kontakt 4, but i'll upgrade to 5 if that would do the trick.

thanks!
-md


----------



## Raptor4 (Sep 2, 2012)

Hi,
We discussed that lately here.
You will find out two prototype scripts made from mk282 and me. It was for Bus soloing but you can re-design the bus engine target parameters to any other parameters you want.
If you are talking about soloing/muting the different Instruments loaded in Kontakt via a KSP loaded into one of them then you will need some virtual midi cables like (Midi Yoke - PC) or (IAC - Mac). The KSP must generate midi Control messages (CC) set on different midi channel etc. Another problem will be that the global Instrument Solo/Mute buttons can not be automated (learned) so they can not be controlled via CC. In this scenario you must control the Instrument global Volume from "inf" to the previously stored value like we have done in the "Bus Prototypes" in the link I show above. 
Regards,
R4


----------



## mk282 (Sep 2, 2012)

It is not necessary to use virtual MIDI cables, when you could program a multiscript that mutes all MIDI data sent over individual channels. That could help, and would be much less hassle in the long run, I think.


----------



## thumky (Sep 2, 2012)

Thanks alot guys. I'll take a look at the script. I was hoping that i wouldn't have to know ahead of time which instruments are loaded. ( I know which one i want to Solo but when i turn off Solo, i want everything. Could be 3 or 4 others, i want some flexibility to add and subtract instruments ). I'll take a look, i haven't used buses in Kontakt before.

I like the idea of a Multi Script. Sounds easier. I could have my Solo instrument listen on one channel and the others listen on a different one. If the Solo switch is on, the note on messages would just go to my Solo instrument. But if the Solo switch is off, i would duplicate Note On/Off messages to the other channel.

Thanks again. Looks like i have options.


----------



## thumky (Sep 2, 2012)

Thx for the ideas. R4 i would have used your script, but i'm still on K4. I have a Muse Receptor so its not that easy to upgrade.

Here's the Multi script i'm going with:

<code>
{ Solo MultiScript. NOTE: this isn't an actual solo button on the Kontakt interface
{ It maps to a button on your controller. Its a workaround, ideally we would control the actual Solo button on the Kontakt Instrument }
{ mdundas 2012.09.01 }

on init

{ Is the solo button on? Either 0 or 1 }
declare solo := 0

{ What CC are you using to control Solo? }
declare soloCC := 37 

end on

{ We're gonna duplicate MIDI messages on channel 2 if Solo isn't turned on }
on midi_in

{ Turn On/Off Solo }
if ( $MIDI_COMMAND = $MIDI_COMMAND_CC and $MIDI_BYTE_1 = soloCC )
if ( $MIDI_BYTE_2 = 127 )
solo := 1 
message("Solo is OFF")
else if ( $MIDI_BYTE_2 = 0 )
solo := 0
message("Solo is ON")
else
message("Bad Choice " & $MIDI_BYTE_2)
end if
end if

{ If we're NOT soloed, dupe the messages }
if ( solo = 1 )
{ dont do a damn thing } 
message("Ignoring..."); 
else
{ duplicate the messsage on Channel 2. Do this for all Commands, we don't try to monitor if its CC vs Note On etc... }
set_midi(1, $MIDI_COMMAND, $MIDI_BYTE_1, $MIDI_BYTE_2 )
set_midi(2, $MIDI_COMMAND, $MIDI_BYTE_1, $MIDI_BYTE_2 )
message("Duplicating...");
end if
end on

</code>


----------



## thumky (Sep 2, 2012)

The formatted version:

http://pastebin.com/raw.php?i=PeBjjtNE


----------



## Raptor4 (Sep 3, 2012)

> R4 i would have used your script, but i'm still on K4. I have a Muse Receptor so its not that easy to upgrade.


Hi,
I think my script will work on K4 but it is related to the Buses control and tweaks the Bus levels as solo emulation. Following your post updates you do not need that.
I think you have two choices:
1. If you use Kontakt loaded into any DAW like Cubase, Logic etc you could just use the DAW Controller Assignments dialog and "Learn" the Solo or Mute midi track buttons (which feed the Kontakt parts) to the CC# (external controller buttons).
2. If you use Kontakt as stand alone instance then the mk282's multiscript idea is valid.
Regarding the multiscript... 
Here is an example theory of building a True Solo multi:
You can use same CC# external controller messages set on midi channels (1-16).
You have to use some flags (inc condition array mapper) to register which midi channels/parts inc the CC# condition (solos) are enabled and which are disabled for the different midi parts (1-16). For example: If ch.2 (midi part 2) is enabled then ch.1 and ch.3-16 must be disabled.
When hit another solo say ch.3, then ch.2 & 3 are enabled and ch.1 and ch.4-16 are disabled for the CC# and so on. Take care for CC# (Bite 1) condition otherwise you can disable parts where you need some other CC# to pass thru. 
Regards,
R4


----------



## Lindon (Sep 3, 2012)

..there are no buses on K4.


----------

