grazuck Posted February 9, 2015 Share Posted February 9, 2015 Hello everyone. I am not a programmer, i have never used javascript or anything and i have a basic knowledge of how coding works. That said, I am trying to create a script to control the following: -note range -note octave it's basically the Key Range script, with an added option of choosing the octave to play (choosing between +1 which transposes +12 steps, +2 which transposes 24 steps, -1 which transposes -12 steps, and -2 which transposes -24 steps). So far i have gotten to this: ----------------------------------------------------------- var activeNotes = []; function HandleMIDI(event) { if (event instanceof NoteOn) { if (event.pitch > GetParameter('Maximum Pitch')) return undefined; // don't send if too high if (event.pitch < GetParameter('Minimum Pitch')) return undefined; // don't send if too low if (GetParameter('Octave') = 1) event.pitch=+12 if (GetParameter('Octave')=-1) event.pitch=-12 if (GetParameter('Octave')=2) event.pitch=+24 if (GetParameter('Octave')=-2) event.pitch=-24 if (GetParameter('Octave')=0) event.pitch=0 else { activeNotes.push(event); event.send() } } else if (event instanceof NoteOff) { for (i=0; i < activeNotes.length; i++) { if (event.pitch == activeNotes.pitch) { event.send(); activeNotes.splice(i,1); break; } } } else { // pass non-note events through event.send(); } } var PluginParameters = [ { name:"Octave", defaultValue:0, minValue:-2, maxValue:2, numberOfSteps:4,type:'lin'}, { name:'Maximum Pitch', type:'lin', minValue:0, maxValue:127, numberOfSteps:127, defaultValue:115}, { name:'Minimum Pitch', type:'lin', minValue:0, maxValue:127, numberOfSteps:127, defaultValue:30} ]; ----------------------------------------------- this gives me the octave slider in the UI, but when i run the script and play a note, it returns an error and i don't understand what happens. Any input? THAAAAANKS Quote Link to comment Share on other sites More sharing options...
FredBegin Posted February 11, 2015 Share Posted February 11, 2015 I'm not a programmer either but i could run your script without the error message. change if (GetParameter('Octave') = 1) for if (GetParameter("Octave") == 1) On every line. Now there is other problems. At octave 0 no note is passing thru. at other octave you need a note off signal. 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.