Changing MIDI note depending on last CC value

VST, AU, AAX, CLAP, etc. Plugin Virtual Instruments Discussion
Post Reply New Topic
RELATED
PRODUCTS

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
Hello all,

I'm trying to connect my v-drums to a certain software (Roland dt-1) using MIDI. I'm having trouble dealing with the following issue: dt-1 expects different note values for open and closed hi-hat (42 and 46, I believe). However, my hi-hat controller is a variable one, it sends different CC values as the pedal is pressed or released, but the note number remains the same. This is ideal for some VSTs (e.g. Superior Drummer), but not for dt-1.

I had to change some note numbers using midi-ox (in combination with loopmidi virtual cable). However, I can't figure out how to treat this one.

Does anybody know of a VST that can do this (or if midi-ox can?). I'm using Reaper as a host (win7, 64-bit). A VST solution is preferred to avoid latency increase (virtual cables tend to introduce it).

This is the sample output of midi-ox when closing hi-hat, hitting it, opening it and hitting it again:

Code: Select all (#)

284079  3  --    185     4    46   10  ---  CC: Foot Controller
284192  3  --    185     4    52   10  ---  CC: Foot Controller
284356  3  --    185     4    65   10  ---  CC: Foot Controller
284420  3  --    185     4    79   10  ---  CC: Foot Controller
284486  3  --    185     4    92   10  ---  CC: Foot Controller
284558  3  --    185     4   104   10  ---  CC: Foot Controller
284630  3  --    185     4   115   10  ---  CC: Foot Controller
284716  3  --    185     4   122   10  ---  CC: Foot Controller
284797  3  --    185     4   127   10  ---  CC: Foot Controller
286771  3  --    185     4   127   10  ---  CC: Foot Controller
286772  3  --    153    46    34   10  Bb 2 Note On            
286872  3  --    137    46    64   10  Bb 2 Note Off           
288264  3  --    185     4   119   10  ---  CC: Foot Controller
288386  3  --    185     4   113   10  ---  CC: Foot Controller
288559  3  --    185     4   104   10  ---  CC: Foot Controller
288625  3  --    185     4    88   10  ---  CC: Foot Controller
288682  3  --    185     4    71   10  ---  CC: Foot Controller
288730  3  --    185     4    54   10  ---  CC: Foot Controller
288788  3  --    185     4    37   10  ---  CC: Foot Controller
288862  3  --    185     4    21   10  ---  CC: Foot Controller
288946  3  --    185     4     9   10  ---  CC: Foot Controller
289010  3  --    185     4     0   10  ---  CC: Foot Controller
289795  3  --    185     4     0   10  ---  CC: Foot Controller
289795  3  --    153    46    37   10  Bb 2 Note On            
289895  3  --    137    46    64   10  Bb 2 Note Off           
Thanks a lot in advance,
Alexander

P.S. I know I can change the drum module settings to send different note numbers, but that will break Superior Drummer's hi-hat expressiveness.

Post

why do you say changing the drum module settings will "break" Superior Drummer? is it a difficult to change setting? otherwise, can't you just set it in one way when using DT-1, and in another way when using other VSTs?

that aside, I guess VstLua can fit the job pretty well. requires some coding, yeah, but shouldn't be that hard looking at the examples :-)

also, seems to be quite well documented.

I never used it myself, so I can't help and don't know if it really works out of the box. there may even be easier ways to accomplish what you're trying to do.

hope this helps, anyway :-)

cheers,
Aldo

Post

