Old 08-26-2015, 01:37 PM   #1
digaldeman
Human being with feelings
 
digaldeman's Avatar
 
Join Date: Mar 2007
Location: In Da Club
Posts: 297
Default REQ: select every other MIDI note.

Is it possible to select every other note (or every 3rd, 4th note etc.)with a script?

Is it also possible to select every other chord?









Attached Images
File Type: jpg Before.jpg (22.4 KB, 2041 views)
File Type: jpg After.jpg (16.2 KB, 2001 views)
File Type: jpg Mixture.jpg (27.4 KB, 2012 views)
digaldeman is offline   Reply With Quote
Old 08-26-2015, 03:13 PM   #2
Lazarus
Human being with feelings
 
Join Date: Aug 2013
Posts: 1,355
Default

Yes, you can do the first already with the MIDI scripts I've been doing. I'll add the second soon, it's been on the list for a bit.

edit: that's it done - well I changed it so that one function does both things (who wants to select every second note going vertically and horizontally at the same time anyway?). It's in the script called Select Console which you can get here....

https://github.com/Lazzle/ReaMIDI

Last edited by Lazarus; 08-26-2015 at 03:33 PM.
Lazarus is offline   Reply With Quote
Old 08-26-2015, 10:19 PM   #3
digaldeman
Human being with feelings
 
digaldeman's Avatar
 
Join Date: Mar 2007
Location: In Da Club
Posts: 297
Default

I just tried the Select Console script and entered 2 in the text box but it selects all the notes instead. I don't know if I doing something wrong. The Select Downbeats script works though.
digaldeman is offline   Reply With Quote
Old 08-27-2015, 02:08 AM   #4
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,603
Default

You have to type "nth(x)" where x is what notes you want to select
Sexan is online now   Reply With Quote
Old 08-27-2015, 05:12 AM   #5
SmajjL
Human being with feelings
 
Join Date: Nov 2013
Posts: 2,779
Default

