Jump to content

Would love these 2 scripts


DjStiky

Recommended Posts

Hi guys,

 

I have no programming experience whatsoever and would love to find or help create 2 scripts. Here is what each would do:

 

1) A script that I could use on a "External Instrument" track that would have 16 dropdown menus with specific names, each of them would have a list of patch names. Each patch name would send out a specific "Bank MSB", "Bank LSB" and "Program Change" number via MIDI. I could take care of modifying the script to add the names and MSB LSB and PRGCH numbers in the order I want.

 

2) A script that would force LOW Note Priority for synths that do not support it (They only have Last Note Priority)

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

Hi,

 

1) Don't have time to do an exact version of what you want, but had done something similar before that I think it could help you get close:

 

//Create PC, MSB and LSB objects;
var pc = new ProgramChange();
var msb = new ControlChange();
var lsb = new ControlChange();

//Author string
var author = "Script by Jordi Torres";

//Create menus
var PluginParameters = [{
   name: "Program",
   type: "menu",
   valueStrings: [' 0 = Grand Piano ', ' 1 = Bright Piano ', ' 2 = ElectricGrand ', ' 3 = HonkyTonkPno. ',
       ' 4 = E. Piano1 ', ' 5 = E. Piano2 ', ' 6 = Harpsichord ', ' 7 = Clavinet ', ' 8 = Celesta ',
       ' 9 = Glockenspiel ', ' 10 = Music Box ', ' 11 = Vibraphone ', ' 12 = Marimba ', ' 13 =Xylophone ',
       ' 14 = Tubular-Bell ', ' 15 = Dulcimer ', ' 16 = DrawOrgan ', ' 17 = PercOrgan ', ' 18 = RockOrgan ',
       ' 19 = Church Organ1 ', ' 20 = Reed Organ ', ' 21 = Accordion Fr ', ' 22 = Harmonica ', ' 23 = TangoAcd ',
       ' 24 = Nylonstr. Gt. ', ' 25 = Steelstr. Gt. ', ' 26 = Jazz Gt. ', ' 27 = Clean Gt. ', ' 28 = Muted Gt. ',
       ' 29 = Overdrive Gt. ', ' 30 = Distortion Gt ', ' 31 = Gt.Harmonics ', ' 32 = Acoustic Bs. ',
       ' 33 = Fingered Bs. ', ' 34 = Picked Bs. ', ' 35 = Fretless Bs. ', ' 36 = Slap Bass 1 ', ' 37 = Slap Bass 2 ',
       ' 38 = Synth Bass 1 ', ' 39 = Synth Bass 2 ', ' 40 = Violin ', ' 41 = Viola ', ' 42 = Cello ', ' 43 = Contrabass ',
       ' 44 = Tremolo Str. ', ' 45 = Pizzicato Str ', ' 46 = Harp ', ' 47 = Timpani ', ' 48 = Strings ', ' 49 = Slow Strings ',
       ' 50 = Syn. Strings1 ', ' 51 = Syn. Strings2 ', ' 52 = Choir Aahs ', ' 53 = Voice Oohs ', ' 54 = SynVox ',
       ' 55 = OrchestraHit ', ' 56 = Trumpet ', ' 57 = Trombone ', ' 58 = Tuba ', ' 59 = MutedTrumpet ', ' 60 = French Horn ',
       ' 61 = Brass 1 ', ' 62 = Synth Brass1 ', ' 63 = Synth Brass2 ', ' 64 = Soprano Sax ', ' 65 = Alto Sax ', ' 66 = Tenor Sax ',
       ' 67 = Baritone Sax ', ' 68 = Oboe ', ' 69 = English Horn ', ' 70 = Bassoon ', ' 71 = Clarinet ', ' 72 = Piccolo ',
       ' 73 = Flute ', ' 74 = Recorder ', ' 75 = Pan Flute ', ' 76 = Blown Bottle ', ' 77 = Shakuhachi ', ' 78 = Whistle ',
       ' 79 = Ocarina ', ' 80 = Square Wave ', ' 81 = Saw Wave ', ' 82 = Syn. Calliope ', ' 83 = Chiffer Lead ', ' 84 = Charang ',
       ' 85 = Solo Vox ', ' 86 = 5th Saw Wave ', ' 87 = Bass&Lead ', ' 88 = Fantasia ', ' 89 = Warm Pad ', ' 90 = Polysynth ',
       ' 91 = Space voice ', ' 92 = Bowed Glass ', ' 93 = Metal Pad ', ' 94 = Halo Pad ', ' 95 = Sweep Pad ', ' 96 = Ice Rain ',
       ' 97 = Soundtrack ', ' 98 = Crystal ', ' 99 = Atmosphere ', ' 100 = Brightness ', ' 101 = Goblin ', ' 102 = Echo Drops ',
       ' 103 = Star Theme ', ' 104 = Sitar ', ' 105 = Banjo ', ' 106 = Shamisen ', ' 107 = Koto ', ' 108 = Kalimba ',
       ' 109 = Bag Pipe ', ' 110 = Fiddle ', ' 111 = Shanai ', ' 112 = Tinkle Bell ', ' 113 = Agogo ', ' 114 = Steel Drums ',
       ' 115 = Woodblock ', ' 116 = Taiko ', ' 117 = Melo Tom ', ' 118 = Synth Drum ', ' 119 = Reverse Cym. ', ' 120 = Gt FretNoise ',
       ' 121 = Breath Noise ', ' 122 = Seashore ', ' 123 = Bird ', ' 124 = Telephone 1 ', ' 125 = Helicopter ', ' 126 = Applause ',
       ' 127 = Gun Shot '
   ],
   defaultValue: 0,
   numberOfSteps: 128
}, {
   name: "Bank",
   type: "menu",
   valueStrings: [' 0 ', ' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ', ' 7 ', ' 8 ', ' 9 ', ' 10 ',
       ' 11 ', ' 12 ', ' 13 ', ' 14 ', ' 15 ', ' 16 ', ' 17 ', ' 18 ', ' 19 ', ' 20 ',
       ' 21 ', ' 22 ', ' 23 ', ' 24 ', ' 25 ', ' 26 ', ' 27 ', ' 28 ', ' 29 ', ' 30 ',
       ' 31 ', ' 32 ', ' 33 ', ' 34 ', ' 35 ', ' 36 ', ' 37 ', ' 38 ', ' 39 ', ' 40 ',
       ' 41 ', ' 42 ', ' 43 ', ' 44 ', ' 45 ', ' 46 ', ' 47 ', ' 48 ', ' 49 ', ' 50 ',
       ' 51 ', ' 52 ', ' 53 ', ' 54 ', ' 55 ', ' 56 ', ' 57 ', ' 58 ', ' 59 ', ' 60 ',
       ' 61 ', ' 62 ', ' 63 ', ' 64 ', ' 65 ', ' 66 ', ' 67 ', ' 68 ', ' 69 ', ' 70 ',
       ' 71 ', ' 72 ', ' 73 ', ' 74 ', ' 75 ', ' 76 ', ' 77 ', ' 78 ', ' 79 ', ' 80 ',
       ' 81 ', ' 82 ', ' 83 ', ' 84 ', ' 85 ', ' 86 ', ' 87 ', ' 88 ', ' 89 ', ' 90 ',
       ' 91 ', ' 92 ', ' 93 ', ' 94 ', ' 95 ', ' 96 ', ' 97 ', ' 98 ', ' 99 ', ' 100 ',
       ' 101 ', ' 102 ', ' 103 ', ' 104 ', ' 105 ', ' 106 ', ' 107 ', ' 108 ', ' 109 ',
       ' 110 ', ' 111 ', ' 112 ', ' 113 ', ' 114 ', ' 115 ', ' 116 ', ' 117 ', ' 118 ',
       ' 119 ', ' 120 ', ' 121 ', ' 122 ', ' 123 ', ' 124 ', ' 125 ', ' 126 ', ' 127 '
   ],
   defaultValue: 0,
   numberOfSteps: 128
}, {
   name: author,
   type: "text"
}];


