Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Q&A, Tips, Tricks and Howto

Reply
 
Thread Tools Display Modes
Old 12-17-2018, 01:59 AM   #1
konstantinqq
Human being with feelings
 
Join Date: Dec 2018
Posts: 9
Default REAPER Midi Learn with Aftertouch CC and Aftertouch convert to CC

Guide will tell you:
How to use non CC messages, (including aftertouch) with Reaper “learn”.
Quote:
Originally Posted by mschnell View Post
(In fact the key to using "learn" (if you really must) with non-CC messages is to convert them to CCs in a track and then use MidiToReaControlPath to route them "down" to the "learning engine". )
(or translate CC#64 (Sustain) to CC#66 (Sostenuto) for example)

Quote:
Originally Posted by mschnell View Post
In fact the key to using "learn" (if you really must) with non-CC messages is to convert them to CCs in a track and then use MidiToReaControlPath to route them "down" to the "learning engine".
-Michael
For example, we convert aftertouch to CC 75, that understands REAPER learn:
(If you dont know (for example) how to install ReaPack, just google it.)

1.First step:
Use "Midi convert to CC", (that avaible after installation through ReaPack, which need to be installed first) Add this FX into your track "INPUT FX" and configure:
Choose midi message you want to convert. (Midi Message) (For example Aftertouch)
Then choose command you want to use with REAPER learn. (Out CC#) (For example 75)

2.
Add* VST plugin "MidiToReaControlPath" to your track "INPUT FX"
* Always add "MidiToReaControlPath" last in list, if you dont, it may not work, so drug and drop it into the end of FX list.

3.Now you can use REAPER learn with non CC message, that now, repeated to the CC message, which y're configured. (Aftertouch to CC 75 in our example).

Thx mschnell for manual.
Ver 0.99b


Bonus:
You can use aftertouch instead of two pedals in the same time for example, let's convert it into sostenuto (CC 66) and Una Corda pedal (Soft pedal CC 67):

1.
Use "Midi convert to CC", (that avaible after installation through ReaPack, which need to be installed first) Add this FX into your track "INPUT FX" and configure:
Choose midi message you want to convert. (Midi Message) (For example Aftertouch)
Then choose command you want to use with REAPER learn. (Out CC#) (For example 66)

2.
Use "Midi CC Mapper".
Add this FX into your track "INPUT FX" and configure:
Choose midi message you want to convert. (Controller Source) (For example 66).
Then choose command you want to use with previous command (Sostenuto with soft pedal). (Out CC#) (For our example 67).
Change parametr above: "Pass Through CC Source" to "Yes".

3.Enjoy!
*For additional pedal (or other command) you have to use additional "Midi CC Mapper". (Config it like in previous example).

Thx mschnell again.
Quote:
Originally Posted by mschnell
As described in the forum this should work by using the new version of "MIDI convert to CC" plus "Midi CC Mapper".
-Michael

Last edited by konstantinqq; 04-24-2019 at 08:25 AM. Reason: translation in manual
konstantinqq is offline   Reply With Quote
Old 12-17-2018, 08:29 AM   #2
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 8,395
Default

After Touch (aka Channel Pressure) is not a CC, see -> https://www.midi.org/specifications-...f-midi-message .

I think I will enhance "MIDI convert to CC" (available via ReaPack) to be able to convert channel Pressure....

-Michael
mschnell is offline   Reply With Quote
Old 12-17-2018, 08:54 AM   #3
konstantinqq
Human being with feelings
 
Join Date: Dec 2018
Posts: 9
Default

I translated this topic into the manual and this is what used to be here instead of what is now (a little history):

Quote:
Originally Posted by konstantinqq View Post
I want to use midi learn with aftertouch. But learn in reaper can't see aftertouch. ( MIDI OX can ).
Why i want it?
Because my novation impulse 61 have not plug for connect Sostenuto pedal (CC 66).
So, i want to press note, and with aftertouch emulate sostenuto pedal pressing for this note (or just sostenuto pedal).


May be it will be somehow helphul for man, who looking solution (not help to me, i'am beginner, so can't use it yet):
Quote:
Originally Posted by mpl View Post
Make sure you have track record arm enabled, monitoring turned on and track input was set to MIDI input from Virtual Keyboard
Code:
/*
Send MIDI CC channel 1 cc10 value 0
*/
// EEL Script for Reaper
// Author: pipelineaudio

/*
8 = Note Off 
9 = Note On 
10 = AfterTouch (ie, key pressure) 
11 = Control Change 
12 = Program (patch) change 
13 = Channel Pressure 
14 = Pitch Wheel
*/

msg_type = 11; // CC
channel = 0;
function main ()
(
StuffMIDIMessage(0, msg_type*16 + channel, 10, 0);
);

main ();
Quote:
Originally Posted by konstantinqq View Post
And this https://www.kvraudio.com/forum/viewtopic.php?t=271205

Quote:
"for midi control, Reaper gets the midi directly from the input port (loopbe in this case), so any midi processing you do within Reaper won't be used for its midi learn system.

to (sort of) do it all within reaper, you could have one track doing the conversion and sending it to a virtual midi port, which would be received by other tracks.

otherwise, i would say you should request that channel pressure be added as a midi control source in reaper."



Maybe there there is a REAPER Feature Request suggestion which I could vote?
Quote:
Originally Posted by mschnell View Post
After Touch (aka Channel Pressure) is not a CC, see -> https://www.midi.org/specifications-...f-midi-message .

I think I will enhance "MIDI convert to CC" (available via ReaPack) to be able to convert channel Pressure....

-Michael
So, to to get things done, need to use something like this?
"JS for CC to Program Change converter?"
https://forum.cockos.com/showthread.php?t=96152

Hope an easy solution will ever appear.

Last edited by konstantinqq; 12-19-2018 at 08:57 AM.
konstantinqq is offline   Reply With Quote
Old 12-17-2018, 10:59 AM   #4
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 8,395
Default

Here you are.
please test
Code:
desc: MIDI convert to CC
author: Michael Schnell (mschnell@bschnell.de)
version: 4.1
changelog: added After Touch
donation: United Nations Foundation http://www.unfoundation.org/
about:
  ## Description
  
  Midi CC, PC, Note On or Note Off messages are converted to Midi CC messages with a predefined Channel and CC #. The CC value is calculated from the incoming value. 
  
  All midi messages that don't fit the "In" specifications are passed through.
  
  The slider "In Channel" defines the channel the messages to be converted are expected in. "all" accepts any channel.
  
  The slider "Midi Message" selects if CC, PC, Note on or Note Off (Note number), Note on or Note Off (velocity), or Pitch bend are to be converted. With Note off, also note on messages with velocity 0 are used. With "Note On Velocity" beware that some keyboards send Note On with velocity 0 as Note Off message, so set the Min Input Value to 1. 
  
  The slider "In CC" is only used when "CC" is selected and defines the CC# of the eligible input messages.
  
  The sliders "Min Input Value" and "Max Input Value" d3efine the range of the eligible input values. When using Pitch Bend as an input, 0 .. 127 is converted to 0 ... 127.9921875 is converted (and 127 exactly is converted to  127.9921875 for convenience), and  it might make sense to tyoe in an exact value.
  
  The slider "Out Channel" defines the channel the converted messages are sent in. "same as received" reproduces ses the channel as received, as well dedicated in channel mode as when setting the in channel to "all" .
  
  The slider "Out CC" defines the Midi CC message # to be sent
  
  The slider "Min CC Value" defines the value to be sent when the Min Input Value is received. Hence there will be an offset of Min_Input_Value - Min_Outout_Value. 
  
  The slider "Max CC Value" defines the value to be sent when the Max Input Value is received. Hence there will be an appropriate stretching of the input range. 

  TODO: hysteresis with Pitch Bend input.

  (When testing beware that the JS: Midi Pitch Wheel LFO erroneously outputs Databyte 1 values > 127 ! )  

// License: LGPL - http://www.gnu.org/licenses/lgpl.html



slider1:0<0,16,1{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,all}>In Channel
slider2:0<0,6,1{CC,PC,Note On,Note Off,Note On Velocity,Note On Velocity,Pitch Bend,After Touch}>MIDI Message
slider3:1<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,N/A}>In CC# 
slider4:0<0,127,1)>Min Input Value
slider5:127<0,127,1)>Max Input Value
slider6:0<0,16,1{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,same as received}>Out Channel
slider7:1<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}>Out CC# 
slider8:0<0,127,1)>Min CC Value
slider9:127<0,127,1)>Max CC Value
slider10:1<0,1,1{off,on}>pass through unmodified messages

