desc:MIDI velocity control

slider1:1<-16,16,0.1>velocity multiply (-16..16)
slider2:0<-128,128,1>velocity add (-128..128)
slider3:0<0,127,1>min velocity (0..127)
slider4:127<0,127,1>max velocity (0..127)
slider5:0<0,127,1>note range min
slider6:127<0,127,1>note range max

@init

@slider
slider3<0?slider3=0;
slider4>127?slider4=127;

@block
while (
midirecv(ts,msg1,msg23) ? 
(
  m=msg1&240;
  vel=(msg23/256)|0;
  note=msg23&127;
  m == 9*16 && vel > 0 && note >= slider5 && note <= slider6 ? 
  (
    vel = (vel*slider1)+slider2;
    vel<slider3?vel=slider3:vel>slider4?vel=slider4;
    vel|=0;

    vel > 0 ? midisend(ts,msg1,note+vel*256); // send note on 
  ) :
  (
    midisend(ts,msg1,msg23); // passthru
  );
  bla=1;
);
);