Try MidiConverter3. You might have to use several instances if one can only convert a CC range to a single note at a time. Just don't forget to send all MIDI through to the next plugin. (there's a Reaper option (Merges....) under the MIDI button in the FX window if the plugin is not doing what you want).

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
dadaumpa wrote:why do you say changing the drum module settings will "break" Superior Drummer? is it a difficult to change setting? otherwise, can't you just set it in one way when using DT-1, and in another way when using other VSTs?
It's not difficult, but right now my setup looks like this:
Module -> Reaper with Superior Drummer 2 -> midi-ox -> dt-1.
I need to use both SD2 and dt-1 in real-time. So if I change the module setting, I will gain dt-1 compatibility but will lose the hi-hat versatility of SD2.
that aside, I guess VstLua (http://www.hermannseib.com/VstLua/index.html) can fit the job pretty well. requires some coding, yeah, but shouldn't be that hard looking at the examples :-)
also, seems to be quite well documented (http://www.hermannseib.com/VstLua/VstLuaApi.html).
Thanks, I'll check it out. Reaper also has some kind of javascript API, I was just hoping to find a solution without getting my hands dirty with programming :)
V'ger wrote:Try MidiConverter3. You might have to use several instances if one can only convert a CC range to a single note at a time. Just don't forget to send all MIDI through to the next plugin. (there's a Reaper option (Merges....) under the MIDI button in the FX window if the plugin is not doing what you want).
Thanks, I'll try that. Note that I don't need to convert a CC range to a note, I need to convert a note depending on previously received CC value. I'll check if MidiConverter3 can do that...

Thank you both,
Alexander

Post

Yes you want CC of values between 0-63 to be turned into a specific note on message, and CC 64-127 to another, right? I think it should be possible with 2 instances of Midiconverter3. Let me know if you need more help with that.

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
Yes you want CC of values between 0-63 to be turned into a specific note on message, and CC 64-127 to another, right? I think it should be possible with 2 instances of Midiconverter3. Let me know if you need more help with that.
Thanks, but it's not what I want. I want to store the last received CC message and change the subsequent MIDI note messages depending on the value in that CC message.


Meanwhile, the mention of vstlua gave me an idea to implement this in Reaper's JS. And it works!

Here's the code, in case anyone's interested:

Code: Select all (#)

// Transform a midi note number to 2 other numbers depending on previously received CC value.
// This is useful for transforming variable hi-hat controller messages with a single hi-hat note
// to hi-hat open/closed notes.

// Author: Alexander Shaduri
// License: Public domain (see unlicense.org)

desc: Split notes by CC

slider1:4<0,128,1>CC Controller:
slider2:65<0,128,1>Use small note for CC value less than:

slider3:0<0,127,1>Input note:
slider4:0<0,127,1>Small note:
slider5:0<0,127,1>Large note:
slider6:0<0,16,1{Any,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}>Input Channel:

// MIDI-only FX should always have these lines for optimization
in_pin:none
out_pin:none


@init

MSG_NOTE_OFF = 8 * 16;
MSG_NOTE_ON   = 9 * 16;
MSG_CC = 11 * 16;


@slider

user_cc_number = slider1;
user_border_cc_value = slider2;
user_in_note = slider3;
user_out_small = slider4;
user_out_large = slider5;
user_in_channel = slider6-1;


@block

//last_cc_value = 127;

while (
  midirecv(offset,msg1,msg23) ? (
    channel = msg1 & 15;  // Low four bits is channel number (15 == 00001111)

    // Is it on our channel or are we using all channels?
    (channel == user_in_channel || user_in_channel == -1) ? (
      msg_type = msg1 & 240;  // High four bits is message type (240 == 11110000)

      // If this is a CC event, store its value
      (msg_type == MSG_CC && ((msg23&255) == user_cc_number)) ? (
        last_cc_value = (msg23/256)&255;
      );

      // If this is a note event, check and transform it
      (msg_type == MSG_NOTE_ON || msg_type == MSG_NOTE_OFF) ? (
        note = msg23 & 127;

        (note == user_in_note) ? (
          velocity = (msg23 / 256) | 0;
          //original_note = note;
          //comparison_cc_val = last_cc_value;
          (last_cc_value < user_border_cc_value) ? (
            note = user_out_small;
          ) : (
            note = user_out_large;
          );
          //modified_note = note;
          msg23 = note | (velocity * 256);
        );
      );
    );

    midisend(offset,msg1,msg23);  // Send the data
  );
);

I also implemented a simple midi note mapper (changes one midi note to another). This allowed me to get rid of midi-ox completely.

Here's the code:

Code: Select all (#)

// Transform a midi note number to another.
// Author: Alexander Shaduri
// License: Public domain (see unlicense.org)

desc: MIDI note mapper

slider1:0<0,16,1{Any,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}>Input Channel:
slider2:0<0,127,1>Input note:
slider3:0<0,127,1>Output note:

// MIDI-only FX should always have these lines for optimization
in_pin:none
out_pin:none


@init

MSG_NOTE_OFF = 8 * 16;
MSG_NOTE_ON   = 9 * 16;

@slider

user_in_channel = slider1-1;
user_in_note = slider2;
user_out_note = slider3;


@block

while (
  midirecv(offset,msg1,msg23) ? (
    channel = msg1 & 15;  // Low four bits is channel number (15 == 00001111)

    // Is it on our channel or are we using all channels?
    (channel == user_in_channel || user_in_channel == -1) ? (
      msg_type = msg1 & 240;  // High four bits is message type (240 == 11110000)

      // If this is a note event, check and transform it
      (msg_type == MSG_NOTE_ON || msg_type == MSG_NOTE_OFF) ? (
        note = msg23 & 127;

        (note == user_in_note) ? (
          velocity = (msg23 / 256) | 0;
          msg23 = user_out_note | (velocity * 256);
        );
      );
    );

    midisend(offset,msg1,msg23);  // Send the data
  );
);
Cheers,
Alexander

Post

Perfect solution, well done.

I suppose it will go up in Reaper stash/tips and tricks forum thread

Post Reply

Return to “Instruments”