//Send PC and Bank Select when choosing values from menus
function ParameterChanged(param) {
   if (param == 0 || param == 1) {

       msb.number = 0;
       msb.value = 0;
       msb.send();

       lsb.number = 32;
       lsb.value = GetParameter("Bank");
       lsb.send();
       
       pc.number = GetParameter("Program");
       pc.send();
   }
}

//Let MIDI messages pass through
function HandleMIDI(e) {
   e.send();
}

 

 

2) See Ski's script here:

 

viewtopic.php?t=126499

Link to comment
Share on other sites

Hi Jordi,

 

This is an EXCELLENT start but here is the issue I have. My patch list is as follows... (a sample of it)

 

"Grand Piano RX" program="0" msb="121" lsb="10"

"Grand Piano" program="0" msb="121" lsb="3"

"Bright Piano GM" program="1" msb="121" lsb="0"

"Grand&MovingPad" program="0" msb="121" lsb="9"

"E.Grand Piano GM" program="2" msb="121" lsb="0"

"Honky-Tonk GM" program="3" msb="121" lsb="0"

ect.... 

 

If we go further down the list, for example the Bass patches.... we get to the following sample

"Drive Bass" program="38" msb="121" lsb="17"

"Nasty Bass" program="39" msb="121" lsb="6"

"30303 Bass" program="38" msb="121" lsb="5"

"Stein Bass" program="34" msb="121" lsb="3"

etc...

 

Further down at drums...

"Standard Kit RX1" program="5" msb="120" lsb="0"

"Standard Kit RX2" program="1" msb="120" lsb="0"

"Standard Kit RX3" program="2" msb="120" lsb="0"

"Standard Kit RX4" program="6" msb="120" lsb="0"

"Ambient Kit RX" program="3" msb="120" lsb="0"

"Pop Std. Kit RX" program="4" msb="120" lsb="0"

"Electro Kit RX1" program="75" msb="120" lsb="0"

"Electro Kit RX2" program="76" msb="120" lsb="0"

