Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 04-13-2015, 12:44 AM   #41
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

@FnA
Oh man, I forget to test it with triplet and dotted grid !
Will see what I can do for it. A bit of maths will be required :P
X-Raym is offline   Reply With Quote
Old 04-13-2015, 05:00 AM   #42
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

Just noticed that in vertical version of the script, they may be "errors" in rounding values. consequence is that if a note ends on the column you are, it can be select-unselect by the script.
I try to convert to ppq (and not work with seconds) but no chance on that so far.
X-Raym is offline   Reply With Quote
Old 04-13-2015, 07:15 AM   #43
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Say you have 120 4/4 at start. Put 88 3/8 at measure 4. Causes similar but more pronounced problems in the vertical script. I mean shortening the note won't stop it.

I did most of my more complicated note scripts with FNG python functions. Maybe they work a little different. I think I usually got the time to QN at the start of the item and started tick count there. Playrate and start offset might affect it. I used the sws configvar function to get "miditicksperbeat" (960 for me).

Can be frustrating to try to cover all bases.
FnA is offline   Reply With Quote
Old 04-13-2015, 07:24 AM   #44
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

@FnA
Hmmm these scripts ar becoming way harder than expected. I may not have the required knowledge to push it further... What is QN and tick exactly ? I have a rough idea but I'm.sure I miss some critical details. Are they item or project depndant ?
X-Raym is offline   Reply With Quote
Old 04-13-2015, 07:44 AM   #45
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

There is a complication right there. You find, say, 960 QN in the item chunk, but there is a preference setting to make them like that. I guess personally 960 or the configvar function to get it has always worked out for me.

I put this py script in the stash. I quit doing that now, because some guy will come along and tell you about issues. :P

https://stash.reaper.fm/v/19347/MIDI%...ip%20select.py

If it's broke, too bad!

Edit- I guess your script performs action very similar to select all notes in time selection. Maybe something (easier to write) to consider.
Move edit cursor L/R by grid is a lie! Moves to grid first. But I have had bad luck with the cursor in the MIDI editor before. Like it would not move twice in a macro that was doing other things.

Select all notes in time selection works on other editable items too.

But your script has unselect function.

And...

Last edited by FnA; 04-13-2015 at 01:28 PM.
FnA is offline   Reply With Quote
Old 04-13-2015, 08:34 PM   #46
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Hey! You wrote my name in there. I had to do something. No, I think it's a nice idea you have. Maybe even some variations some day?

Well, this is kind of rough. But it does seem to take care of the triplet and time sig problem somewhat. Maybe it helps? The MIDI grid kind of sucks. It behaves different than arrange. There's always a line at the start of a measure. The visual grid, which mouse clicks will snap to, is not always what "move cursor by grid" goes to when say a dotted grid gets cut off by the measure line or a quarter note goes across a 3/8 measure or what have you. Not sure what to do there...

I made it in official release, so no BR stuff. Just uses the active row line.

Code:
// EEL-select/unselect notes in grid space under mouse at or below (see note1) active row
// note1 change > to < for opposite effect in two lines - Row >= pitch ? (

function AS()
(
  j = 0;
  x = Note_Ct;
  while(x)(
    MIDI_GetNote(Take, j, sel, muted, start, end, chan, pitch, vel);
    Row >= pitch ? (
      start < Grid_B ? (
        end > Grid_A  ? (
          sel == 0 ? (
            all_selected = 0;
          );
        );
      ):(
        x = 1;
      );
    );
    j += 1;
    x -= 1;
  );
);

function select()
(
  k = 0;
  y = Note_Ct;
  while(y)(
    MIDI_GetNote(Take, k, sel2, muted2, start2, end2, chan2, pitch2, vel2);
    Row >= pitch2 ? (
      start2 < Grid_B ? (
        end2 > Grid_A  ? (
          all_selected == 0 ? (
            MIDI_SetNote(Take, k, 1, muted2, start2, end2, chan2, pitch2, vel2);
          ):(
            MIDI_SetNote(Take, k, 0, muted2, start2, end2, chan2, pitch2, vel2);
          );
        );
      ):(
        y = 1;
      );
    );
    k += 1;
    y -= 1;
  );
);