@slider
  inchannel = slider1;
  inchannel > 15 ? (          // all 
    inmask = 0xf0;
    inchannel = 0;
   ) : ( 
    inmask = 0xff;
  );
  m11 = -1;
  type = slider2;
  type == 0 ? (               // CC
    m1 = 0xb0 + inchannel;
    m2 = slider3;
    m2 >= 128 ? (
      slider3 = 1;
      m2 = 1;
    );
   ) : type == 1 ? (          // PC
    m1 = 0xc0 + inchannel;
    slider3 = 128;
   ) : type == 2 ? (          // Note On
    m1 = 0x90 + inchannel;
    slider3 = 128;
   ) : type == 3 ? (          // Note Off
    m1 = 0x80 + inchannel;
    m11= 0x90 + inchannel; 
    slider3 = 128;
   ) : type == 4 ? (          // Note On
    m1 = 0x90 + inchannel;
    slider3 = 128;
   ) : type == 5 ? (          // Note Off
    m1 = 0x80 + inchannel;
   ) : type == 6 ? (          // Pitch Bend
    m1 = 0xE0 + inchannel;
    slider3 = 128;
   ) : type == 7 ? (          // After Touch
    m1 = 0xD0 + inchannel;
    slider3 = 128;    
  );   
  inmin = slider4;
  inmax = slider5;
  inmin >= inmax ? (
    inmax = inmin+1;
    slider5 = inmax;
  );  
  inmax  = slider5;
  outchannel = slider6;
  outchannel > 15 ? (         // "same"
    mm1    = 0xb0;
   ) : ( 
    mm1    = 0xb0 + outchannel;
  ); 
  outCC   = slider7;
  outmin  = slider8;
  outmax  = slider9;
  factor  = (outmax-outmin) / (inmax - inmin);
  inmax2  = inmax;
  inmax2  == 127 ? inmax2  = 127 + (127/128);           // supposedly 127 is meant as maximim 
  factor2 = (outmax-outmin) / (inmax2 - inmin);
