# Set controller value in init?



## tcollins (Nov 23, 2018)

Let's say you have mod wheel set to control volume at 100%. When you first load an instrument, you won't have any sound until you touch the mod wheel. However, with many libraries you DO have sound before touching the mod wheel.

How is this done? Like this?

_on init

set_controller(1,100)

end on_

It works, but I cannot find anything like this in the Kontakt factory scripts, so perhaps it is not the right way to handle this?

Thanks!


----------



## P.N. (Nov 23, 2018)

Kontakt actually has a default setting that you can use too, that doesn't require scripting.
MIDI CC Default Value. (right next to the CC number).


----------



## tcollins (Nov 23, 2018)

P.N. said:


> Kontakt actually has a default setting that you can use too, that doesn't require scripting.
> MIDI CC Default Value. (right next to the CC number).


Holy crap! I forgot about that. Thanks!
Unfortunately, my script is changing the CC# internally, so that didn't work in this case. It does work if the assignment is a simple CC#.


----------



## EvilDragon (Nov 23, 2018)

Use persistence_changed callback just to be on the safe side. Otherwise, if it works, it works.


----------



## P.N. (Nov 23, 2018)

Yes, the top example is to be used with external CC modulators.
You asked how other libraries do it, and this is one of the ways they do it...
They insert a "dummy" CC modulator (something that's not normally used 102,103, etc), and reassign it via scripting.

Edit: Already suggested by ED.

Cheers.


----------



## tcollins (Nov 23, 2018)

EvilDragon said:


> Use persistence_changed callback just to be on the safe side. Otherwise, if it works, it works.


It actually works, with every keyboard in my studio, EXCEPT
the KK S61 MK2 keyboard. After init, the KK apparently sends out the Mod Wheel position, so the volume would be up, then it snaps to the current wheel position, or just doesn't sound at all. Hmmm...


----------



## tcollins (Nov 23, 2018)

Yes, we're reassigning the incoming CC to #22 (a script started by someone else). Maybe it doesn't like CC#22?


----------



## P.N. (Nov 23, 2018)

I don't know by heart which midi channels do what (are intended to by the GM rules), except for the usual suspects (expression, panning, etc), but maybe, that's what causing the issue.

If you still have issues, you could try to define some rules based on %CC_TOUCHED, to force reset to your desired default CC value, though i'm not sure it will work...

Edit: Found a list that states that CC 20-31 are undefined, but i'd start at 102, just in case. Never had a problem with 102-119.


----------



## EvilDragon (Nov 24, 2018)

Any CC should work. "Undefined" is just a generic General MIDI name for the CC. Kontakt doesn't care about all that jazz.


Tracy, just try using persistence_changed to send your wanted CC out.


----------



## P.N. (Nov 24, 2018)

EvilDragon said:


> Any CC should work. "Undefined" is just a generic General MIDI name for the CC. Kontakt doesn't care about all that jazz.



Isn't there a benefit in choosing commonly undefined CC's in order to avoid interfering with DAW or hardware parameters?

Kontakt responds to CC7, CC10, so isn't it possible that other parameters in the OP machine are using CCs 20-31 and somehow interfering with Kontakt's script?

That's why i suggested trying another set of undefined CCs to see if it makes any difference regarding his keyboard...


----------



## EvilDragon (Nov 24, 2018)

P.N. said:


> Isn't there a benefit in choosing commonly undefined CC's in order to avoid interfering with DAW or hardware parameters?



Perhaps. Most DAWs don't really care about General MIDI though, right?


----------



## P.N. (Nov 24, 2018)

EvilDragon said:


> Perhaps. Most DAWs don't really care about General MIDI though, right?



I honestly don't know about most DAW's...
A midi track in my DAW will read panning and volume from the track's corresponding CC's. So the DAW is following the GM conventions.

Kontakt also correctly reacts to this CC information, so there's that...

Maybe we're talking about different things. You were just refering to the undefined CC's, right?

My suggestion was just to try another set of undefined CC's for the re-routing just in case something in the OP's chain,(the DAW and/or the keyboard), doesn't "like" CC 22.

In theory it shouldn't make a difference, since the script is handling this, but i guess it couldn't hurt to try.


----------