PreventUIRefresh(1);

ME = MIDIEditor_GetActive();
Take = MIDIEditor_GetTake(ME);
MIDI_CountEvts(Take, Note_Ct, evts, sysexs);
Row = MIDIEditor_GetSetting_int(ME, "active_note_row");

CurPos_1 = GetCursorPosition();
MIDIEditor_LastFocused_OnCommand(40443, 0);// EC to MC
MIDIEditor_LastFocused_OnCommand(40047, 0);// EC left to grid
Grid_A = MIDI_GetPPQPosFromProjTime(Take, GetCursorPosition());
MIDIEditor_LastFocused_OnCommand(40048, 0);// EC right to grid
Grid_B = MIDI_GetPPQPosFromProjTime(Take, GetCursorPosition());
SetEditCurPos(CurPos_1, 0, 0);

all_selected = 1;
AS();
select();

PreventUIRefresh(-1);
Undo_OnStateChange("Select-Unselect all MIDI notes under mouse based on grid");

Last edited by FnA; 04-14-2015 at 12:08 PM. Reason: right left backwards in comments lol
FnA is offline   Reply With Quote
Old 04-14-2015, 01:33 AM   #47
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

@FnA
Hi !

I made some quick tests and it seems to works pretty fine so far with not selection !

Interesting code, I have no idea we could do it without BR_mouse functions ! I'm beginner in MIDI related scripts.
And make it work with the edit cursor rather than pure calc seems to work well.

So, it is nice that you made it work.
Do you think it is possible to make the edit cursor less jumpy ?
I saw you tried PreventUIRefresh, but it doesn't seems to do the trick in Midi Editor.
I can clearly saw it go forth and back in time, it can be really disturbing after an intensive usage of it =/

Thanks again for your work on it !
X-Raym is offline   Reply With Quote
Old 04-14-2015, 01:44 AM   #48
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 4,772
Default

Hi, fantastic job !!

Your script works for me ; i am on Reaper 500pre24 - 64bit mac version.
OSX 10.10.3

I binded your script to a Mouse modifier (in the Note section) : CTRL key plus double click on a Note.
When i do CTRL-double click a note in Midi Editor, it selects that note and all notes
that are lying vertically under the double clicked Note.

Great for selecting whole Chords the fast way :0)
vanhaze is offline   Reply With Quote
Old 04-14-2015, 01:54 AM   #49
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

@FnA
Oh, I just saw that not using BR_cursor has a downside.

The row as actually to be clicked. (this may not be a problem in vanhaze exemple, but that something I wanted to avoid).

I made a video for you to see that, and to see the jumpy cursor problem.
See at the beginning how notes are not selected under the mouse cursor.
Jumpy edit cursor is more in the second half of the video.
X-Raym is offline   Reply With Quote
Old 04-14-2015, 04:59 AM   #50
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

It's not meant to be the finished product. It's your concept. The above/below mouse cursor part is your baby. I just don't see a means in v4.

Yes I think PreventUIRefresh doesn't work in MIDI editor. The way to go is probably math based on item start (and BR mouse positions and MIDIGetGrid). Edit cursor part was just quick and easy way to get the time. It could have been time selection etc. Don't know how one could get mouse cursor position in v4 Eel. Do you know how to interpret the native config_var function results? I don't. That's where MIDIgetgrid will help.

It will probably be difficult or worse to solve the visible grid problem I mentioned before.
FnA is offline   Reply With Quote
Old 04-14-2015, 05:37 AM   #51
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

@FnA
Oh yeah ok , I thought you will want to continue work on this, so I was just making bug reports. It is sad that PreventUIRefresh doesn't work in midi editor, it was pretty nice !

And yeah, no way to have mouse cursor in v4, that's why I use v5.

I don't know anything about config_var.

