Plugin JSFX de procesamiento MIDI para directos

Aquí está el código del plugin mencionado en DOS.

Funciones que cumple:

midisjfx

Descarga (Descargar como archivo sin extensión,más información en cómo instalar.)

desc:PabloFergus live MIDI tool
//tags: MIDI processing

slider1:0<0,16,1{All,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}>Input Channel
slider2:0<0,127,1>Low Cut
slider3:127<0,127,1>High Cut
slider4:0<-12,12,1>Transpose Semitones
slider5:0<-5,5,1>Transpose Octave
slider6:0<0,16,1{Input,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}>Output Channel
slider7:17<0,17,1{Input,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,Off}>Discarded Channel
slider8:0<0,3,1{Off,Sustain pedal,ModWheel}>Utility Filter

// these lines tell Reaper the effect has no audio input/output,
// which enables processing optimizations.
// MIDI-only FX should always have these lines.
in_pin:none
out_pin:none

@init

notebuf = 0; // 4 entries per open note: orignote, channel, vel, transnote
buflen = 0;

last_semi = 0;
last_oct = 1;
last_samplepos = 0;

@slider

inChannel = slider1 - 1;
outChannel = slider6 - 1;
discChannel = slider7 - 1;

@block

samplepos = play_position*srate;
samplechg = samplepos-last_samplepos;
samplechg < -samplesblock/2.0 || samplechg > samplesblock*3.0/2.0 ?
(
  buflen = 0;  // clear state on seek   
);
last_samplepos = samplepos;

slider4|0 != last_semi || slider5|0 != last_oct ?
(
  last_semi = slider4|0;
  last_oct = slider5|0;

  i = 0;
  loop
  (
    buflen,    

    n = notebuf[4*i]|0; // original note
    c = notebuf[4*i+1]|0; // channel
    v = notebuf[4*i+2]|0; // velocity
    t = notebuf[4*i+3]|0; // transposed note

    midisend(0, $x80|c, t); // clear the sustaining transposed note
    
    t = (n+last_oct*12+last_semi)|0; // new transposed note    
    t < 0 ? t = 0 : t > 127 ? t = 127;
    midisend(0, $x90|c, (v*256)|t); // send the new transposed note
    notebuf[4*i+3] = t; // update the buffer
 
    i = i+1;
  );
);

while 
(
  midirecv(offs, m1, m2) ?
  (
    s = m1&$xF0;
    s == $x90 || s == $x80 ? // note-on or note-off
    (
      n = m2&$xFF; // original note
      c = m1&$xF; // original channel
   
      n >= slider2 && n <= slider3 && (c == inChannel || inChannel == -1)  ?
      (
        v = (m2&$xFF00)/256; // velocity
        t = (n+12*last_oct+last_semi)|0; // transposed note
        t < 0 ? t = 0 : t > 127 ? t = 127;
        m2 = m2+t-n; // apply transposition      
        
        outChannel > -1 ? co = outChannel; //change out channel
        m1 = m1-c+co; //apply channel change
        c = m1&$xF; // new channel
        
        midisend(offs, m1, m2); //send transposed message
        
        
        i = -1;
        while // look for this note|channel already in the buffer
        (
          i = i+1;
          i < buflen && (notebuf[4*i]|0 != n || notebuf[4*i+1]|0 != c);
        );

        (s == $x90 && v > 0) ? // note-on, add to buffer
        (
          notebuf[4*i] = n;
          notebuf[4*i+1] = c;
          notebuf[4*i+2] = v;
          notebuf[4*i+3] = t;
          i == buflen ? buflen = buflen+1;
        ) 
        : // note-off, remove from buffer
        (
          i < buflen ?
          (
            memcpy(notebuf+4*i, notebuf+4*(i+1), 4*(buflen-i-1));  // delete the entry
            buflen = buflen-1;
          );
        );
      ) : discChannel < 0 ?
        (
          midisend(offs, m1, m2); //send discarded message on input channel
        ) : discChannel < 16 ?
        (
          midisend(offs, m1-c+discChannel, m2); //send discarded message on new chaannel
        );
    ) : slider8 == 1 && s == $xB0 && m2&$xFF == $x40 ?
      (
        s = s
      ) : slider8 == 2 && s == $xB0 && m2&$xFF == $x01 ?
        (
          s = s;
        ) :
          (
            midisend(offs, m1, m2); //send non-note-on/off message
          );
    1;
  );
);