Old 03-15-2017, 05:08 AM   #1
Vincent Sermonne
Petit manitou
 
Vincent Sermonne's Avatar
 
Join Date: Feb 2009
Location: Gémenos France
Posts: 7,347
Default request JS sustain with aftertouch for ReaSamplomatic

I have a JS that allows a sustain pedal by a CC of its choice with reasamplomatic. I would like this choice to extend to the aftertouch. I can do something with modulation parameters reacontrolmidi and midi link but I would like to simplify.

The autor of this JS is Benoit Sanchez

Code:
desc:Simulates a sustains behaviour.

slider1:64<0,127,1{0 Bank Sel M,1 Mod Wheel M,2 Breath M,3,4 Foot P M,5 Porta M,6 Data Entry M,7 Vol M,8 Balance M,9,10 Pan M,11 Expression M,12 Ctrl 1 M,13 Ctrl 2 M,14,15,16 GP Slider 1,17 GP Slider 2,18 GP Slider 3,19 GP Slider 4,20,21,22,23,24,25,26,27,28,29,30,31,32 Bank Sel L,33 Mod Wheel L,34 Breath L,35,36 Foot P L,37 Porta L,38 Data Entry L,39 Vol L,40 Balance L,41,42 Pan L,43 Expression L,44 Ctrl 1 L,45 Ctrl 2 L,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64 Hold P sw,65 Porta sw,66 Sustenuto sw,67 Soft P sw,68 Legato P sw,69 Hold 2 P sw,70 S.Variation,71 S.Timbre,72 S.Release,73 S.Attack,74 S.Brightness,75 S.Ctrl 6,76 S.Ctrl 7,77 S.Ctrl 8,78 S.Ctrl 9,79 S.Ctrl 10,80 GP B.1 sw,81 GP B.2 sw,82 GP B.3 sw,83 GP B.4 sw,84,85,86,87,88,89,90,91 Effects Lv,92 Trem Lv,93 Chorus Lv,94 Celeste Lv,95 Phaser Lv,96 Data B. Inc,97 Data B. Dec,98 NRP L,99 NRP M,100 RP L,101 RP M,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127}>Controller
slider2:0<0,1,{Disabled,Enabled}>Normal sustain

@init
NOTE_OFF = 8;
NOTE_ON = 9;
CONTROLLER = 11;
sustainOn = 0;
no[127] = 0;
@block
  while (
    input = midirecv(mpos, msg1, msg23);
    input  ? (
      statusHi = (msg1/16)|0;
      statusLo = (msg1-(statusHi*16))|0;
      data2 = (msg23/256)|0;
      data1 = (msg23-(data2*256))|0;

      send = 1;

      ((statusHi == CONTROLLER) && (data1 == slider1)) ? (
        ((sustainOn == 1) && (data2 < 64)) ? (
          sustainOn = 0;
          i = 0;
          loop(128,
            (no[i] == 1) ? (
              no[i] = 0;
              midisend(mpos, NOTE_ON*16 + statusLo, i);
            );
            i+=1;
          );
        ) : (
          ((sustainOn == 0) && (data2 >= 64)) ? (
            sustainOn = 1;
          );
        );
      );

      ((statusHi == CONTROLLER) && (data1 == 64) && (slider2 == 0)) ?
        send = 0;
      
      (sustainOn == 1) ? (
        ((statusHi == NOTE_OFF) || ((statusHi == NOTE_ON) && (data2 == 0))) ? (
          no[data1] = 1;
          send = 0;
        );
        ((statusHi == NOTE_ON) && (data2 > 0)) ? (
          (no[data1] == 1) ? (
            midisend(mpos, NOTE_ON*16 + statusLo, data1);
          );
          no[data1] = 0;
        );
      );
      
      (send == 1) ?
        midisend(mpos, msg1, msg23);
    );
    input;
  );
thank's for your help !
__________________
Vincent
http://www.tchackpoum.fr
Vincent Sermonne is offline   Reply With Quote
Old 03-17-2017, 03:04 PM   #2
Vincent Sermonne
Petit manitou
 
Vincent Sermonne's Avatar
 
Join Date: Feb 2009
Location: Gémenos France
Posts: 7,347
Default

No one buuuuuuh !
__________________
Vincent
http://www.tchackpoum.fr
Vincent Sermonne is offline   Reply With Quote
Old 03-18-2017, 02:10 AM   #3
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
Default

Not tested, but something like this maybe?

Code:
desc:Simulates a sustains behaviour.

