A technical support community for Apple Logic Pro users.

 
nevermore2k
Topic Author
Posts: 16
Joined: Wed Apr 18, 2007 4:06 am
Contact:

Scripter Program Changes

Thu Jul 18, 2013 2:07 pm

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();   
  }
}
 
User avatar
David Nahmani
Site Admin
Posts: 85914
Joined: Sat Mar 05, 2005 12:16 am
Contact:

Re: Scripter Program Changes

Thu Jul 18, 2013 3:37 pm

I'm sorry... what is this and how do you use it? :shock:
David Nahmani
• My Logic Pro X 10.5 book (Apple Pro Training Series)
Contact me for Private Lessons
Logic Pro X 10.6.1
MacBook Air 1.3 GHz i5 — MacOS X 11.0.1 — 4 GB RAM
iMac 3.2 GHz Quad Core i5 — MacOS X 10.15.4 — 8 GB RAM
 
nevermore2k
Topic Author
Posts: 16
Joined: Wed Apr 18, 2007 4:06 am
Contact:

Re: Scripter Program Changes

Thu Jul 18, 2013 4:23 pm

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 ;)
 
cmrick
Posts: 101
Joined: Tue May 22, 2007 11:19 am
Location: Atlanta, GA
Contact:

Re: Scripter Program Changes

Fri Jul 19, 2013 7:17 pm

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.
 
nevermore2k
Topic Author
Posts: 16
Joined: Wed Apr 18, 2007 4:06 am
Contact:

Re: Scripter Program Changes

Sat Jul 20, 2013 4:18 am

maybe you have an idea of how to make this script better :)
i did not find a solution for writing the data direct into the midi file. may u have an idea how to do that
 
cmrick
Posts: 101
Joined: Tue May 22, 2007 11:19 am
Location: Atlanta, GA
Contact:

Re: Scripter Program Changes

Sat Jul 20, 2013 3:16 pm

Unfortunately, no. I tried to do the same thing but you can only record it as automation.
 
nevermore2k
Topic Author
Posts: 16
Joined: Wed Apr 18, 2007 4:06 am
Contact:

Re: Scripter Program Changes

Sat Jul 20, 2013 4:16 pm

good to know that someone else try the same thing
 
nanook
Posts: 90
Joined: Thu Oct 25, 2007 10:14 am
Location: Montreal

Re: Scripter Program Changes

Mon Jul 22, 2013 11:11 am

nevermore2k wrote:
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
Fred
Logic pro X 10.4.2, Vienna Ensemble Pro, Altiverb 7, Waves Studio Bundle, Vienna Suite, Apogee Ensemble, Mac OS X 10.13, iMac i7 2013, 32 GB RAM. , Remote Sl,
 
nevermore2k
Topic Author
Posts: 16
Joined: Wed Apr 18, 2007 4:06 am
Contact:

Re: Scripter Program Changes

Tue Jul 23, 2013 4:58 pm

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();
}


 
nanook
Posts: 90
Joined: Thu Oct 25, 2007 10:14 am
Location: Montreal

Re: Scripter Program Changes

Wed Jul 24, 2013 8:31 am

Thank you so much for upgrading the code!. I will check try it out when I come back from vacation.

Do you know a simple good way to learn javascript programming?
Fred
Logic pro X 10.4.2, Vienna Ensemble Pro, Altiverb 7, Waves Studio Bundle, Vienna Suite, Apogee Ensemble, Mac OS X 10.13, iMac i7 2013, 32 GB RAM. , Remote Sl,
 
nevermore2k
Topic Author
Posts: 16
Joined: Wed Apr 18, 2007 4:06 am
Contact:

Re: Scripter Program Changes

Wed Jul 24, 2013 10:44 am

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.
 
cmrick
Posts: 101
Joined: Tue May 22, 2007 11:19 am
Location: Atlanta, GA
Contact:

Re: Scripter Program Changes

Thu Jul 25, 2013 3:54 pm

http://www.codecademy.com/ is a pretty good way to learn the basics.
 
nevermore2k
Topic Author
Posts: 16
Joined: Wed Apr 18, 2007 4:06 am
Contact:

Re: Scripter Program Changes