Lovely stuff! beeing added & requested lately around here. *hihi*
__________________
_Ohh.))::_Kubuntu_::((.Xoxo_my precious

Last edited by SmajjL; 08-27-2015 at 11:44 AM. Reason: Must had something to do with the Swedish number :D
SmajjL is offline   Reply With Quote
Old 08-27-2015, 07:51 AM   #6
digaldeman
Human being with feelings
 
digaldeman's Avatar
 
Join Date: Mar 2007
Location: In Da Club
Posts: 297
Default

Thanks Lazarus, this is a very useful script! Now I can select every other note and adjust its length, velocity, etc.
digaldeman is offline   Reply With Quote
Old 08-27-2015, 08:00 AM   #7
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Here's a "MIDI note selector with GUI (EEL)"
http://forum.cockos.com/showpost.php?p=1325733

This is quite old script - feel free to modify
spk77 is offline   Reply With Quote
Old 08-27-2015, 10:50 AM   #8
SmajjL
Human being with feelings
 
Join Date: Nov 2013
Posts: 2,779
Default

Ohh-ahh-'oley, thanks spk77.

Edit correction: halleluljah! thank you!
.. and I can even make use of the pitch feature, like changing the pattern of some particular VST thanks!
__________________
_Ohh.))::_Kubuntu_::((.Xoxo_my precious

Last edited by SmajjL; 08-27-2015 at 11:45 AM. Reason: and, corrected a brain fart :)
SmajjL is offline   Reply With Quote
Old 08-27-2015, 08:08 PM   #9
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,618
Default

Quote:
Originally Posted by spk77 View Post
Here's a "MIDI note selector with GUI (EEL)"
http://forum.cockos.com/showpost.php?p=1325733

This is quite old script - feel free to modify
might you [being the master of scripts that your are ] have a modified version of this that doesn't look for the pitch, ...just selects every [whatever number] note ...every other, or every third or whatever?
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva
hopi is offline   Reply With Quote
Old 09-05-2015, 02:29 AM   #10
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Dear hopi, would you like to share your modified script ?
vanhaze is offline   Reply With Quote
Old 09-05-2015, 02:31 AM   #11
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Quote:
Originally Posted by spk77 View Post
Here's a "MIDI note selector with GUI (EEL)"
http://forum.cockos.com/showpost.php?p=1325733

This is quite old script - feel free to modify
Insane script, many thx !
My only wish for it would be that note pitches are shown in note names and not numbers ...
vanhaze is offline   Reply With Quote
Old 09-05-2015, 03:40 AM   #12
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by vanhaze View Post
Insane script, many thx !
My only wish for it would be that note pitches are shown in note names and not numbers ...
Now it shows note names (C, C#, D etc.) and note numbers:



(Don't know how difficult it would be to make it also show "customized note names")

Download:
https://stash.reaper.fm/25039/MIDI%20note%20selector.eel
spk77 is offline   Reply With Quote
Old 09-07-2015, 05:25 AM   #13
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

OMG: Insane !! Thank you bigtime spk77 !

Ok, so now just "playing" with this amazing tool and i love it so much !

But ..is it possible to keep the Midi Note Selector Window always on top of the Midi Editor ?
And pass through any key commands to the Midi Editor when it has focus ?

Cause here is an example of my workflow:

In Midi editor i open Midi Note selector.
I select some notes with it.
Now i want to delete these notes with key command, but key command doesn't work with Midi Note Selector in focus.
So i have to click on Midi Editor to give it focus so key command works again, but then, Midi Note Selector window vanishes behind Midi Editor.

Hope there is some solution for this !

Last edited by vanhaze; 09-07-2015 at 05:40 AM.
vanhaze is offline   Reply With Quote
Old 09-07-2015, 07:50 AM   #14
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by vanhaze View Post
But ..is it possible to keep the Midi Note Selector Window always on top of the Midi Editor ?
I have requested a 'always in front' pin for scripting windows in the 5pre thread (as I have the same problem with disappearing scripting windows), but no luck yet.

But you can dock scripting windows (rightclick title bar), maybe this helps.
nofish is offline   Reply With Quote
Old 09-07-2015, 12:22 PM   #15
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Aha, thx for that tip !

And thx for the request to Devs .. !
vanhaze is offline   Reply With Quote
Old 11-06-2015, 04:53 PM   #16
Kite
Human being with feelings
 
Join Date: Apr 2010
Location: Portland OR
Posts: 217
Default

spk77: great script!

I made some improvements:
added range options (current pitch, current selection, all notes)
added "click here to select now" when range is current selection
added help hints when hovering
increased initial window size, changed A# to A#/Bb, etc.
not just ctrl-click but also right-click resets now

It's tricky when the range is the current selection, because you can only reduce the selection, never increase it. It needs to not happen instantly, so I added a "click here to select now" option. You can do cool things like unselect every 4th selected note, then unselect every 3rd selected note, ending up with the 1st and 2nd of every 4 notes of the original selection.

Code:
// MIDI note selector by spk77 (original "note selection logic" by Veto and gofer :))
//  9-Mar-2014 (spk77)
//    - added "pitch filter"
//    - added "unselect mode"
//    - no time selection -> range == item start to item end, thanks gofer
//  5-Sep-2015
//    - Now it shows note number and note name
//
//  6-Nov-2015 extensive revisions by Kite 
//    added range options (current pitch, current selection, all notes)
//    added help menu, added "click here to select now"
//    increased initial window size, changed A# to A#/Bb, etc.
//    not just ctrl-click but also right-click resets now
// 


note_name = 1;
note_name[0]="C";
note_name[1]="C#/Db";
note_name[2]="D";
note_name[3]="D#/Eb";
note_name[4]="E";
note_name[5]="F";
note_name[6]="F#/Gb";
note_name[7]="G";
note_name[8]="G#/Ab";
note_name[9]="A";
note_name[10]="A#/Bb";
note_name[11]="B";

function highlight_on_mouse_hover()
(
  gfx_r += 0.1;
  gfx_g += 0.1;
  gfx_b += 0.1;
);

function highlight_on_mouse_click()
(
  gfx_r += 0.2;
  gfx_g += 0.2;
  gfx_b += 0.2;
);

function draw_string_mode(x, y, r, g, b, a) local (w, h)
( 
  gfx_r = r;
  gfx_g = g;
  gfx_b = b;
  gfx_a = a;
  
  // is mouse on string?
  mouse_x >= x && mouse_x <= gfx_w && mouse_y >= y && mouse_y <= y + gfx_texth ? (
    highlight_on_mouse_hover();
    mouse_cap == 1 && lmb_down == 0 ? (
      highlight_on_mouse_click();
      mode == "select" ? mode = "unselect" : mode = "select";
      range != "selection" ? need_update = 1;
    );
  );
  gfx_printf("Mode: ");
  gfx_printf("%s", mode);
);

 function draw_string_step(x, y, r, g, b, a) local (w, h)
( 
  gfx_r = r;
  gfx_g = g;
  gfx_b = b;
  gfx_a = a;

  mouse_x >= x && mouse_x <= gfx_w && mouse_y >= y && mouse_y <= y + gfx_texth ? (
    highlight_on_mouse_hover();
    mouse_wheel != 0 ? (
      highlight_on_mouse_click();
      step += (mouse_wheel / abs(mouse_wheel));
      step < 1 ? step = 1
      : range != "selection" ? need_update = 1;
      offset > step - 1 ? offset = step - 1;
      mouse_wheel = 0;
    );
    mouse_cap == 5 || mouse_cap == 2 ? (
      step = 1; offset = 0;
    );
  );
  mode == "select" ? gfx_printf("Select every ") : gfx_printf("Unselect every ");
  step > 1 ? gfx_printf("%d", step);
  step == 2 ? gfx_printf("nd ") : step == 3 ? gfx_printf("rd ") : step > 3 ? gfx_printf("th ");
  gfx_printf("note");
);

function draw_string_offset(x, y, r, g, b, a) local (w, h)
( 
  gfx_r = r;
  gfx_g = g;
  gfx_b = b;
  gfx_a = a;

  mouse_x >= x && mouse_x <= gfx_w && mouse_y >= y && mouse_y <= y + gfx_texth ? (
    highlight_on_mouse_hover();
    mouse_wheel != 0 ? (
      highlight_on_mouse_click();
      offset += (mouse_wheel / abs(mouse_wheel));
      offset < 0 ? offset = 0
      : offset > step - 1 ? offset = step - 1
      : range != "selection" ? need_update = 1;
      mouse_wheel = 0;
    );
    mouse_cap == 5 || mouse_cap == 2 ? 
      offset = 0;
  );
  gfx_printf("Offset: ");
  gfx_printf("%d", offset);
);

function draw_string_range(x, y, r, g, b, a) local (w, h)
( 
  gfx_r = r;
  gfx_g = g;
  gfx_b = b;
  gfx_a = a;

  mouse_x >= x && mouse_x <= gfx_w && mouse_y >= y && mouse_y <= y + gfx_texth ? (
    highlight_on_mouse_hover();
    mouse_cap == 1 && lmb_down == 0 ? (
      highlight_on_mouse_click();
      range == "pitch" ? range = "all" : range = "pitch";
      need_update = 1;
    );
    mouse_cap == 2 && rmb_down == 0 ? (
      highlight_on_mouse_click();
      range == "selection" ? range = "all" : range = "selection";
      range != "selection" ? need_update = 1;
    );
  );
  gfx_printf("Range: ");
  range != "all" ? gfx_printf("current ");
  gfx_printf("%s", range);
  range == "all" ? gfx_printf(" notes");
  range == "selection" ? gfx_printf(",");
);

function draw_string_pitch(x, y, r, g, b, a) local (w, h)
( 
  gfx_r = r;
  gfx_g = g;
  gfx_b = b;
  gfx_a = a;
  
  mouse_x >= x && mouse_x <= gfx_w && mouse_y >= y && mouse_y <= y + gfx_texth ? (
    highlight_on_mouse_hover();
    mouse_wheel != 0 ? (
      highlight_on_mouse_click();
      mouse_wheel / abs(mouse_wheel) < 0 ? (
        sel_pitch > 0 ? (
          MIDIEditor_OnCommand(MIDIEditor_GetActive(), 40050);
        );
      ) : sel_pitch < 127 ? (
        MIDIEditor_OnCommand(MIDIEditor_GetActive(), 40049);
      );
      sel_pitch = MIDIEditor_GetSetting_int (MIDIEditor_GetActive(), "active_note_row");
      range != "selection" ? need_update = 1;
      
      mouse_wheel = 0;
    );
  );
  gfx_printf("Pitch: ");
  gfx_printf("%d", sel_pitch);
  gfx_printf(" ");
  gfx_printf(note_name[sel_pitch % 12]);
);

function draw_string_go_now (x, y, r, g, b, a) local (w, h)
( 
  gfx_r = r;
  gfx_g = g;
  gfx_b = b;
  gfx_a = a;
  
  mouse_x >= x && mouse_x <= gfx_w && mouse_y >= y && mouse_y <= y + gfx_texth ? (
    highlight_on_mouse_hover();
    mouse_cap == 1 && lmb_down == 0 ? (
      highlight_on_mouse_click();
      need_update = 1;
    );
  );
  gfx_printf (" click here to ");
  gfx_printf ("%s", mode);
  gfx_printf (" now");
);

function select_notes()
(
  index = 0;
  k = -offset;
  loop(note_count,
    MIDI_GetNote(take, index, isSelected, isMuted, startPpqPos, endPpqPos, channel, note_pitch, velocity) ? (
      good = range == "pitch" && note_pitch == sel_pitch;
      good |= (range == "selection" && isSelected == 1) || range == "all";
      good &= endPpqPos > time_sel_start && startPpqPos < time_sel_end;
      k % step == 0 && good ? (
        mode == "select" ? (
          MIDI_SetNote(take, index, 1, isMuted, startPpqPos, endPpqPos, channel, note_pitch, velocity);
        ) : mode == "unselect" ? (
          MIDI_SetNote(take, index, 0, isMuted, startPpqPos, endPpqPos, channel, note_pitch, velocity);
        );
      ) : mode == "select" ? (
          MIDI_SetNote(take, index, 0, isMuted, startPpqPos, endPpqPos, channel, note_pitch, velocity);
      ) : mode == "unselect" && good ? (
          MIDI_SetNote(take, index, 1, isMuted, startPpqPos, endPpqPos, channel, note_pitch, velocity);
      ) : (
          MIDI_SetNote(take, index, 0, isMuted, startPpqPos, endPpqPos, channel, note_pitch, velocity);
      );
      good ? k += 1;
    );
    index += 1;
  );
);

function run()
(
  gfx_x = 20; gfx_y = 15;
  draw_string_mode(gfx_x, gfx_y, 0.5, 0.8, 0.5, 1);

  gfx_x = 20;
  gfx_y += 2 * gfx_texth;
  draw_string_step(gfx_x, gfx_y, 0.5, 0.8, 0.5, 1);

  gfx_x = 20;
  gfx_y += 2 * gfx_texth;
  draw_string_offset(gfx_x, gfx_y, 0.5, 0.8, 0.5, 1);

  gfx_x = 20;
  gfx_y += 2 * gfx_texth;
  draw_string_range(gfx_x, gfx_y, 0.5, 0.8, 0.5, 1);

  gfx_x = 20;
  gfx_y += 2 * gfx_texth;
  range == "selection" ? (
    gfx_y -= gfx_texth;
    draw_string_go_now (gfx_x, gfx_y, 0.5, 0.8, 0.5, 1);
    gfx_y += gfx_texth;
  ) : range == "pitch" ? draw_string_pitch(gfx_x, gfx_y, 0.5, 0.8, 0.5, 1);

  mouse_x >= 20 && mouse_x <= gfx_w && mouse_y >= 15 && mouse_y <= gfx_h ? (
    gfx_x = 20;
    gfx_y += 2 * gfx_texth;
    gfx_r = gfx_g = gfx_b = 0.6;
    h = ((mouse_y - 15) / gfx_texth) | 0;		// h = mouse height in menu-rows
    h == 0 ? gfx_printf ("click to change");
    h == 2 || h == 4 || (h == 8 && range == "pitch") ? gfx_printf ("drag up or down to change");
    h == 6 ? gfx_printf ("click or right-click to change");
    h == 7 && range == "selection" ? (gfx_printf ("click to "); gfx_printf("%s", mode));
    gfx_x = 20;
    gfx_y += gfx_texth;
    h == 2 || h == 4 ? gfx_printf ("right-click or ctrl-click to reset");
    h == 8 && range == "pitch" ? gfx_printf ("click on piano roll to reset");
  );

  GetSet_LoopTimeRange(0, 0, time_sel_start, time_sel_end, 0);
  (take = MIDIEditor_GetTake(MIDIEditor_GetActive())) ? (
    sel_pitch = MIDIEditor_GetSetting_int(MIDIEditor_GetActive(), "active_note_row");
    time_sel_start = MIDI_GetPPQPosFromProjTime(take, time_sel_start);
    time_sel_end = MIDI_GetPPQPosFromProjTime(take, time_sel_end);
    
    // no time selection -> range == item start to item end, thanks gofer :)
    time_sel_start == time_sel_end ? ( 
      item = GetMediaItemTake_Item(take);
      item_start = GetMediaItemInfo_Value(item, "D_POSITION");
      item_end = item_start + GetMediaItemInfo_Value(item, "D_LENGTH");
      time_sel_start = MIDI_GetPPQPosFromProjTime(take, item_start);
      time_sel_end = MIDI_GetPPQPosFromProjTime(take, item_end);
    );
    
    MIDI_CountEvts(take, note_count, cc_count, sysEx_count);

    (mouse_x >= 0 && mouse_x <= gfx_w && mouse_y >= 0 && mouse_y <= gfx_h) && need_update == 1 ? (
      select_notes();
    );
  );
  need_update = 0;
  mouse_cap == 1 ? lmb_down = 1 : lmb_down = 0;		// lmb_down = is left mouse button down,
  mouse_cap == 2 ? rmb_down = 1 : rmb_down = 0;		// i.e. is the initiol click finished?
  
  gfx_update();
  gfx_getchar() >= 0 ? defer("run();");
);

gfx_init("MIDI note selector", 265, 265);
gfx_setfont(1, "Verdana", 16);

mode = "select";
step = 2;
offset = 0;
range = "pitch";
sel_pitch = 0;

need_update = 0;
lmb_down = rmb_down = 0;

run();
__________________
alt-tuner: a microtonal midi plug-in: www.TallKite.com/alt-tuner.html
The Kite Guitar, a playable 41-ET guitar: www.KiteGuitar.com
Kite is offline   Reply With Quote
Old 11-06-2015, 04:54 PM   #17
Kite
Human being with feelings
 
Join Date: Apr 2010
Location: Portland OR
Posts: 217
Default

Another example: you want a loud/soft pattern on the hi-hat of LssLssLs:

select every note by pitch to get all the hi-hat notes
set range to current selection, then set mode to unselect
set to every 8th note, offset by 1, and click here to unselect now
set to every 7th note, offset by 1, and click here to unselect now
set to every 6th note, offset by 2, and click here to unselect now
set to every 5th note, offset by 2, and click here to unselect now
set to every 4th note, offset by 3, and click here to unselect now
then just increase the velocity of the selected notes.
__________________
alt-tuner: a microtonal midi plug-in: www.TallKite.com/alt-tuner.html
The Kite Guitar, a playable 41-ET guitar: www.KiteGuitar.com
Kite is offline   Reply With Quote
Old 12-08-2017, 12:55 PM   #18
DynamicK
Human being with feelings
 
Join Date: Nov 2017
Location: Gloucestershire, UK
Posts: 223
Default

Thanks guys...I was just about to ask on the forum for this function in a script. VERY USEFUL.
DynamicK is offline   Reply With Quote
Old 12-08-2017, 01:11 PM   #19
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by DynamicK View Post
Thanks guys...I was just about to ask on the forum for this function in a script. VERY USEFUL.
You can also try these:

Select and deselect MIDI notes by step pattern:



An alternative way to apply loud/soft patterns on the hi-hat:

LFO Tool for MIDI editor:
juliansader is offline   Reply With Quote
Old 12-09-2017, 12:58 PM   #20
DynamicK
Human being with feelings
 
Join Date: Nov 2017
Location: Gloucestershire, UK
Posts: 223
Default

Quote:
Originally Posted by juliansader View Post
You can also try these:
Select and deselect MIDI notes by step pattern:
An alternative way to apply loud/soft patterns on the hi-hat:
LFO Tool for MIDI editor:
Julian , I did try the first one which fits my requirements perfectly. When I humanize, I usually leave some of my notes smack on the beat. Your script allows me to do that. Thanks
DynamicK is offline   Reply With Quote
Old 12-10-2017, 08:56 AM   #21
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,618
Default

Quote:
Originally Posted by spk77 View Post
Here's a "MIDI note selector with GUI (EEL)"
http://forum.cockos.com/showpost.php?p=1325733

This is quite old script - feel free to modify
has anyone done something like this script in a lua version?
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva
hopi is offline   Reply With Quote
Old 04-18-2018, 12:30 PM   #22
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by hopi View Post
has anyone done something like this script in a lua version?
Thread necro, but yes. I actually wrote a clone of spk77's script ages ago because it was running slow for me, but apparently I never uploaded it. "Lokasenna_MIDI Note Selector" should be on ReaPack shortly.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-01-2021, 08:33 AM   #23
obet1289
Human being with feelings
 
obet1289's Avatar
 
Join Date: Nov 2020
Posts: 35
Default

Quote:
Originally Posted by Lokasenna View Post
Thread necro, but yes. I actually wrote a clone of spk77's script ages ago because it was running slow for me, but apparently I never uploaded it. "Lokasenna_MIDI Note Selector" should be on ReaPack shortly.
For any further google search from other people, Lokassena's version is the most stable one. Original spk77 script is also very slow in my system. And you can't basically do this action with the grid/beat based scripts. I'm attaching the screenshots from a drum roll for example. Thank you Lokasenna

Don't forget to select/highlight the individual rows on the left column by right click.

Or selecting multiple notes by marquue select.
Attached Images
File Type: png Screen Shot 2021-10-01 at 18.23.54.png (44.3 KB, 85 views)
File Type: png Screen Shot 2021-10-01 at 18.23.04.png (46.7 KB, 85 views)
obet1289 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 06:40 AM.


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