Jump to content

Scripter Program Changes


Recommended Posts

Just a short Test. U need to use the automation to record these Program Changes.

 

var PluginParameters = [{name:"ProgramChange", defaultValue:3, minValue:0, maxValue:5, numberOfSteps:5, unit:"octaves", type:"lin"}];

function HandleMIDI(event)
{
  event.trace();
  event.send();
}

function ParameterChanged(param, value)
{
 if(param == 0){
      var program =GetParameter("ProgramChange");
   var pc = new ProgramChange;    
   pc.number = program;     
   pc.send();  
   pc.trace();   
 }
}

Link to comment
Share on other sites

Okay, For example Load a Instance of Kontakt, Insert an Instrument Bank, and load instruments into this. For examples Legato Strings, Staccati Strings and so on.

 

Then insert the Scripter Plugin and paste the Code into it.

 

Then Assign the Intelligent Automation Controls ("b") to the Scriptor Fader.

now u can change the Artikulations via the the new Automation Controll Tool.

 

sorry for my bad english ;)

Link to comment
Share on other sites

Yes, for custom keyswitches in in Kontakt. Because drawing in program changes in hyperdraw is super tedious. Also, instrument tracks don't transmit program changes from an external controller to Kontakt for some reason. You would always have to use an external MIDI track hooked up in the environment. Not sure why. This is a nice solution for that too.
Link to comment
Share on other sites

Just a short Test. U need to use the automation to record these Program Changes.

 

 

Hi,

 

Your script as been really usefull for me. I have absolutly no coding experience.

 

I have adapt your script for my use with Vienna instruments Pro. Instead of a fader it's a menu and it sends cc12 instead of progchange.

 

var PluginParameters = [{name:"Keyswitch", type: "menu", defaultValue:1, minValue:0, maxValue:127, numberOfSteps:12, valueStrings:["Staccato", "Sustain", "fp","Legato", "Protamento", "pTrill", "rep", "FastRep,", "9", "10", "11", "Pizz"]}];

function HandleMIDI(event)
{
  event.trace();
  event.send();
}

function ParameterChanged(param, value)
{
 if(param == 0){
 	  var KS =GetParameter("Keyswitch");
   var x = new ControlChange;       
   x.number = 12; 
   x.value = KS*11;         
   x.send();  
   x.trace();   
 }
}

 

2 two things I can't figure out:

 

1-How to send midi to more than one midi channel at a time in case I want to use multi instruments such VE Pro? I only know the function x.channel = (number), but it work only on one channel.

 

2-How to send more than one event, in this case midi cc? I wish I could select ''staccato'' in the menu and send a specific CC12 and CC13 value. In fact I'm trying to create an Expression Map à la Cubase but I'm not enough familiar with midi javascript at the moment.

 

 

 

And here's another script to be able to write midi controller data in the automation track. You can change the cc number as you wish:

 

var PluginParameters = [{name:"VXF", type: "lin", defaultValue:1, minValue:0, maxValue:127, numberOfSteps:127}];

function HandleMIDI(event)
{
  event.trace();
  event.send();
}

function ParameterChanged(param, value)
{
 if(param == 0){
 	  var VXF =GetParameter("VXF");
   var cc = new ControlChange;       
   cc.number = 1; 
   cc.value = VXF;         
   cc.send();  
   cc.trace();   
 }
}

 

Here again, I wish i know how to create a second slider with a different CC.

 

Thanks for any help!

 

Fred

Link to comment
Share on other sites

Thanks for Sharing your Code :) I use VSL Stuff here by myself.

 

I Modified your code. If u didnt post your code fragment i didnt get the idea to do this :)

Hope that will help you. By the Way would be cool if you share any changes..

 


// Global Definition for controller X Y  for switching in the artikulation row. Feel free to change the number. 

var x = new ControlChange;
var y = new ControlChange;
x.number = 12;
y.number = 1;

