Go Back   Cockos Incorporated Forums > REAPER Forums > JSFX and ReaScript Discussion

Reply
 
Thread Tools Display Modes
Old 12-08-2017, 04:50 PM   #41
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 4,300
Default

@FnA
There is reaper.BR_IsMidiOpenInInlineEditor( take ), but maybe using only selected items active take is enough (and a condition to check if it is MIDI editor or Main view if possible - I don't remember it it is possible).

Having a single scripts in multiple domain (Main, Midi Editor etc) is a bit more complex for reapack too, you will have to ask cfillion for the details.
X-Raym is offline   Reply With Quote
Old 12-08-2017, 05:03 PM   #42
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,754
Default

He told me how already, unless it has changed recently? Well, I don't know if I want to make it possible for anything but the focused item to get it's notes joined. Could result in accidents. So maybe just the two for big MIDI Editor...

edit. I also think it will multiply the overlapping note chaos that someone will surely run into. Especially someone unfamiliar with this thread or others which discuss the problem. Maybe I should include "correct overlapping notes" action.

Last edited by FnA; 12-08-2017 at 05:50 PM.
FnA is offline   Reply With Quote
Old 12-08-2017, 09:25 PM   #43
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,754
Default

I edited the script post that has appeared in some single post links recently. I did a few experiments and found that there is apparently no MIDI script that can be relied on to leave overlapping notes intact. I don't think most Reaper users realize this. I'm a little uncomfortable having "FnA" on a MIDI note script in a prominent place until that becomes well known knowledge. (maybe "correct overlapping notes" will stop unexpected behavior, if also included in the title) juliansader mentioned something to this effect here:
https://forum.cockos.com/showthread.php?t=159848
about post #11.

Undo can also be strange after the notes get rearranged.

Last edited by FnA; 12-08-2017 at 09:59 PM.
FnA is offline   Reply With Quote
Old 12-08-2017, 09:57 PM   #44
strachupl
Human being with feelings
 
Join Date: Jan 2013
Posts: 190
Default

Quote:
Originally Posted by FnA View Post
I edited the script post that has appeared in some single post links recently. I did a few experiments and found that there is apparently no MIDI script that can be relied on to leave overlapping notes intact. I don't think most Reaper users realize this. I'm a little uncomfortable having "FnA" on a MIDI note script in a prominent place until that becomes well known knowledge. (Sure, they are still very useful, and maybe "correct overlapping notes will stop unexpected behavior, if included in the title) juliansader mentioned something to this effect here:
https://forum.cockos.com/showthread.php?t=159848
about post #11.

Undo can also be strange after the notes get rearranged.
Thank you for your script, doing my job perfect!

strachupl is offline   Reply With Quote
Old 12-08-2017, 10:17 PM   #45
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,754
Default

Nice to hear.

I wonder if anyone might run into a situation where a rounding error or something might stop some notes from being joined. The input box script would cover that, or the max_join_space variable at the top could be changed from 0 to 1 or more. Join adjacent, and almost adjacent, notes.
FnA is offline   Reply With Quote
Old 12-08-2017, 10:35 PM   #46
strachupl
Human being with feelings
 
Join Date: Jan 2013
Posts: 190
Default

Quote:
Originally Posted by FnA View Post
Nice to hear.

I wonder if anyone might run into a situation where a rounding error or something might stop some notes from being joined. The input box script would cover that, or the max_join_space variable at the top could be changed from 0 to 1 or more. Join adjacent, and almost adjacent, notes.
almost adjacent notes works too

strachupl is offline   Reply With Quote
Old 12-08-2017, 10:56 PM   #47
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,754
Default

lol. That is the only one I use. I have Enter button on mouse so it doesn't bother me. No input+Enter = 0+Enter.

I just realized something. There is now a function to refocus MIDI editor. Using input box causes main window to get focus. I will update tomorrow.
FnA is offline   Reply With Quote
Old 12-08-2017, 11:21 PM   #48
foxAsteria
Human being with feelings
 
foxAsteria's Avatar
 
Join Date: Dec 2009
Location: Axis Mundi
Posts: 4,110
Default

Awesome that this is still getting tweaked. You scripters rock. Just please don't forget a lot of us use scripts live or with controllers so can't enter values or confirm dialogs.
__________________
TwilightMysterySchool
foxAsteria is online now   Reply With Quote
Old 12-09-2017, 07:50 AM   #49
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,754
Default

Nothing has really changed since original post. Usually a script like that can be made to just do x default values fairly easily. So not a big deal to ask for a change.

The midi refocus thing is also an action, I think. Could be macro instead maybe. Trying to think if there's some reason to leave it out.

Also, the script could probably join any selected overlapping notes with a rewrite, but I think it is not possible for the unselected ones to survive the Set part of the script as overlapping. Actually, maybe not. Get note function might not be able to see the note on/off the same way you can in the midi editor. (edit. It does not. It sees the next note off as the end.)

Last edited by FnA; 12-09-2017 at 04:58 PM.
FnA is offline   Reply With Quote
Old 12-09-2017, 11:54 AM   #50
foxAsteria
Human being with feelings
 
foxAsteria's Avatar
 
Join Date: Dec 2009
Location: Axis Mundi
Posts: 4,110
Default

Oh cool. The only improvement that I could ask for then is that it could be run from the arrange window without opening ME. That's when I try to use it the most (after editing items and wanting to rejoin them without tiny orphan notes around the item splits), but I imagine that's still not possible...
__________________
TwilightMysterySchool
foxAsteria is online now   Reply With Quote
Old 12-09-2017, 04:34 PM   #51
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 1,754
Default

Quote:
Originally Posted by FnA View Post
I did a few experiments and found that there is apparently no MIDI script that can be relied on to leave overlapping notes intact.
This is probably too vague. I mean any script that alters MIDI data in a MIDI take. Doesn't apply to a script used in the MIDI actions list that just moves the cursor, for example. Selection and muting of notes/events in a script is "altering" the data in the take, as are more obvious things like changing channel, pitch, CC value. A script that works on CCs only can cause this overlapping note on/off reordering. See *


So the scripts would still work without the editor being open. The only thing the MIDI Editor is used for in the script is to get whatever take is being edited in it. Then, operations are directed toward that take. Some other scripts may incorporate a greater amount of MIDI Editor specific info, or use actual MIDI Editor actions, like Select All Notes or something.

It could use take under mouse cursor. It could be looped over any number of takes, say the common method of using active take in all selected items. But that is definitely getting into territory where SetAllEvents would be a big performance difference. I don't know how to use that method.

My script uses selection to limit the joining to certain notes. How would it be so limited otherwise? It sounds like you would want to use it right after gluing items together. There will be no overlapping notes then, but no selected ones either. You would have to store/mark the start and end positions of the items before gluing to limit the operations to those points. Or accept joining all adjacent notes in the item. (That might not be to hard to convert the script to) then you would have to start at the first note of the take and check each note until you pass the stop/cutoff point.

So, anyway, it's probably possible to do something like that, but is quite likely too much for me, personally, to take on right now.




* Scripts that use SetAllEvents method will allow some, but not all overlapping note situations to continue as they were. It puts the note on/offs back in the right place, but they might get mixed up as to which off belongs to which on. Mostly more complex cases. For example:
aaaaa
_bbb
turns into
aaaa
_bbbb

Last edited by FnA; 12-09-2017 at 05:56 PM.
FnA 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 07:37 PM.


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