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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...