"Brush Kit RX1" program="42" msb="120" lsb="0"

"Brush Kit RX2" program="43" msb="120" lsb="0"

"Brush Kit RX3" program="44" msb="120" lsb="0"

etc...

 

Notice how PROGRAM, MSB and LSB are not in a linear order. All 3 (program, msb and lsb) can have random values for each patch, and gets even more random the further down I go in my list.

 

We could have 1 dropdown for the program like you did, but no need for a bank dropdown. Selecting a patch would send all 3 values of that patch via midi.

Also a sidenote, my Korg keyboard will get confused if the messages are not sent in the following order: Bank Messages first and then Program message.

 

I will check out the link you mentioned for the other script.

 

I REALLY appreciate this Jordi. Thanks again.

Link to comment
Share on other sites

We could have 1 dropdown for the program like you did, but no need for a bank dropdown. Selecting a patch would send all 3 values of that patch via midi.

 

OK, this does exactly that but of course you'll have to finish it yourself:

 

//Create PC, MSB and LSB objects;
var pc = new ProgramChange();
var msb = new ControlChange();
var lsb = new ControlChange();

//Set MIDI CC number to control the Patches menu
var ccNum = 1;

//Author string
var author = "Script by Jordi Torres";

//MIDI Channel strings array
var mChannel = [];

//Patches array
var Patches = [
   { patch: "Grand Piano RX", program: 0, msb: 121, lsb: 10 },
   { patch: "Grand Piano", program: 0, msb: 121, lsb: 3 },
   { patch: "Bright Piano GM", program: 1, msb: 121, lsb: 0 },
   { patch: "Grand & Moving Pad", program: 0, msb: 121, lsb: 9 }
];

//Populate MIDI Channels array
for (var i = 0; i < 16; i++) {
   mChannel[i] = String(i + 1);
}

//Create menus and author label
var PluginParameters = [{
   name: "Patches",
   type: "menu",
   valueStrings: ["Grand Piano RX | pc=0 msb=121 lsb=10",
       "Grand Piano | pc=0 msb=121 lsb=3",
       "Bright Piano GM | pc=1 msb=121 lsb=0",
       "Grand & Moving Pad | pc=0 msb=121 lsb=9"
   ],
   defaultValue: 0,
   numberOfSteps: 4
}, {
   name: "MIDI Channel",
   type: "menu",
   valueStrings: mChannel,
   defaultValue: 1
}, {
   name: author,
   type: "text"
}];

//Send Program Change and Bank Select MSB/LSB when selecting a patch from the menu
function ParameterChanged(param, value) {

   //MIDI Channel variable
   var midichannel = GetParameter("MIDI Channel") + 1;

   msb.number = 0;
   msb.value = Patches[GetParameter("Patches")].msb;
   msb.channel = midichannel;
   msb.send();

   lsb.number = 32;
   lsb.value = Patches[GetParameter("Patches")].lsb;
   lsb.channel = midichannel;
   lsb.send();

   pc.number = Patches[GetParameter("Patches")].program;
   pc.channel = midichannel;
   pc.send();
}

//Let MIDI messages pass through, control menu with a CC
function HandleMIDI(e) {
   if (e instanceof ControlChange && e.number == ccNum) {
       SetParameter(0, e.value);
   }
   e.send();
}

 

All you need to do is:

 

1- Add more patch objects to the "Patches" array

 

2- Add more patch name strings to "valueStrings" in the Patches menu (you could edit them to just show the patch name instead of patch name, pc, msb, lsb)

 

3- Adjust the "numberOfSteps" property in the Patches menu accordingly.

 

Also a sidenote, my Korg keyboard will get confused if the messages are not in the following order: Bank Messages first and then Program message.

 

I took care of that in the original script as well as in this one.

 

BONUS: Added a "ccNum" variable to set a CC to control the menu.

 

Have fun!

 

J.

Link to comment
Share on other sites

Hi,

 

Funny you asked, somebody else asked me the same question recently.

 

As far as I know, the only way a Scripter preset will output the state of all its parameters in one go is by either loading the preset or by clicking the "Run Script" button on the script editor window....with the condition that the track has already received MIDI before doing either of those things.

 

The only way I've found to emulate the act of loading a preset or clicking the "run script"  button (to get the Scripter to output the values of its parameters) when loading a project is (which sucks but it's actually not that bad if you have more than one Scripter plugin):

 

- Open your project, 

- Send some MIDI to the channel strip objects where you have the Scripter 

- Close the project and re-open it.

 

If you have more than one Scripter, you could set up a button in the environment that sends some MIDI event (a Note, for example) and connect it to all channel strip object where you have the Scripter.

 

Here's an animated GIF showing just that:

 

scripter.thumb.gif.f9406fd61d2322424b236ea8bd462f4d.gif

 

Again, I don't know if there's a better way. Ff there is, I'm all ears. Otherwise the best we can do is send feedback to the Logic development team and hopefully they'll do something to improve it:

 

http://www.apple.com/feedback/logic-pro.html

 

J.

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...