Go Back   Cockos Incorporated Forums > REAPER Forums > MIDI Hardware, Control Surfaces, and OSC

Reply
 
Thread Tools Display Modes
Old 05-17-2013, 08:19 AM   #41
Tod
Human being with feelings
 
Tod's Avatar
 
Join Date: Jan 2010
Location: Just outside of Glacier National Park
Posts: 12,602
Default

Quote:
Originally Posted by DarkStar View Post
-- you need the updated version to handle CCs, removing them is working OK here; can you post a test project?
-- mpos, msg1, and msg23 are just names for variables (I borrowed them from the very first JS FX handling MIDI that I looked at - all credit to the author, can't remember who it is).
Thanks DarkStar, I did download the latest but since I downloaded them both and they have the same name, I guess it's possible they got switched and that may be what happened.

I'll download again to see and let you know.

Edit: I DLed it and took a look at it and it is different, I'll check it out and let you know.
__________________
Kontakt Vid Tutorials->Create Outputs / Create Templates -|- SMDrums Free drums -|- Elk Video Productions -|- Tod's Music
Tod is offline   Reply With Quote
Old 05-17-2013, 08:59 AM   #42
Tod
Human being with feelings
 
Tod's Avatar
 
Join Date: Jan 2010
Location: Just outside of Glacier National Park
Posts: 12,602
Default

Okay, I'm pretty sure I got the downloads mixed up yesterday but I should have the right one now.

This one has these array variables..

active_CC = active_note + num_notes * num_channels;
active_value = active_CC + num_notes * num_channels;


Unfortunately it doesn't seem to work on either the notes or CCs. Here is the project I used.

https://stash.reaper.fm/16456/01%20Da...p%20CC%201.RPP
__________________
Kontakt Vid Tutorials->Create Outputs / Create Templates -|- SMDrums Free drums -|- Elk Video Productions -|- Tod's Music
Tod is offline   Reply With Quote
Old 05-17-2013, 09:42 AM   #43
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 18,028
Default

Hmm, just tried your project here, recording the output and I get the (1487) redundant CCs removed. So I'm stumped.



You could try adding this line, after the other two memsets:
memset(active_value, EMPTY, num_notes * num_channels);
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar is offline   Reply With Quote
Old 05-17-2013, 10:31 AM   #44
Tod
Human being with feelings
 
Tod's Avatar
 
Join Date: Jan 2010
Location: Just outside of Glacier National Park
Posts: 12,602
Default

Okay, copied the line in and resaved.

However, Reaper is being really strange and not cooperating at all.

I completely deleted the original MON_DS file and replaced it with the new one. I know it's the new one because I've opend and checked 3 or 4 times now.

However, when I load it as an FX I'm still getting the old one which shouldn't exist anymore. I know it's the old one because I clicked on "Edit" on the FX and it's definitely not the new one. I've even re-scanned the FX a couple of times but the new one just doesn't show up. I also copied the MON_DS file and renamed it MON_DarkStar and it's not showing up either.

Incidentally DS, I notice in you picture that the overlapping notes didn't get fixed. That's strange because yesterday it did join them as can be seen in my picture back a ways.
__________________
Kontakt Vid Tutorials->Create Outputs / Create Templates -|- SMDrums Free drums -|- Elk Video Productions -|- Tod's Music
Tod is offline   Reply With Quote
Old 05-17-2013, 10:35 AM   #45
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by Tod View Post
[...] Incidentally DS, I notice in you picture that the overlapping notes didn't get fixed. That's strange because yesterday it did join them as can be seen in my picture back a ways.
You mean this one?



I would guess that the notes that are still shown overlapping *should* remain unaffected, because they use a different MIDI channel, and DS_MON was configured only to treat notes on one specific MIDI channel.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 05-17-2013, 10:46 AM   #46
Tod
Human being with feelings
 
Tod's Avatar
 
Join Date: Jan 2010
Location: Just outside of Glacier National Park
Posts: 12,602
Default

No this one on the bottom.



The strange thing is when I first tried it, it didn't work but when I copied/pasted the notes and events, it did join them.
__________________
Kontakt Vid Tutorials->Create Outputs / Create Templates -|- SMDrums Free drums -|- Elk Video Productions -|- Tod's Music
Tod is offline   Reply With Quote
Old 05-17-2013, 10:52 AM   #47
Tod
Human being with feelings
 
Tod's Avatar
 
Join Date: Jan 2010
Location: Just outside of Glacier National Park
Posts: 12,602
Default

Quote:
Originally Posted by Banned View Post
I would guess that the notes that are still shown overlapping *should* remain unaffected, because they use a different MIDI channel, and DS_MON was configured only to treat notes on one specific MIDI channel.
Humm, I didn't do anything different as far as the midi channels go. I've got the midi send track set "All => ALL".

Is there a way to set a particular midi channel? The FX itself is blank.
__________________
Kontakt Vid Tutorials->Create Outputs / Create Templates -|- SMDrums Free drums -|- Elk Video Productions -|- Tod's Music
Tod is offline   Reply With Quote
Old 05-17-2013, 10:58 AM   #48
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by Tod View Post
Humm, I didn't do anything different as far as the midi channels go. I've got the midi send track set "All => ALL".

Is there a way to set a particular midi channel? The FX itself is blank.
Hmm, that is obviously indeed the previous version then. The version I have show a control to set the MIDI channel(s). No idea what's giving you trouble; perhaps quit REAPER, then change versions on disk and relaunch?
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 05-17-2013, 11:34 AM   #49
Tod
Human being with feelings
 
Tod's Avatar
 
Join Date: Jan 2010
Location: Just outside of Glacier National Park
Posts: 12,602
Default

Okay finally got it working. Kind of a blunder-bus on my side, I wish I could say I'm just tired but I've only been up for 4 hours.

It's still not joining the notes, is it not supposed to? I did set it up for Channel 1 and made sure all the midi events and notes are channel 1 but that didn't make any difference. Also, if the channel is set to "Any Channel" in the FX it should be just like omni mode right?

I also see if you apply it as an item FX and then Glue, it also works, that's great.
__________________
Kontakt Vid Tutorials->Create Outputs / Create Templates -|- SMDrums Free drums -|- Elk Video Productions -|- Tod's Music
Tod is offline   Reply With Quote
Old 05-17-2013, 11:34 AM   #50
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 18,028
Default

Quote:
Originally Posted by Tod View Post
Incidentally DS, I notice in you picture that the overlapping notes didn't get fixed. That's strange because yesterday it did join them as can be seen in my picture back a ways.
By the time the clip got here there notes were no longer overlapping. I did not bother overlapping them again.

Remove all occurrences of of the FX (you may have multiple copies in different folders) and download / install the latest one.

A note overlaps only if it starts before the previous note with the same pitch and on the same channel ends.

A CC message is redundant only if its value is the same value as the previous CC with the same number on the same channel.

A blank JS FX GUI generally means a compilation error.

--------------
@Banned, does Tod's project work for you?
__________________
DarkStar ... interesting, if true. . . . Inspired by ...

Last edited by DarkStar; 05-20-2013 at 07:14 AM.
DarkStar is offline   Reply With Quote
Old 05-17-2013, 11:39 AM   #51
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 18,028
Default

Quote:
Originally Posted by Tod View Post
It's still not joining the notes, is it not supposed to
Double-check that they are still overlapping in the source clip.

"Any" channel means handle overlaps on any channel, but it does not mean that a channel N note can overlap any note on another channel. Perhaps I should have another selection:
(a) handle overlaps on a channel for channel NN
(b) handle overlaps on a channel for any channel
(c) [NEW] handle overlaps, using the pitch only, ignoring channel completely.
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar is offline   Reply With Quote
Old 05-17-2013, 11:42 AM   #52
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by DarkStar View Post
[...] @Banned, does Tod's project work for you?
Haven't checked that yet, will be happy to try that later and report back.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 05-17-2013, 12:01 PM   #53
Tod
Human being with feelings
 
Tod's Avatar
 
Join Date: Jan 2010
Location: Just outside of Glacier National Park
Posts: 12,602
Default

Quote:
Originally Posted by DarkStar View Post
Double-check that they are still overlapping in the source clip.
Okay I re-overlapped them and it does work. What's strange is that they immediately went back to not being overlapped but it still worked.


Quote:
"Any" channel means handle overlaps on any channel, but it does not mean that a channel N note can overlap any note on another channel. Perhaps I should have another selection:
(a) handle overlaps on a channel for channel NN
(b) handle overlaps on a channel for any channel
(c) [NEW] handle overlaps, using the pitch only, ignoring channel completely.
Yes, I know for myself if it says "Any" I would like it to act like it's in complete Omni mode. Actully (C) would do the trick.
__________________
Kontakt Vid Tutorials->Create Outputs / Create Templates -|- SMDrums Free drums -|- Elk Video Productions -|- Tod's Music
Tod is offline   Reply With Quote
Old 05-18-2013, 10:52 AM   #54
Tod
Human being with feelings
 
Tod's Avatar
 
Join Date: Jan 2010
Location: Just outside of Glacier National Park
Posts: 12,602
Default

Hi DS, is there any chance we could get these as separate scripts?

I've looked it over but don't understand enough about it to do it myself.
__________________
Kontakt Vid Tutorials->Create Outputs / Create Templates -|- SMDrums Free drums -|- Elk Video Productions -|- Tod's Music
Tod is offline   Reply With Quote
Old 05-19-2013, 01:10 AM   #55
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 18,028
Default

... will do, later
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar is offline   Reply With Quote
Old 05-19-2013, 03:02 AM   #56
Jeffos
Mortal
 
Jeffos's Avatar
 
Join Date: Dec 2008
Location: France
Posts: 1,969
Default

@DS: 1; !
Jeffos is offline   Reply With Quote
Old 05-19-2013, 10:16 AM   #57
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 18,028
Default

Quote:
Originally Posted by Jeffos View Post
@DS: 1; !
Sure? There is only one statement, midirecv(...); within the while loop.

There's none here:
Code:
while( midirecv(offs,msg1,msg23) ? ( midisend(offs,msg1,msg23); ); );
MIDI_CC_mapper and MIDI_transpose don't have 1; (but MIDI_logger does).
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar is offline   Reply With Quote
Old 05-19-2013, 11:55 AM   #58
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 18,028
Default

Here we go. I have separated the functions into two different JS FX:
MON - Merges overlapping notes
RedCC - deletes redundant CC messages


The matching criterion is one of:
Ignore MIDI channel, match only on pitch or CC number and value
For each channel, match on pitch or CC number and value
For the selected channel only, match on pitch or CC number and value
Just in case, rename the old MON_DS so that it is not overwritten.
Attached Files
File Type: txt MON_DS.txt (4.2 KB, 66 views)
File Type: txt RedCC_DS.txt (3.5 KB, 62 views)
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar is offline   Reply With Quote
Old 05-19-2013, 01:00 PM   #59
Tod
Human being with feelings
 
Tod's Avatar
 
Join Date: Jan 2010
Location: Just outside of Glacier National Park
Posts: 12,602
Default

Thanks much much DS, this is great.

I did take an honest stab at this but it would take a little time to get acquainted with all the operators, statements, and functions. I also had a little trouble getting a handle on some of the undeclared variables.

By the way, do you have a special editor for this? I've got a editor for Kontakt created by Nils Liberg that I loased it into and I think that might work for editing this stuff. It's got some nice Copy$Paste features as well as customizable indentation and numbered lines.

Again thank you much.
__________________
Kontakt Vid Tutorials->Create Outputs / Create Templates -|- SMDrums Free drums -|- Elk Video Productions -|- Tod's Music
Tod is offline   Reply With Quote
Old 05-20-2013, 01:51 AM   #60
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 18,028
Default

I generally use the built-in Editor, but I believe that there are some templates (right word?) for Notepad ++.

I started by taking some simple JS FX and going through them line by line working out what each line does.

PS The easiest way to test overlapping notes is to have the notes in two different MIDI clips on the track. That way, they stay overlapped:

__________________
DarkStar ... interesting, if true. . . . Inspired by ...

Last edited by DarkStar; 05-20-2013 at 03:36 AM.
DarkStar is offline   Reply With Quote
Old 05-20-2013, 09:49 AM   #61
Tod
Human being with feelings
 
Tod's Avatar
 
Join Date: Jan 2010
Location: Just outside of Glacier National Park
Posts: 12,602
Default

Quote:
Originally Posted by DarkStar View Post
I generally use the built-in Editor, but I believe that there are some templates (right word?) for Notepad ++.
Yes, Notepad ++ does, I thought the JS stuff was in C++ but it's just C. It highlights things very nicely.

Quote:
I started by taking some simple JS FX and going through them line by line working out what each line does.
Yes, that's what I did with your script, however I need to get to know how all the commands and operators work. I did make a pdf of the JS Programming Reference so I can search for specifics. My problem with it all is that if I get started and get serious I can end up being engrossed in it for months.

Quote:
PS The easiest way to test overlapping notes is to have the notes in two different MIDI clips on the track. That way, they stay overlapped:
Thanks for the tip, I'll give that a try.
__________________
Kontakt Vid Tutorials->Create Outputs / Create Templates -|- SMDrums Free drums -|- Elk Video Productions -|- Tod's Music
Tod is offline   Reply With Quote
Old 12-24-2013, 09:27 AM   #62
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 18,028
Default

New version, now you can process all CC message numbers or just one selected CC number:

Code:
desc:Remove redundant CC messages [v1.06]

/* *********************************************
   Features:
   -- detects redundant CC messages (same CC number, MIDI channel and value)
      and deletes them
   -- Match menu choices:
          Ignore MIDI channel, match only on CC number and value
          For each channel, match on CC number and value
          For the selected channel only, match on CC number and value
   -- Match CC# choices: 
          check all CC message numbers
          check the selected CC number only   
   **********************************************
*/

in_pin:none
out_pin:none

slider1:1<0,17,1{ignoring channels,on each channel,on Channel 01,on Channel 02,on Channel 03,on Channel 04,on Channel 05,on Channel 06,on Channel 07,on Channel 08,on Channel 09,on Channel 10,on Channel 11,on Channel 12,on Channel 13,on Channel 14,on Channel 15,on Channel 16}> Match CCs
slider2:0<0,128,1{, ** all CCs **,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}>CC Target

slider3:0<0,4096,1>CCs kept
slider4:0<0,4096,1>CCs removed


// ==========================================================
@init
// ==========================================================

//    ext_noinit = 1; // do not initialise on Start / Stop
    NOTE_ON = 9;
    NOTE_OFF = 8;
    CC_MSG = 11;
    ALL_NOTES_OFF = 123;
    ALL_SOUND_OFF = 120;
    NO = 0; YES = 1; 
    EMPTY = -1;
    IGNORE = -1;
    ANY = 0;
    ALL_CCs = -1;

    match_channel = ANY;

    CCs_kept = 0;
    CCs_removed  = 0; 

// ------------------------------------------------
// ARRAYS
// ------------------------------------------------

// Array of active CC values

    num_msgs    = 128;
    num_channels = 17;        // the 17th is for the "Ignore channels" option
    start_active_values =  1024;
    active_value  = start_active_values;
        memset(active_value, EMPTY, num_msgs * num_channels);        


// ==========================================================
@slider
// ==========================================================
    match_channel = slider1 -1;           
// set to EMPTY to ignore channels, ANY to do each channel, or 01 ... 16 
    match_CC     = slider2 -1;


// ==========================================================
@block
// ==========================================================

    while (
        midirecv(mpos, msg1, msg23) ? (
            msg = (msg1 / 16) | 0;
            msg_channel = 1 + msg1 - (msg * 16);        // extracted value is 01 ... 16
            msg_chan_idx = msg_channel -1;              // index is 00 ... 15  
            msg_num = msg23 & 127;
            msg_value = (msg23 / 256) | 0;
        
            CC_rcvd =  (msg == CC_MSG && msg_num < ALL_SOUND_OFF
                        && (match_channel <= ANY || match_channel == msg_channel)
                        && (match_CC == ALL_CCs  || match_CC == msg_num));

// ------------------------------------------------
// .... Control Change
            CC_rcvd ? (
                match_channel == IGNORE ? msg_chan_idx = 16;
                idx = msg_chan_idx * 128 + msg_num;
                msg_value != active_value[idx] ? (
                    active_value[idx] = msg_value;
                    midisend(mpos, msg1, msg23); 
                    CCs_kept +=1;
                ): CCs_removed +=1;

// ------------------------------------------------
// .... other MIDI messages
            ): midisend(mpos, msg1, msg23);

         ); // end of the midirecv condition
    ); // end of 'while' loop 

    slider3 = CCs_kept;
    slider4 = CCs_removed;
    sliderchange();

    CCs_kept > 4096 ? CCs_kept = 0;
    CCs_removed > 4096 ? CCs_removed = 0;
Happy Christmas
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar 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 02:59 PM.


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