Jump to content

please help with this midi script


papiel

Recommended Posts

I'm trying to compare incoming notes against an array (well, eventually a bunch of arrays) which is filled by UI sliders, but something goes wrong in the "IF" line.

can someone please help?

 

 

var chan = 0;

var PluginParameters = [

{ name:'common note 1', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48},

{ name:'common note 2', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48},

{ name:'common note 3', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48},

{ name:'common note 4', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48},

{ name:'group A note 1', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48},

{ name:'group A note 2', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48},

{ name:'group A note 3', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48},

{ name:'group B note 1', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48},

{ name:'group B note 2', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48},

{ name:'group B note 3', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48},

{ name:'group C note 1', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48},

{ name:'group C note 2', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48},

{ name:'group C note 3', type:'lin',

minValue:36, maxValue:60, numberOfSteps:24, defaultValue:48}

];

var common = ['common note 1', 'common note 2', 'common note 3', 'common note 4'];

var groupA = ['group A note 1', 'group A note 2', 'group A note 3'];

var groupB = ['group B note 1', 'group B note 2', 'group B note 3'];

var groupC = ['group C note 1', 'group C note 2', 'group C note 3'];

 

function HandleMIDI(event) {

if (event instanceof NoteOn) {

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

if (event.pitch == common) {

event.send();

break;

}

}

}}

Link to comment
Share on other sites

papiel,

 

After a brief look...

 

A Javascript statement like

 

var groupA = ['group A note 1', 'group A note 2', 'group A note 3'];

 

does not get a parameter value and put it in your array groupA. It merely puts the string, not number, value "group A note 1" in your array. You need to do something like use GetParameter('group A note 1') to actually get the parameter value.

 

Look up GetParameter in the effects manual.

 

HTH,

 

drb

Link to comment
Share on other sites

ok so I got the rest of it, but now how do I

1. create a series of UI sliders (preferably with note names - C, C# etc.. over two octaves)

2. get the current sliders positions into an array

3. compare incoming midi notes' pitch with the arrays?

Link to comment
Share on other sites

  • 1 month later...

There is a folder called Tutorial Scripts in the presets menu for scripter. You can basically copy/paste a slider from there (I reccomend using something like TextMate or TextWrangler for the actual editing, the built in editor is horrific).

 

1. Check out the tutorials "Slider Creation" - although if you want note names you will have to make a menu instead so "Menu Creation".

2. Either the function GetParameter("whateverparameter") or ParameterChanged.

 

If you look at the Sustain Pedal script I made it contains some of this stuff in conext.

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