@block

function convert2 (mlow, mhigh) (
  mm = mhigh*128 + mlow;
  mm /= 128;
  mm >= inmin ? (
    mm <= inmax2 ? (
      m3 = ((((mm-inmin) * factor2) + 0.5) | 0) + outmin;
      m3 > 127 ? m3 = 127;
      m  = mm1;
      msg11 = -1;
    );  
  );  
);

function convert (mm) (
  mm >= inmin ? (
    mm <= inmax ? (
      m3 = ((((mm-inmin) * factor) + 0.5) | 0) + outmin;
      m3 > 127 ? m3 = 127;
      m  = mm1;
      msg11 = -1;
    );  
  );  
);

  while (midirecv(offset, msg1, msg2, msg3)) (
    msg11 = msg1 & inmask;
    m = 0;
//    type = slider2;
    type == 0 ? (                                // CC
      msg11 == m1 ? (
        msg2 == m2 ? (
          convert(msg3);
        );  
      );
     ) : type == 3 ? (                           // Note off 
      msg11 == m1 ? ( 
        convert(msg2);
       ) : (msg11 == m11) && (msg3 == 0) ? (     // Note On, Velocity 0 -> Note off
        convert(msg2);
      );   
     ) : type == 2 ? (                           // Note On
      msg11 == m1 ? ( 
        msg3 != 0 ? (                            // Velocity 0 -> Note off
          convert(msg2);
        );  
      );   
     ) : (type == 4) || (type == 5) ? (          // Note On or Off
      msg11 == m1 ? (
        convert(msg3);                
      );      
     ) : type == 6 ? (                           // Pich Bend
      msg11 == m1 ? (
        convert2(msg2, msg3);                
      );      
     ) : (type == 1) || (type == 7) ? (           // Program Change or After Touch
      msg11 == m1 ? (
        convert(msg2);                
      );      
    );     
    m  ?  (
      outchannel > 15 ? (
        m = m | (msg1 & 0x0f);                   // replace predefined channel by received channel
      );
      midisend(offset, m,    outCC,   m3); 
    );  
    !slider10 ? msg11 = -1;
    msg11 >= 0 ?  midisend(offset, msg1, msg2,  msg3); // pass through  
  );
-Michael
mschnell is offline   Reply With Quote
Old 12-17-2018, 12:14 PM   #5
konstantinqq
Human being with feelings
 
Join Date: Dec 2018
Posts: 9
Default

Quote:
Originally Posted by mschnell View Post
Here you are.
please test

-Michael

Iam trying to find manual, how launch this)
Iam really beginner in this)

Its probably ReaScript, so ive install it, and tryed launch your code, but
"
midi to CC.lua:1: function arguments expected near 'convert'
"

So i keep trying look into it, to make it work.

Last edited by konstantinqq; 12-17-2018 at 12:20 PM.
konstantinqq is offline   Reply With Quote
Old 12-17-2018, 12:36 PM   #6
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 8,395
Default

Quote:
Originally Posted by konstantinqq View Post
Iam trying to find manual, how launch this)
Iam really beginner in this)
Sorry for not providing instructions !
In the end this will be updated on "ReaPack" and same will automatically install it on request, but uploading to ReaPack takes some time and I wanted to get you going (and testing) right away.