// standart Event Handling 
function HandleMIDI(event)
{
  event.trace();
  event.send();
    
 }

// For Switching the Articulation (Expression) Every Name in the Plugin Parameter does have an own number
// the First is 0, Second 1 , Third 2 and so on. 


function parameterSwitch(){
if (expression == 0) {
  	x.value = 0;
  	y.value = 0;

  }
  
if (expression == 1) {
 		x.value = 19;
  	y.value = 0;
  }
  
 	if (expression == 2) {
  	x.value = 37;
 	y.value = 0;
  }
  
  if (expression == 3) {
  	x.value = 73;
 	y.value = 0;
  }   
  if (expression == 10) {
  	x.value = 0;
 	y.value = 127;
  }   
   if (expression == 11) {
 	 	x.value = 40;
 	y.value = 127;
  } 
   if (expression == 12) {
   x.value = 60;
	  y.value = 127;
  } 
}

//-----------------------------------------
// Define the Names as u Wish. 
var PluginParameters = 
[{name:"Keyswitch", type: "menu", valueStrings:["Staccato", 
																						"Sustain", 
																						"fp",
																						"Legato", 
																						"Protamento", 	
																						"pTrill", 
																						"rep", 
																						"FastRep,", 									
																						"Pizz",
																						"SecRow1",
																						"SecRow2",
																						"SecRow3"]}];
																						

var expression = 0;

// Now these happens when i change something
// First i say the Var expression should get the Value of PluginParameters
// then the function parameterSwitch(); should be called. And then send x and y.

function ParameterChanged(param, value) {
expression = value;
parameterSwitch();
x.send();  
y.send();
x.trace();  
 y.trace();
}


Link to comment
Share on other sites

You are welcome.

i learned C and Objective C. never learned javascript. its the first time for me. java script seems very similar to C. Maybe check out a book store or some Javascript for Dummys (They are realy great books ! ) you just need to get the fundamentals of programming, like how to use "If and else" , variable decloration and so on, how does a function work. They are allmost the same in every programming language... but they have allways an other slang. Sometimes u need some () instead of [] or sometimes u are able to use dots sometimes not. But i think C would be a good start, or a Javascript for Dummy book. if you are into it, and take a look at the different languages, it will be like the difference between American english and UK English.

Link to comment
Share on other sites

  • 1 month later...

And here's another script to be able to write midi controller data in the automation track. You can change the cc number as you wish:

 

var PluginParameters = [{name:"VXF", type: "lin", defaultValue:1, minValue:0, maxValue:127, numberOfSteps:127}];

function HandleMIDI(event)
{
  event.trace();
  event.send();
}

function ParameterChanged(param, value)
{
 if(param == 0){
 	  var VXF =GetParameter("VXF");
   var cc = new ControlChange;       
   cc.number = 1; 
   cc.value = VXF;         
   cc.send();  
   cc.trace();   
 }
}

 

Here again, I wish i know how to create a second slider with a different CC.

 

Thanks for any help!

 

Fred

 

Can you please elaborate? Which "automation track" are you referring to?

Link to comment
Share on other sites

And here's another script to be able to write midi controller data in the automation track. You can change the cc number as you wish:

 

var PluginParameters = [{name:"VXF", type: "lin", defaultValue:1, minValue:0, maxValue:127, numberOfSteps:127}];

function HandleMIDI(event)
{
  event.trace();
  event.send();
}

function ParameterChanged(param, value)
{
 if(param == 0){
 	  var VXF =GetParameter("VXF");
   var cc = new ControlChange;       
   cc.number = 1; 
   cc.value = VXF;         
   cc.send();  
   cc.trace();   
 }
}

 

Here again, I wish i know how to create a second slider with a different CC.

 

Thanks for any help!

 

Fred

 

Can you please elaborate? Which "automation track" are you referring to?

 

Yes.

It's the instrument track on wich you put the scripter plugin.

simply put the track in touch, latch or write mode and move the slider.

 

Fred

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...