Jump to content

CC remap range (script)


jimdilian

Recommended Posts

It's easy to do, but some clarification is needed.

First, CC values range from 0 - 127 (there is no 128).

Next... are you looking to make the CC act as a switch? If so, the way I'm interpreting what you wrote would be the following (and here I'm using modwheel, CC1, as an example):

  • If the script detects a modwheel value anywhere from 0 through 126 (representing any modwheel position over almost the entire throw of the wheel) you want the Script to output a single MIDI event of CC1, value 40.
  • If the script detects a modwheel value of 127 (representing the wheel hitting maximum), the Script outputs a single MIDI event of CC1, value 100.

Another way to do this would be to simply divide the throw of the modwheel so that on either side of the midway point (0 - 63 or 64 - 127) the Script would generate either a value of 40 or a value or 127 (and just one event each).

Or did you have something else in mind?

Link to comment
Share on other sites

ok.. you are right.. 0-127..

yes .. I looking to change the values received by the cc4 from 0 to 127 to limit their values,

like 0 to 20 and 127 to 100.. with the option to change the values so my drums can interpret the new values.. I don't know if it is a "switch" or...something.. else.. is to change the values only.. it is for the hi hat on some AUis.. so the hi hat ..openness doesn't sound so open.. in toontrack.. changing the values on a script will be simpler than in toontrack.. and others like bfd.. and kontakt drums ..etc.

thank you for your answer. :wink:

Link to comment
Share on other sites

If I understand you correctly you are wanting a script that can take a range of 0-127 and remap it to some smaller range.  Try this:

var controller = 4;
var start = 50;
var end = 100;

function HandleMIDI(event) {

   if(event instanceof ControlChange && event.number == controller) {
      event.value = Math.round(((end - start) * event.value ) / 128) + start;
   }
   event.send();
   event.trace();
}
 
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...