Fri Jul 26, 2013 1:14 am

thats nice !
 
User avatar
anp27
Posts: 1748
Joined: Thu Feb 09, 2012 1:25 pm
Location: Brooklyn, New York

Re: Scripter Program Changes

Sun Sep 01, 2013 8:03 am

nanook wrote:
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?
Mac mini (late 2012 Server) 2.3 Ghz i7, 16GB RAM~2TB Samsung 860 QVO~16GB Ram~macOS Catalina 10.15.7~Logic Pro 10.6.3~Universal Audio Apollo Twin Duo Thunderbolt MKII~KORG microKEY2 61
 
nanook
Posts: 90
Joined: Thu Oct 25, 2007 10:14 am
Location: Montreal

Re: Scripter Program Changes

Wed Sep 04, 2013 10:55 am

anp27 wrote:
nanook wrote:
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
Fred
Logic pro X 10.4.2, Vienna Ensemble Pro, Altiverb 7, Waves Studio Bundle, Vienna Suite, Apogee Ensemble, Mac OS X 10.13, iMac i7 2013, 32 GB RAM. , Remote Sl,
 
User avatar
anp27
Posts: 1748
Joined: Thu Feb 09, 2012 1:25 pm
Location: Brooklyn, New York

Re: Scripter Program Changes

Sat Sep 07, 2013 5:08 am

nanook wrote:
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


Got it, thanks. Also, I think this post should be moved to the Midi Scripter section instead of this one.
Mac mini (late 2012 Server) 2.3 Ghz i7, 16GB RAM~2TB Samsung 860 QVO~16GB Ram~macOS Catalina 10.15.7~Logic Pro 10.6.3~Universal Audio Apollo Twin Duo Thunderbolt MKII~KORG microKEY2 61
 
User avatar
Jordi Torres
Moderator
Posts: 15998
Joined: Wed Jun 18, 2008 7:24 am
Location: Neuchâtel, Switzerland

Re: Scripter Program Changes

Sat Sep 07, 2013 7:53 am

anp27 wrote:
I think this post should be moved to the Midi Scripter section instead of this one.


Me, too :)

J.
Et voilà!

MacBook Pro 15" Retina i7 2.2 GHz - 16GB RAM | OS 10.14.6 | Logic Pro 10.4.8
Merging Hapi | RME Fireface 400 | Akai MPK49 | Nord Micro Modular
 
User avatar
anp27
Posts: 1748
Joined: Thu Feb 09, 2012 1:25 pm
Location: Brooklyn, New York

Re: Scripter Program Changes

Sat Sep 07, 2013 8:06 am

Thank you to the person who moved this post!
Mac mini (late 2012 Server) 2.3 Ghz i7, 16GB RAM~2TB Samsung 860 QVO~16GB Ram~macOS Catalina 10.15.7~Logic Pro 10.6.3~Universal Audio Apollo Twin Duo Thunderbolt MKII~KORG microKEY2 61
 
User avatar
Jordi Torres
Moderator
Posts: 15998
Joined: Wed Jun 18, 2008 7:24 am
Location: Neuchâtel, Switzerland

Re: Scripter Program Changes

Sat Sep 07, 2013 8:30 am

anp27 wrote:
Thank you to the person who moved this post!


I think I used the wrong smiley....this is the correct one:

:wink:

J.
Et voilà!

MacBook Pro 15" Retina i7 2.2 GHz - 16GB RAM | OS 10.14.6 | Logic Pro 10.4.8
Merging Hapi | RME Fireface 400 | Akai MPK49 | Nord Micro Modular
 
User avatar
anp27
Posts: 1748
Joined: Thu Feb 09, 2012 1:25 pm
Location: Brooklyn, New York

Re: Scripter Program Changes

Sat Sep 07, 2013 8:39 am

Nooooooooooooowwwwww I get it... thanks Jordi! ;)
Mac mini (late 2012 Server) 2.3 Ghz i7, 16GB RAM~2TB Samsung 860 QVO~16GB Ram~macOS Catalina 10.15.7~Logic Pro 10.6.3~Universal Audio Apollo Twin Duo Thunderbolt MKII~KORG microKEY2 61