papiel Posted December 25, 2014 Share Posted December 25, 2014 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; } } }} Quote Link to comment Share on other sites More sharing options...
drb Posted December 26, 2014 Share Posted December 26, 2014 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 Quote Link to comment Share on other sites More sharing options...
papiel Posted December 27, 2014 Author Share Posted December 27, 2014 thanks! I figured that's where things go wrong. I'll start by taking the UI element out of the picture and work on the algorithm first then try to incorporate the sliders. Quote Link to comment Share on other sites More sharing options...
papiel Posted January 4, 2015 Author Share Posted January 4, 2015 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? Quote Link to comment Share on other sites More sharing options...
Unheardofski Posted February 13, 2015 Share Posted February 13, 2015 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.