You need to create a text file (using some text editor) with the code above pasted into it ans save the file with an arbitrary name (and e.g. no extension) in c:\users\your_user_name\\appdata\Roaming\REAPER\Effects\ (or open the directory in Reaper by Options -> Show Reaper Resource Path...

After that you can load the effect "MIDI convert to CC" in any track's FX chain.

-Michael
mschnell is offline   Reply With Quote
Old 12-17-2018, 01:10 PM   #7
konstantinqq
Human being with feelings
 
Join Date: Dec 2018
Posts: 9
Default

Got first result, it works! I'am like your solution, right. Thx, but need more time for tesing. (Ill send pm to you)

And, there is the thing,
I tryed to use the aftertouch for two pedals at once (64 and 66), but I failed:

I added them to the input FX chain of the instrument at once (first JS plugin - copy 1 and second - copy 2), and

Only the first plugin works. (Aftertouch successfully pressed only the pedal exposed in the first plugin (copy 1)).
https://imgur.com/u743VQp screenshot


And second thing, REAPER midi learn still not work with aftertouch (you already explained why, but may be someone suggested this feauture to developers?) (just about topic name)

Last edited by konstantinqq; 12-18-2018 at 01:42 AM.
konstantinqq is offline   Reply With Quote
Old 12-17-2018, 10:52 PM   #8
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 8,395
Default

Quote:
Originally Posted by konstantinqq View Post
Got first result, it works! I'am like your solution, right. Thx, but need more time for tesing. (Ill send pm to you)
Great !

Quote:
Originally Posted by konstantinqq View Post
I tryed to use the aftertouch for two pedals at once (64 and 66), but I failed:
While I don't really understand what you are trying to accomplish...

If this is a matter of my plugin:

The plugin is supposed to eat the Midi messages it converts to other ones and optionally bypass only those that it does not touch (see the description included).

If you just want to add another CC message to the stream, I suppose you can do this by the "Midi CC Mapper" JSFX. (I'm not sure if that is installed with Reaper by default.)

Quote:
Originally Posted by konstantinqq View Post
And second thing, REAPER midi learn still not work with aftertouch (you already explained why, but may be someone suggested this feauture to developers?) (just about topic name)
This is something discussed at some length in the "Live" subforum (BTW.: do you want to use this in a Live situation ? In that case, the "Live" subforum would be the better place to go, and do read the instructional thread over there !) To make the Reaper internal system (called the "Control Path") see the Midi messages that "live" in a track, you need to route them "down" by the MidiToReaControlPath VST (available from SWS). The Control Path is intentionally supposed to only handle CC messages. So other messages need to be converted in the way discussed above.

-Michael

Last edited by mschnell; 12-17-2018 at 11:03 PM.
mschnell is offline   Reply With Quote
Old 12-18-2018, 10:53 AM   #9
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 8,395
Default

Quote:
Originally Posted by konstantinqq View Post
REAPER midi learn still not work with aftertouch
What are you intending to use "learn" for ?
If you want to control any plugin parameters, those might be accessible directly by CC messages, If they are not, you can use "Param" -> "Midi Link" (the last touched parameter) or "Param" -> "parameter Modulation / Midi Link" -> ... with or without the help of "ReaControlMidi" to use Midi messages in the track's FX section for automation purposes.

-Michael
mschnell is offline   Reply With Quote
Old 12-18-2018, 12:22 PM   #10
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 8,395
Default

Re-reading the original message:

It seems that "learn" in fact is the completely wrong concept for this purpose. What you need is called a "Midi Filter": a plugin that reads Midi messages and outputs other Midi messages.

Regarding Aftertouch -> Sustenuto: seems like a funny playing style, but maybe doable .

And indeed the correct supforum would be the "Live" one.

-Michael
mschnell is offline   Reply With Quote
Old 12-18-2018, 12:33 PM   #11
konstantinqq
Human being with feelings
 
Join Date: Dec 2018
Posts: 9
Default

Quote:
Originally Posted by mschnell View Post
It seems that "learn" in fact is the completely wrong concept for this purpose. What you need is called a "Midi Filter": a plugin that reads Midi messages and outputs other Midi messages.
-Michael
Right, but now the qustion is how to make work topic theme. (with truly learn, indeed)

I got an idea:
First need to convert aftertouch to command, which understands REAPER midi learning.
Then use this command to reaper learn directly.

Last edited by konstantinqq; 12-19-2018 at 09:18 AM.
konstantinqq is offline   Reply With Quote
Old 12-18-2018, 02:25 PM   #12
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 8,395
Default

Quote:
Originally Posted by konstantinqq View Post
Right, but now the qustion is how to make work topic theme.
Edit the topic of your first message

(In fact the key to using "learn" (if you really must) with non-CC messages is to convert them to CCs in a track and then use MidiToReaControlPath to route them "down" to the "learning engine". )

-Michael
mschnell 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 03:25 PM.


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