So well, I guess I have to continue the math on "my baby" ! :P thanks for the ideas I will think about it.
X-Raym is offline   Reply With Quote
Old 04-14-2015, 05:54 AM   #52
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Then there is Source vs Project timebase...

A monster.

Maybe there is a better way.

Last edited by FnA; 04-14-2015 at 06:00 AM.
FnA is offline   Reply With Quote
Old 04-14-2015, 05:57 AM   #53
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

Warg !

Abort ! Abort !
X-Raym is offline   Reply With Quote
Old 04-14-2015, 06:13 AM   #54
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Sometimes you just have to.

Bouncy cursor then?

Certainly, the above/below part could be changed to your original way.

@vanhaze: If you want the opposite for v4-
Copy the script, rename it, and change the > in the two lines-
Row >= pitch ? (
to
Row <= pitch ? (

You can change the part after // in-
//select/unselect notes in grid space under mouse at or below active row
It's just a comment.

Last edited by FnA; 04-14-2015 at 06:35 AM.
FnA is offline   Reply With Quote
Old 04-14-2015, 06:29 AM   #55
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,057
Default

Quote:
Originally Posted by X-Raym View Post
Warg !

Abort ! Abort !
Haha

More seriously, thanks X-Raym and FnA.

Useful stuff.

edit:
Sorry to be dumb, what language is the script in post #46 ?
I'd like to try it. Python, EEL, Lua ?

Last edited by nofish; 04-14-2015 at 06:35 AM.
nofish is offline   Reply With Quote
Old 04-14-2015, 11:59 AM   #56
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 4,772
Default

Works for me when i use the extension .eel.
So i assume it is an .eel script :0)
vanhaze is offline   Reply With Quote
Old 04-14-2015, 12:10 PM   #57
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Woopsy. Yes, EEL. Edited the comment at top, also with instructions to change direction.

I'll see if I can get X-Rayms mouse cursor device going in it shortly. It will require v5 Pre. If I can do it.

The script itself is based on his concept. Just realized it a little different.

Last edited by FnA; 04-14-2015 at 12:21 PM.
FnA is offline   Reply With Quote
Old 04-14-2015, 01:11 PM   #58
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

OK, tested in REAPER v5.0pre22 with SWS 2.6.3 build #0.

Code:
// EEL-select/unselect notes in grid space under mouse at or below (see note1) mouse cursor
// note1 change > to < for opposite effect in two lines - Row >= pitch ? (

function AS()
(
  j = 0;
  x = Note_Ct;
  while(x)(
    MIDI_GetNote(Take, j, sel, muted, start, end, chan, pitch, vel);
    Row >= pitch ? (
      start < Grid_B ? (
        end > Grid_A  ? (
          sel == 0 ? (
            all_selected = 0;
          );
        );
      ):(
        x = 1;
      );
    );
    j += 1;
    x -= 1;
  );
);

function select()
(
  k = 0;
  y = Note_Ct;
  while(y)(
    MIDI_GetNote(Take, k, sel2, muted2, start2, end2, chan2, pitch2, vel2);
    Row >= pitch2 ? (
      start2 < Grid_B ? (
        end2 > Grid_A  ? (
          all_selected == 0 ? (
            MIDI_SetNote(Take, k, 1, muted2, start2, end2, chan2, pitch2, vel2);
          ):(
            MIDI_SetNote(Take, k, 0, muted2, start2, end2, chan2, pitch2, vel2);
          );
        );
      ):(
        y = 1;
      );
    );
    k += 1;
    y -= 1;
  );
);

PreventUIRefresh(1);

ME = MIDIEditor_GetActive();
Take = MIDIEditor_GetTake(ME);
MIDI_CountEvts(Take, Note_Ct, evts, sysexs);
extension_api("BR_GetMouseCursorContext", #window, #segment, #details, char_sz);
extension_api("BR_GetMouseCursorContext_MIDI", inlineEditor, Row, ccLane, ccLaneVal, ccLaneId);

CurPos_1 = GetCursorPosition();
MIDIEditor_LastFocused_OnCommand(40443, 0);// EC to MC
MIDIEditor_LastFocused_OnCommand(40047, 0);// EC left to grid
Grid_A = MIDI_GetPPQPosFromProjTime(Take, GetCursorPosition());
MIDIEditor_LastFocused_OnCommand(40048, 0);// EC right to grid
Grid_B = MIDI_GetPPQPosFromProjTime(Take, GetCursorPosition());
SetEditCurPos(CurPos_1, 0, 0);

all_selected = 1;
AS();
select();

PreventUIRefresh(-1);
Undo_OnStateChange("Select-Unselect all MIDI notes under mouse based on grid");
FnA is offline   Reply With Quote
Old 04-14-2015, 01:11 PM   #59
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

@vanhaze, @nofish
For thanks for your support As you can see, we try all we can do to make this things really works, in every circumstances :P

@FnA
Waiting for your news :P
X-Raym is offline   Reply With Quote
Old 04-14-2015, 01:14 PM   #60
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

You click too slow :P
FnA is offline   Reply With Quote
Old 04-14-2015, 01:14 PM   #61
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

@FnA
Tested and... working ? ^^

EDIT:
Confiurmed it work on mouse (not active row).

Just this jumpy cursor. AH ! I will ask for a MIDI editor PreventUIRefresh in pre-releases forum.

Last edited by X-Raym; 04-14-2015 at 01:22 PM.
X-Raym is offline   Reply With Quote
Old 04-14-2015, 01:25 PM   #62
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Yes I don't like it either. I just see an Abyss opening if I try to go some other way.
FnA is offline   Reply With Quote
Old 04-14-2015, 02:24 PM   #63
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

@FnA
An abyss ? Do not look down. Don't.

Anyway, if it usable, we can still release a version of the script.
Do you take care of the baby or is it my turn ? :P
X-Raym is offline   Reply With Quote
Old 04-14-2015, 03:17 PM   #64
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Quote:
Originally Posted by X-Raym View Post
@FnA
An abyss ? Do not look down. Don't.

Anyway, if it usable, we can still release a version of the script.
Do you take care of the baby or is it my turn ? :P
It's all for you....

Shall I delete these ones?
FnA is offline   Reply With Quote
Old 04-15-2015, 04:58 AM   #65
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

@FnA
(that was surprising :P)
No need to delete anything.

I released the scripts on my GitHub repo.
  • FnA_Select-Unselect notes in grid over mouse.eel
  • FnA_Select-Unselect notes in grid under mouse.eel

You can download it as all my other scripts, with my signature.
X-Raym is offline   Reply With Quote
Old 04-15-2015, 05:49 AM   #66
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Yes! Exactly like that.

I read your comics. Funny. A lot of things to identify with there.
#007 :|
FnA is offline   Reply With Quote
Old 04-15-2015, 06:45 AM   #67
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

@FnA
Quote:
I read your comics. Funny.
Thanks :P Be sure that it will be other scripters related comics :P
X-Raym is offline   Reply With Quote
Old 04-17-2015, 06:34 AM   #68
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,057
Default

X-Raym,

I just checked out your script package about the scripts in this thread.

There's

- FnA-Select-Unselect notes in grid over (under) mouse

and

- X-Raym-Select-Unselect all MIDI notes over (under) mouse based on grid

and also:

- X-Raym-Select unselect all MIDI notes under mouse2

Are these the same or could you tell what the difference between these is ?
Thanks.
nofish is offline   Reply With Quote
Old 04-17-2015, 06:44 AM   #69
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

FnA works with complex grids but have jumpy cursor, v1 works only with straight grif, and v2 wasnt suppose to be here ^^
X-Raym is offline   Reply With Quote
Old 04-17-2015, 07:39 AM   #70
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,057
Default

Got it, thanks.
nofish is offline   Reply With Quote
Old 04-17-2015, 08:02 AM   #71
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

I think "FnA" could maybe be improved, but I'd rather put my time into...other things

Last edited by FnA; 04-19-2015 at 06:46 PM.
FnA is offline   Reply With Quote
Old 05-02-2015, 03:49 AM   #72
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default Lowest and Highest

Two new scripts requested by Vanhaze:
  • X-Raym_Select-Unselect highest MIDI notes in active take.eel
  • X-Raym_Select-Unselect lowest MIDI notes in active take.eel
Demo in first post !
X-Raym is offline   Reply With Quote
Old 06-04-2015, 04:01 AM   #73
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

HI !

I made a script to select in row, and so we, with FnA tried to have one that select in column.
The fact is that it was a bit complicated, a required some "tricks" to be able to work, and still, there was some expected behavior (jumpy cursor in FnA version, only worked with straight grid for mine).

I just a made a simple version of this vertical selection script, which select/unselect without grid : just note that start and end after the note position (under or over mouse, depending on the version). No grid involves !
ANd it is already quite useful to select chords !

EDIT 2015-06-04
Two new scripts :
  • X-Raym_Select-Unselect all MIDI notes over mouse.eel
  • X-Raym_Select-Unselect all MIDI notes under mouse.eel




What do you think of that ?
X-Raym is offline   Reply With Quote
Old 05-09-2016, 09:25 AM   #74
o_e
Human being with feelings
 
Join Date: May 2016
Posts: 361
Default select all notes right from selection

Hi, I'am new to REAPER and try to set things up like I'am used to.
One thing I could'nt find is to select all notes right from my selection to move parts out of the way (in the MIDI-Editor).
I did a little research and stumbled upon your great scripts.
It must be easy to modify one of your scripts. I'am willing to donate a little bounty if you have a paypal account or something similar.

greets

o_e
o_e is offline   Reply With Quote
Old 05-09-2016, 09:39 AM   #75
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

@o_e
Hi o_e !
Can you show me before/after screenshot comparison of what you need ?

It will help me understand your needs. :P
X-Raym is offline   Reply With Quote
Old 05-09-2016, 10:22 AM   #76
o_e
Human being with feelings
 
Join Date: May 2016
Posts: 361
Default

Hi, thanks for the very quick response!

I'll attach to screeshots, one with 'normal' behaviour and one with the behaviour that I'am looking for. Its pretty simple what I want.
Please tell me if it's (still) not sufficient to get the idea.

thanks!

o_e
Attached Images
File Type: jpg normal_behaviour.jpg (51.5 KB, 64 views)
File Type: jpg wanted_behaviour.jpg (39.7 KB, 71 views)
o_e is offline   Reply With Quote
Old 05-09-2016, 10:56 AM   #77
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

Scripts are useful for making things that can't be done with a macro.
In yourcase, you can consider this :



It included one spk77 script.

No code writing needed :P

Tell me it if work for you !
X-Raym is offline   Reply With Quote
Old 05-09-2016, 11:57 AM   #78
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

There are also MIDI note left click mouse modifiers that came out recently.

X-Raym? I think I know how to make "FnA" script better now. No cursor. Did you already do it?
FnA is offline   Reply With Quote
Old 05-09-2016, 12:07 PM   #79
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

@FnA
I get pretty satisfied with the Select-Unselect all MIDI notes over mouse without grid. Don't worry too much about the grid function
X-Raym is offline   Reply With Quote
Old 05-09-2016, 12:17 PM   #80
o_e
Human being with feelings
 
Join Date: May 2016
Posts: 361
Default

Hi,

Thanks again for your efforts!

Could not find an action 'Navigate: Move edit cursor to start of selected events' to build a custom action with..
And when I tried to run the script (which I copied and pasted into text wrangler and named it ...eel than put it into the REAPER scrips folder) it throws the following error (see screenshot).

o_e
Attached Images
File Type: jpg Bildschirmfoto 2016-05-09 um 21.09.38.jpg (26.1 KB, 74 views)
o_e 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:38 AM.


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