slider1:64<0,128,1{0 Bank Sel M,1 Mod Wheel M,2 Breath M,3,4 Foot P M,5 Porta M,6 Data Entry M,7 Vol M,8 Balance M,9,10 Pan M,11 Expression M,12 Ctrl 1 M,13 Ctrl 2 M,14,15,16 GP Slider 1,17 GP Slider 2,18 GP Slider 3,19 GP Slider 4,20,21,22,23,24,25,26,27,28,29,30,31,32 Bank Sel L,33 Mod Wheel L,34 Breath L,35,36 Foot P L,37 Porta L,38 Data Entry L,39 Vol L,40 Balance L,41,42 Pan L,43 Expression L,44 Ctrl 1 L,45 Ctrl 2 L,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64 Hold P sw,65 Porta sw,66 Sustenuto sw,67 Soft P sw,68 Legato P sw,69 Hold 2 P sw,70 S.Variation,71 S.Timbre,72 S.Release,73 S.Attack,74 S.Brightness,75 S.Ctrl 6,76 S.Ctrl 7,77 S.Ctrl 8,78 S.Ctrl 9,79 S.Ctrl 10,80 GP B.1 sw,81 GP B.2 sw,82 GP B.3 sw,83 GP B.4 sw,84,85,86,87,88,89,90,91 Effects Lv,92 Trem Lv,93 Chorus Lv,94 Celeste Lv,95 Phaser Lv,96 Data B. Inc,97 Data B. Dec,98 NRP L,99 NRP M,100 RP L,101 RP M,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,Aftertouch}>Controller
slider2:0<0,1,{Disabled,Enabled}>Normal sustain

@init
NOTE_OFF = 8;
NOTE_ON = 9;
CONTROLLER = 11;
AFTERTOUCH = 13;
sustainOn = 0;
no[127] = 0;
@block
  while (
    input = midirecv(mpos, msg1, msg23);
    input  ? (
      statusHi = (msg1/16)|0;
      statusLo = (msg1-(statusHi*16))|0;
      data2 = (msg23/256)|0;
      data1 = (msg23-(data2*256))|0;

      send = 1;

      ((statusHi == CONTROLLER) && (data1 == slider1)) || ((statusHi == AFTERTOUCH) && (slider1 == 128)) ? (
        ((sustainOn == 1) && ((statusHi == CONTROLLER ? data2 : data1) < 64)) ? (
          sustainOn = 0;
          i = 0;
          loop(128,
            (no[i] == 1) ? (
              no[i] = 0;
              midisend(mpos, NOTE_ON*16 + statusLo, i);
            );
            i+=1;
          );
        ) : (
          ((sustainOn == 0) && ((statusHi == CONTROLLER ? data2 : data1) >= 64)) ? (
            sustainOn = 1;
          );
        );
      );

      ((statusHi == CONTROLLER) && (data1 == 64) && (slider2 == 0)) ?
        send = 0;
      
      (sustainOn == 1) ? (
        ((statusHi == NOTE_OFF) || ((statusHi == NOTE_ON) && (data2 == 0))) ? (
          no[data1] = 1;
          send = 0;
        );
        ((statusHi == NOTE_ON) && (data2 > 0)) ? (
          (no[data1] == 1) ? (
            midisend(mpos, NOTE_ON*16 + statusLo, data1);
          );
          no[data1] = 0;
        );
      );
      
      (send == 1) ?
        midisend(mpos, msg1, msg23);
    );
    input;
  );
Tale is offline   Reply With Quote
Old 03-18-2017, 05:50 AM   #4
Vincent Sermonne
Petit manitou
 
Vincent Sermonne's Avatar
 
Join Date: Feb 2009
Location: Gémenos France
Posts: 7,347
Default

Thank you Tale ! I go to test it imediatly !
__________________
Vincent
http://www.tchackpoum.fr
Vincent Sermonne is offline   Reply With Quote
Old 03-18-2017, 06:51 AM   #5
Vincent Sermonne
Petit manitou
 
Vincent Sermonne's Avatar
 
Join Date: Feb 2009
Location: Gémenos France
Posts: 7,347
Default

It not work buuuuh !
__________________
Vincent
http://www.tchackpoum.fr
Vincent Sermonne is offline   Reply With Quote
Old 03-19-2017, 02:07 AM   #6
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
Default

It seems to work here (although it releases sustain below 64, which might not be ideal for aftertouch), so maybe I don't understand what you are after...
Tale is offline   Reply With Quote
Old 03-19-2017, 08:18 AM   #7
Vincent Sermonne
Petit manitou
 
Vincent Sermonne's Avatar
 
Join Date: Feb 2009
Location: Gémenos France
Posts: 7,347
Default

Yes, you're right, it's my fault. In my case it is the reverse effect of the "hold-pedal" that I would need by the aftertouch. The hold action of this JS should be reversed.
The eDrum cymbal pads have an aftertouch controller for the muffled cymbal effect. This is what I am trying to achieve with ReaSamplomatic which has no "hold-pedal" function and this JS appeared to me as a possible opening.
__________________
Vincent
http://www.tchackpoum.fr

Last edited by Vincent Sermonne; 03-19-2017 at 02:16 PM.
Vincent Sermonne is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:16 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.