Jump to content

Meta Events to CC or Note Velocity


Recommended Posts

Hello,

 

I am an arranger and realize MIDI mockups. Was wondering if anyone might write a script that converts Meta events to CC events or note velocity? I would like to be able to choose which Meta event and value to CC# and value or velocity and value. Hopefully this makes sense. Post questions.

 

I will compensate, no problem.

 

Thanks!

 

Tom

Link to comment
Share on other sites

I assume Scripter doesn't see meta events in Logic 10.4.8?? If it does see script below. If not, thank you for your help!

 

These are the meta events I want to work with:

 

Dynamic markings meta events, pppp through ffff.

 

Meta event# 0-ppp to CC2 value 10 or note velocity 10

Meta event# 1-pp to CC2 value 20 or note velocity 20

Meta event# 2-p to CC2 value 35 or note velocity 35

Meta event# 3-mp to CC2 value 50 or note velocity 50

Meta event# 4-mf to CC2 value 65 or note velocity 65

Meta event# 5-f to CC2 value 85 or note velocity 85

Meta event# 6-ff to CC2value 105 or note velocity 105

Meta event# 7-fff to CC2 value 115 or note velocity 115

Meta event# 12-ffff to CC2 value 127 or note velocity 127

Meta event# 13 pppp to CC2 value 5 or note velocity 5

 

I had this script written several years back, might this be edited for my purpose.

 

//

// Score to ArtID

//

// Created by Attila Enhardt on 2016-03-07

// Copyright LogicScripts 2016.

//

 

var PluginParameters = [];

var debug = 1;

var scriptName = 'Score to ArtID v.0.1';

//var NeedsTimingInfo = true;

//var updateGUI = 0;

var artIDs = [];

var activeArticulation = 0;

var oneShot = 0;

var shotNote = [];

var metas = [{

name : 'Select Meta + infinite/one-shot below'

}

];

 

function ArtID(name, number, value, oS, ix) {

this.name = name;

this.number = number;

this.value = value;

this.oS = oS;

this.ix = i;

this.set = function (args) {

if (typeof args[0] == number)

this.oneShot = args[0];

if (typeof args[1] == 'number')

this.number = args[1];

if (typeof args[2] == 'number')

this.value = args[2];

};

artIDs.push(this);

this.activate = function () {

activeArticulation = ix + 1; // double check the +1

oneShot = oS;

 

};

 

this.ppinit = (function () {

new Parameter(name + ' Ⓜ ' , 'menu', ['artNum',ix], metas.map(function (obj) {

return obj.name;

}));

new Parameter('⟾ / ① ', 'menu', ['oneShot', ix], ['Standard', 'One-Shot']);

})();

 

 

}

function Meta(name, n, v) {

this.name = v < 10 ? 'Meta n:' + n + ' v: ' + v + ' | ' + name : 'Meta n:' + n + ' v:' + v + ' | ' + name;

this.number = n;

this.value = v;

this.set = function(p) {

artIDs[p].set(['',this.number,this.value]);

};

metas.push(this);

}

function Parameter(n, t, pc, vs, miv, mav, def, nos, unit) {

if (t == 'checkbox') {

this.name = n;

this.type = t;

this.pc = pc;

this.defaultValue = 0;

PluginParameters.push(this);

} else if (t == 'div') {

this.name = '⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰';

this.type = 'text';

this.defaultValue = 0;

PluginParameters.push(this);

} else {

this.name = n;

this.type = t;

this.valueStrings = vs ? vs : 0;

this.minValue = miv ? miv : 0;

this.maxValue = mav ? mav : 0;

this.defaultValue = def ? def : 0;

this.numberOfSteps = nos ? nos : 0;

this.unit = unit;

this.pc = pc;

PluginParameters.push(this);

}

this.index = PluginParameters.length - 1;

this.remove = function () {

PluginParameters.splice(index, 1);

};

}

m601 = new Meta('Arco (text)', 60, 1);

m602 = new Meta('Pizzicato (text)', 60, 2);

m603 = new Meta('Spiccato (text)', 60, 3);

m604 = new Meta('Trill ½ step (text)', 60, 4);

m605 = new Meta('Trill 1 step (text)', 60, 5);

metas.push({

name : '▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬'

}); //U25AC

var m673 = new Meta('Staccato', 67, 3);

m675 = new Meta('Accent', 67, 5);

m677 = new Meta('Marcato', 67, 7);

m678 = new Meta('Spiccato', 67, 8);

m679 = new Meta('Legato', 67, 9);

m6712 = new Meta('Harmonics', 67, 12);

m676 = new Meta('Up bow', 67, 6);

m6711 = new Meta('Down bow', 67, 11);

m667 = new Meta('Tremolo', 66, 6);

 

 

function ppOrnament() {

new Parameter('⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰⥰', 'text');

}

 

function ppText(t) {

new Parameter(t, 'text');

}

 

function createGUI() {

ppScriptName = new ppText(scriptName);

for (i = 0; i < 16; i++) {

artIDs = new ArtID('Articulation ID ' + (i + 1),0,0,0,i);

}

}

 

function HandleMIDI(e) {

if (e instanceof ControlChange && e.channel == 16) {

for (var i = 0; i < artIDs.length ; i++) {

if (artIDs.number == e.number) {

artIDs.activate();

return;

}

}

}

if (e instanceof Note) {

if (activeArticulation) {

e.articulationID = activeArticulation;

switch (true) {

case (e instanceof NoteOn):

shotNote.push(e);

break;

case (e instanceof NoteOff):

if (e.pitch == shotNote.pitch) {

oneShot = 0;

shotNote.splice(0, 1);

}

break;

default:

}

}

e.send();

if (debug)

e.trace();

}

}

 

function ParameterChanged(p, v) {

var pcNo = PluginParameters[p].pc[1],

pcName = PluginParameters[p].pc[0];

switch (pcName) {

case 'artNum':

if(v)

metas[v].set(pcNo);

break;

case 'oneShot':

if(v)

artIDs[pcNo].set(v);

break;

default:

 

}

}

createGUI();

Link to comment
Share on other sites

So what I would recommend is that you learn more about the environment. The environment can detect and convert meta events . You might be able to use a simple environment transformer to convert meta events into some kind of CC event. Then Scripter could detect the CC event and do whatever you want to it in a more complicated manner. You could also do the whole thing entirely in the environment, but I view that as more complicated. Use environment just to transform meta events into some kind of CC event... and then in scripter you can use those CC events to do whatever you want to do to the notes entirely in the non-meta realm.
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...