Old 12-05-2021, 03:48 AM   #1
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default Adaptive grid

Did you know that razor editing is a lot more fun with an adaptive grid?
Well, try it out! I just published a fully featured adaptive grid tool for REAPER.

In a fancy menu you can choose between 5 adaptive modes: Narrowest, Narrow, Medium, Wide, Widest. You can also set your own custom size.
Toolbar addict? Every mode has it's own action for quick access via toolbar



The MIDI editor is also supported, fingers crossed we'll get razor editing there soon as well!!



The script launches a lightweight background service that stops automatically when no longer needed. If you want REAPER to remember your adaptive grid settings after restart, check the menu option "Run service on startup".

As always, let me know if there's something going wrong, or if there's features you'd like to see

All of my scripts are available on GitHub or ReaPack:
Extensions > ReaPack > Import a repository
Code:
https://raw.githubusercontent.com/iliaspoulakis/Reaper-Tools/master/index.xml
If you like my scripts please consider sending me all your money here

Last edited by FeedTheCat; 02-22-2022 at 04:18 AM.
FeedTheCat is online now   Reply With Quote
Old 12-05-2021, 05:55 AM   #2
Vagelis
Human being with feelings
 
Vagelis's Avatar
 
Join Date: Oct 2017
Location: Larisa, Greece
Posts: 1,884
Default

Legend! frickin useful!
Vagelis is online now   Reply With Quote
Old 12-05-2021, 07:12 AM   #3
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,188
Default

Quote:
Originally Posted by FeedTheCat View Post
The MIDI editor is also supported, fingers crossed we'll get razor editing there soon as well!!

WOW, if the Midi Editor grid size is set to 16px it acts like a "Grid snap settings follow grid visibility" option (that Reaper is missing for the Midi editor) and finally solves the snapping to invisible grid lines problem, which was the Nr. 1 of my biggest Midi editor wishes.

It's a pity however that it doesn't draw grid lines below 16px spacing. If it could do that it would resolve Nr.2 of my biggest wishes. But I fear Reaper doesn't allow drawing grid lines in the Midi editor below that value.. or could you work around that somehow?

Other requests:

Would it by possible to either have an option to make this script act only on the Midi editor or have an option to link grid line spacing and grid snap spacing? I am already pretty happy with the behavior I get in the arrange view by activating "Grid snap settings follow grid visibility" and don't want to miss that.

Would it be possible to allow setting a limit of grid divisions when zooming in? For example don't go higher than 1/128.

EDIT

Could we also maybe get an action that toggles triplet grid for the current spacing? Right now it seems to make the script not work properly when doing it via SWS action.

Thanks so much for the great work FTC!

Last edited by Phazma; 12-05-2021 at 07:21 AM.
Phazma is online now   Reply With Quote
Old 12-05-2021, 09:43 AM   #4
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by Phazma View Post
WOW, if the Midi Editor grid size is set to 16px it acts like a "Grid snap settings follow grid visibility" option (that Reaper is missing for the Midi editor) and finally solves the snapping to invisible grid lines problem, which was the Nr. 1 of my biggest Midi editor wishes.
Very interesting. The script uses the minimum grid spacing from the arrange view grid settings. Narrowest = 1x, Narrow = 2x, Medium = 3x etc. This guarantees that you're always snapping to the grid. It was using the same minimum spacing for the MIDI editor as well... which makes little sense. So I changed it to a fixed 15px for the MIDI editor in the latest update. This means that Narrowest will now always be 15px, Narrow = 30px etc. Notes should now always snap to grid with all adaptive modes.

Quote:
Originally Posted by Phazma View Post
It's a pity however that it doesn't draw grid lines below 16px spacing. If it could do that it would resolve Nr.2 of my biggest wishes. But I fear Reaper doesn't allow drawing grid lines in the Midi editor below that value.. or could you work around that somehow?
I looked it into... Doesn't seem to be possible. There's a value in the item chunk (4th value of CFGEDITVIEW) that looks like it could be the grid spacing (it's set to 16). But it's read-only.... so nothing we can do it looks like.

Quote:
Originally Posted by Phazma View Post
Other requests:

Would it by possible to either have an option to make this script act only on the Midi editor or have an option to link grid line spacing and grid snap spacing? I am already pretty happy with the behavior I get in the arrange view by activating "Grid snap settings follow grid visibility" and don't want to miss that.
Can you elaborate? Not sure what you mean by "act only on the MIDI editor"?

Quote:
Originally Posted by Phazma View Post
Would it be possible to allow setting a limit of grid divisions when zooming in? For example don't go higher than 1/128.
Yes, good idea!

Quote:
Originally Posted by Phazma View Post
EDIT

Could we also maybe get an action that toggles triplet grid for the current spacing? Right now it seems to make the script not work properly when doing it via SWS action.

Thanks so much for the great work FTC!
What is it that doesn't work? Can't replicate.
FeedTheCat is online now   Reply With Quote
Old 12-05-2021, 11:24 AM   #5
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,188
Default

Quote:
Originally Posted by FeedTheCat View Post
So I changed it to a fixed 15px for the MIDI editor in the latest update. This means that Narrowest will now always be 15px, Narrow = 30px etc. Notes should now always snap to grid with all adaptive modes.
Great! But why 15px and not 16px? If I set it to 15px there are some zoom levels where notes snap to invisible grid lines which doesn't happen if set to 16px. Interestingly, this happens only when choosing 15px as custom size but not when using the Narrowest option (which is 15px too, right?).

Quote:
Originally Posted by FeedTheCat View Post
I looked it into... Doesn't seem to be possible. There's a value in the item chunk (4th value of CFGEDITVIEW) that looks like it could be the grid spacing (it's set to 16). But it's read-only.... so nothing we can do it looks like.
That's what I expected.. but thanks for looking into it anyway!

Quote:
Originally Posted by FeedTheCat View Post
Can you elaborate? Not sure what you mean by "act only on the MIDI editor"?
I mean an option, that bypasses the script for the arrange view so that it only modifies the MIDI editor without affect Reaper's own handling of the grid in the arrange view. Maybe best UX would be to have two options "Adaptive grid for arrange view" and "Adaptive grid for MIDI editor" which can be (de)activated independently so the user can decide whether he wants the script to modify the arrange view or the MIDI editor or both.

I actually asked for this option because I need the script mostly for the Midi editor and how Reaper handles the arrange view grid is ok for me (don't use RE that often) and turning it off would eliminate glitches like this (should have reported already in my first post):

But actually after playing around with your script a bit it feels really handy also for arrange view. If you can implement a grid divisions limit I would probably use it happily in both arrange view and midi editor and it would also solve this issue of grid lines disappearing during edits when zooming in more than 1/1024 (also triplets are not supported at 1/1024):



Quote:
Originally Posted by FeedTheCat View Post
What is it that doesn't work? Can't replicate.
It sometime needs running the action 2 times in a row to set the grid correctly:



Also, sometimes glitches like the following occur in triplet mode:



But maybe this is due to Reaper not having a native triplet toggle for snap/grid settings so it is not your script causing it but the SWS action in general.
Phazma is online now   Reply With Quote
Old 12-05-2021, 01:18 PM   #6
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by Phazma View Post
Great! But why 15px and not 16px? If I set it to 15px there are some zoom levels where notes snap to invisible grid lines which doesn't happen if set to 16px. Interestingly, this happens only when choosing 15px as custom size but not when using the Narrowest option (which is 15px too, right?).
Good catch! I forgot to add one pixel when calculating the custom size (for the grid line itself)
Quote:
Originally Posted by Phazma View Post
I mean an option, that bypasses the script for the arrange view so that it only modifies the MIDI editor without affect Reaper's own handling of the grid in the arrange view. Maybe best UX would be to have two options "Adaptive grid for arrange view" and "Adaptive grid for MIDI editor" which can be (de)activated independently so the user can decide whether he wants the script to modify the arrange view or the MIDI editor or both.

I actually asked for this option because I need the script mostly for the Midi editor and how Reaper handles the arrange view grid is ok for me (don't use RE that often) and turning it off would eliminate glitches like this (should have reported already in my first post):
Thank you for elaborating. I got confused as it should already work like this. You can make the grid adaptive in arrange and MIDI editor separately, or both simultaneously. Maybe it isn't clear that you can deactivate the adaptive grid by clicking on a fixed value (e.g. 1/4 in the arrange view menu)?

Quote:
Originally Posted by Phazma View Post

It sometime needs running the action 2 times in a row to set the grid correctly:

Hmmm, are you using "SWS/AW: Toggle triplet grid"?

Quote:
Originally Posted by Phazma View Post
Also, sometimes glitches like the following occur in triplet mode:

Yeah.. I think that's a reaper bug. It seems to happen at certain zoom levels when the grid is set to something weird like 2/3.
Edit Seems to happen only at 2/3 actually...
FeedTheCat is online now   Reply With Quote
Old 12-05-2021, 02:39 PM   #7
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,188
Default

Quote:
Originally Posted by FeedTheCat View Post
Thank you for elaborating. I got confused as it should already work like this. You can make the grid adaptive in arrange and MIDI editor separately, or both simultaneously. Maybe it isn't clear that you can deactivate the adaptive grid by clicking on a fixed value (e.g. 1/4 in the arrange view menu)?
Ah ok, it seems to work like this. Even if it is a bit confusing from UX point of view.

My usual workflow in the arrange window is that I have grid lines set to 8px and "Grid snap settings follow grid line visibility" enabled. And I have 4 actions assigned to keyboard shortcuts for setting grid to 1/32, 1/32T, 1/64 and 1/128. Most of the time I stay at 1/32 or 1/32T which doesn't get visually too confusing with many beat subdivisions but often I need to zoom in and activate 1/64 for finer edits (and very rarely 1/128).

Now, it is possible to set your script to 1/32 for example and afterwards use the actions to set different grid values as needed (basically keeping my workflow). But it is not so clear that this works. I first asked myself, if I select 1/32 will my grid now be locked at 1/32 and jump back/conflict with the script if I change it afterwards? That luckily does not happen, but it is confusing.

Also your script supports only fixed grid values up to 1/32 while Reaper has actions also for 1/64 and 1/128. For consistency and various workflow needs IMO it should have options for fixed grid up to 1/128.


Quote:
Originally Posted by FeedTheCat View Post
Hmmm, are you using "SWS/AW: Toggle triplet grid"?
In this example yes. However I have now seen that this only happens if I do it while the grid settings window is open. So it is not the fault of either your action nor the SWS action but just another Reaper bug.


Quote:
Originally Posted by FeedTheCat View Post
Yeah.. I think that's a reaper bug. It seems to happen at certain zoom levels when the grid is set to something weird like 2/3.
Edit Seems to happen only at 2/3 actually...
Here it happens also in 4/4. Steps:

- Activate Adaptive Grid (Narrowest)
- Run Action "Grid: Set to 1/32
- Run Action "SWS/AW: Toggle triplet grid"
- Zoom in slowly

Around 1/128 you should start seeing the glitches.
Phazma is online now   Reply With Quote
Old 12-05-2021, 04:36 PM   #8
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 4,527
Default

Wasn’t there a native triplet action (not at the computer right now).
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is online now   Reply With Quote
Old 12-05-2021, 05:05 PM   #9
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,418
Default

Very nice! Been wanting something like this for a while (and too lazy it to script it myself).

After a hasty test, one observation: when both arrange and MIDI editor are set to an adaptive level, if the "Use the same grid division in arrange view and MIDI editorTimebase: Sync to arrange view" option is enabled and the MIDI editor is open, things get a tad janky as there's presumably some contention between both arrange and MIDI editor settings.

I recommend checking if this option is enabled and the MIDI editor is open, and if so, go with whatever is set for the MIDI editor adaptive gridtimebase sync setting, skip setting the arrange view, and let REAPER keep things in sync. Otherwise, use the current behavior.

In my case, I usually have the editor docked with the "use same grid divisiontimebase: Sync to arrange view" option enabled, but I have a cycle action to undock the editor and toggle the linked grid divisionsynced grid option. I think with my suggestion implemented I'll be able to have my cake and eat it too.

Thanks for sharing!

Last edited by tack; 12-06-2021 at 11:59 AM. Reason: Fixed incorrect offending option
tack is offline   Reply With Quote
Old 12-05-2021, 05:46 PM   #10
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,188
Default

Quote:
Originally Posted by _Stevie_ View Post
Wasn’t there a native triplet action (not at the computer right now).
No it seems there are only actions to set the grid to a specific triplet value like "Grid Set to 1/48 (1/32 triplet)" and similar actions. For toggling triplet grid on/off independently there is only the SWS action.
Phazma is online now   Reply With Quote
Old 12-05-2021, 07:46 PM   #11
dagamusik
Human being with feelings
 
dagamusik's Avatar
 
Join Date: Aug 2020
Location: Colombia
Posts: 149
Default

I was missing something like that when moved from Ableton Live! Thanks!
dagamusik is offline   Reply With Quote
Old 12-06-2021, 07:21 AM   #12
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 4,527
Default

Quote:
Originally Posted by tack View Post
After a hasty test, one observation: when both arrange and MIDI editor are set to an adaptive level, if the "Use the same grid division in arrange view and MIDI editor" option is enabled and the MIDI editor is open, things get a tad janky as there's presumably some contention between both arrange and MIDI editor settings.
Yeah, I had been thinking this could cause an issue. When coding stuff for the MIDI editor that involves snap, there's always a bunch of things to take care of. I have quite a lot of scripts to adjust in that regard

Quote:
Originally Posted by Phazma View Post
No it seems there are only actions to set the grid to a specific triplet value like "Grid Set to 1/48 (1/32 triplet)" and similar actions. For toggling triplet grid on/off independently there is only the SWS action.
Wow okay, I had thought it's native in the meanwhile.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is online now   Reply With Quote
Old 12-06-2021, 07:27 AM   #13
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,188
Default

Quote:
Originally Posted by _Stevie_ View Post
Yeah, I had been thinking this could cause an issue. When coding stuff for the MIDI editor that involves snap, there's always a bunch of things to take care of. I have quite a lot of scripts to adjust in that regard
All of this would seriously need some love from the devs and a consistent native implementation. But meanwhile I feel very grateful for the effort done on such scripts which as far as they can circumvent these limitations.
Phazma is online now   Reply With Quote
Old 12-06-2021, 07:33 AM   #14
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 4,527
Default

Yeah, I totally know what you mean.
One of the main issues is, that not all grid settings can be set in the MIDI editor via the API.
For example, when you want to set swing in the MIDI editor, you have to use this workaround:

- backup the arrange grid settings
- link the MIDI editor with the arrange
- set the swing amount in the arrange
- unlink the ME from the arrange (in case it hasn't been linked before)
- restore the arrange grid settings

I'm using this method for my quantize scripts, because I'm too dumb to do the snap grid calculation manually
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is online now   Reply With Quote
Old 12-06-2021, 07:39 AM   #15
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,188
Default

I think it would be best if we got a fully featured Snap/Grid Settings window for the MIDI editor, just like we have for the arrange view (obviously without options that don't make sense for the MIDI editor).
Phazma is online now   Reply With Quote
Old 12-06-2021, 11:48 AM   #16
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by Phazma View Post
Here it happens also in 4/4. Steps:

- Activate Adaptive Grid (Narrowest)
- Run Action "Grid: Set to 1/32
- Run Action "SWS/AW: Toggle triplet grid"
- Zoom in slowly

Around 1/128 you should start seeing the glitches.
Ah yeah, 1/128T also has issues.

Edit: and 1/512T ^^

I'm relatively certain it has nothing to do with my script though, I can also replicate the glitch like this...

- Set Grid to 1/128
- Run Action "SWS/AW: Toggle triplet grid"
- Zoom in slowly

Quote:
Originally Posted by tack View Post
I recommend checking if this option is enabled and the MIDI editor is open, and if so, go with whatever is set for the MIDI editor adaptive grid setting, skip setting the arrange view, and let REAPER keep things in sync. Otherwise, use the current behavior.
So zooming inside the editor will still change the grid in the arrange view, but not the other way round, correct? Let me know if it works as expected in v1.1.0

Last edited by FeedTheCat; 12-06-2021 at 11:54 AM.
FeedTheCat is online now   Reply With Quote
Old 12-06-2021, 11:50 AM   #17
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Update v1.1
  • Added menu option for 1/64 & 1/128
  • Add user defined grid size limits
  • Ignore arrange view when MIDI editor grid is synced
  • Various optimizations to make background service super lightweight
FeedTheCat is online now   Reply With Quote
Old 12-06-2021, 11:56 AM   #18
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,418
Default

Quote:
Originally Posted by FeedTheCat View Post
So zooming inside the editor will still change the grid in the arrange view, but not the other way round, correct?
Well, the first problem is that I utterly flubbed my initial report. The option in question wasn't "Use the same grid division in arrange view and MIDI editor" but rather "Timebase: Sync to arrange view."

It works bidirectionally. If you change zoom in arrange view, MIDI editor is updated; if you change in the MIDI editor, arrange view is updated to stay in sync.

But I suppose it's also possible the linked grid division option could conflict as well.

Quote:
Originally Posted by FeedTheCat View Post
Let me know if it works as expected in v1.1.0
Despite my bogus explanation of the problem, yes, 1.1.0 works perfectly now.

Thanks!
tack is offline   Reply With Quote
Old 12-06-2021, 01:16 PM   #19
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,188
Default

Quote:
Originally Posted by FeedTheCat View Post
Update v1.1
  • Added menu option for 1/64 & 1/128
  • Add user defined grid size limits
  • Ignore arrange view when MIDI editor grid is synced
  • Various optimizations to make background service super lightweight
Great update, thank you!

Some things I noticed with triplets:

- When choosing Triplet the current grid division is no longer checked in your menu script. I think it should show active grid division and active grid type independently.

- I'd like to set the MIDI editor min grid size to 1/64 triplets but whether I write 1/64T or 1/96 it doesn't work. It only zooms to 1/64 straight or 1/32 triplet. It would be nice if you could support setting the min grid size to a triplet value (probably best by just letting the user add "T" to the division number).

Some Bugs:

1) I have the option "Drawing or selecting a note sets the new note length" active. The script breaks this and it just sets the note length to be the same as the grid division

2) Sometimes the snapping breaks when moving notes that are smaller than the visible grid. Instead of snapping to the start of a grid line they snap somewhere inbetween

Both behaviors are visible in the following gif, at the beginning 1) and at the end 2). Don't mind the grid lines disappearing at a certain zoom level, that's just how the gif was recorded:

Phazma is online now   Reply With Quote
Old 12-06-2021, 03:57 PM   #20
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by Phazma View Post
Great update, thank you!

Some things I noticed with triplets:

- When choosing Triplet the current grid division is no longer checked in your menu script. I think it should show active grid division and active grid type independently.
Oops, that used to work..

Quote:
Originally Posted by Phazma View Post
- I'd like to set the MIDI editor min grid size to 1/64 triplets but whether I write 1/64T or 1/96 it doesn't work. It only zooms to 1/64 straight or 1/32 triplet. It would be nice if you could support setting the min grid size to a triplet value (probably best by just letting the user add "T" to the division number).
Classic case of floating point trouble. (Triplets usually have something with .666666666666667 etc). Both 1/96 and 1/64T should now work in v1.1.2.

Quote:
Originally Posted by Phazma View Post
Some Bugs:

1) I have the option "Drawing or selecting a note sets the new note length" active. The script breaks this and it just sets the note length to be the same as the grid division

2) Sometimes the snapping breaks when moving notes that are smaller than the visible grid. Instead of snapping to the start of a grid line they snap somewhere inbetween

Both behaviors are visible in the following gif, at the beginning 1) and at the end 2). Don't mind the grid lines disappearing at a certain zoom level, that's just how the gif was recorded:

Hmmm, don't think there's a bug here.

1) With that option enabled, if you select a note which is exactly the length of your grid, the new note length is set to grid.

2) Looks like you have "Snap note ends to grid" enabled.
FeedTheCat is online now   Reply With Quote
Old 12-06-2021, 05:04 PM   #21
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,188
Default

Quote:
Originally Posted by FeedTheCat View Post
Oops, that used to work..

Classic case of floating point trouble. (Triplets usually have something with .666666666666667 etc). Both 1/96 and 1/64T should now work in v1.1.2.
Thanks, triplets work great now!

Quote:
Originally Posted by FeedTheCat View Post
1) With that option enabled, if you select a note which is exactly the length of your grid, the new note length is set to grid.
Ah now I understand what the problem is. When the grid division is equal to the length of the selected note, REAPER for some reason changes the setting for inserted note length to "Grid" instead of the actual selected note length. When the grid is static this is no problem as the note length remains the same unless manually changing grid. But when the grid is adaptive the length of the note changes together with the grid on zoom.

Not sure if this is intended behavior / a missing feature or a Reaper bug. Anyway I will report it somewhere. I guess you have no possibility to prevent Reaper from doing this via script?

Quote:
Originally Posted by FeedTheCat View Post
2) Looks like you have "Snap note ends to grid" enabled.
That was indeed the case. Thanks for pointing it out.
Phazma is online now   Reply With Quote
Old 12-07-2021, 03:56 AM   #22
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by Phazma View Post
Not sure if this is intended behavior / a missing feature or a Reaper bug. Anyway I will report it somewhere. I guess you have no possibility to prevent Reaper from doing this via script?
It's probably intended. Can be handy in certain situations I guess. Not sure if I can do anything about it, I'll look into it. But it's probably a bit outside of the scope of this script.
FeedTheCat is online now   Reply With Quote
Old 12-07-2021, 04:18 AM   #23
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,188
Default

Quote:
Originally Posted by FeedTheCat View Post
It's probably intended. Can be handy in certain situations I guess. Not sure if I can do anything about it, I'll look into it. But it's probably a bit outside of the scope of this script.
I understand. If you can do something about it, it would be amazing! Otherwise I will see if I can convince the developers to provide an option to disable this behavior. In any case, thanks a lot already for this amazing script!
Phazma is online now   Reply With Quote
Old 12-07-2021, 11:29 AM   #24
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by Phazma View Post
I understand. If you can do something about it, it would be amazing! Otherwise I will see if I can convince the developers to provide an option to disable this behavior. In any case, thanks a lot already for this amazing script!
Sooo... we don't have an API option to set new note length, but there's a bunch of actions. This made this kind of tricky, but I'm really pleased with the result. Should work well, at least up to 1/128. Check out v1.2!

(The background service needs to reload after the update, so best to just restart reaper)
FeedTheCat is online now   Reply With Quote
Old 12-07-2021, 01:31 PM   #25
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,188
Default

Quote:
Originally Posted by FeedTheCat View Post
Sooo... we don't have an API option to set new note length, but there's a bunch of actions. This made this kind of tricky, but I'm really pleased with the result. Should work well, at least up to 1/128. Check out v1.2!

(The background service needs to reload after the update, so best to just restart reaper)
This works perfectly

Thanks for all the extra effort to make this script work for my purposes. It will make editing midi much more enjoyable. Just sent a small donation your way.
Phazma is online now   Reply With Quote
Old 12-07-2021, 01:40 PM   #26
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by Phazma View Post
This works perfectly

Thanks for all the extra effort to make this script work for my purposes. It will make editing midi much more enjoyable. Just sent a small donation your way.
No worries, thank you for the feedback. Really helped ironing out this script. And thank you for the donation
FeedTheCat is online now   Reply With Quote
Old 01-03-2022, 02:20 PM   #27
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Pushed a fix for macOS in fullscreen mode without testing it much. Let me know if there's any issues.
FeedTheCat is online now   Reply With Quote
Old 01-04-2022, 12:35 AM   #28
wastee
Human being with feelings
 
Join Date: Mar 2015
Posts: 123
Default

Very usefully. Awesome work!
wastee is offline   Reply With Quote
Old 01-04-2022, 12:56 AM   #29
sockmonkey72
Human being with feelings
 
sockmonkey72's Avatar
 
Join Date: Sep 2021
Location: Berlin
Posts: 554
Default

Quote:
Originally Posted by FeedTheCat View Post
Pushed a fix for macOS in fullscreen mode without testing it much. Let me know if there's any issues.
Thanks, seems to be working here.
sockmonkey72 is online now   Reply With Quote
Old 02-15-2022, 11:32 PM   #30
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 845
Default

This is really great, thank you!

My solution for this has been setting minimum grid line spacing to 30-40 pixels and ticking 'grid snap settings follow grid visibility', which works ok, but it still looks cluttered when zoomed right out, and it doesn't work in the midi editor.

I really wish I could incorporate this script into my workflow, as I love how much cleaner it looks when zoomed right out on the 'wide' setting, it's lovely. It's also SO nice to have adaptive grid in the midi editor. Unfortunately the vast majority of my midi quantizing is done from the arrange page, using a single dialog-free quantize action to quantize the midi notes in the selected items to the current grid size including swing (which is often on). This is not possible while your script is running.

I have a workflow that works very well for me that goes -

mousewheel+modifier to select grid size for quantizing,

mousewheel+modifier to select swing amount (I can see all of these adjustments in real time from the arrange window using mpl's interactive toolbar script)

Hit 'q' to use stevie's script to quantize the notes in the selected midi items to grid.

All of this works with my current adaptive grid hack (changing the minimum pixel size) but it doesn't work well with your script. I can still technically mousewheel scroll to my desired grid size, but as soon as I zoom in or out your script takes over, so I have to reset it every single time I want to quantize.

It would be really amazing if there were away to decouple this script from the actual grid settings, so it only affects grid visibility and snap, NOT the actual grid setting. I know this is possible in Reaper because it's what I'm already doing, but what you've created is SO much better.

I know my use case probably sounds like a weird edge case, but I think there is a good argument for decoupling this script from the actual grid settings, and having it only effect visibility and snap.

If this isn't possible via scripting or it's too much work, then another workaround could be a script to 'deactivate' the adaptive grid and go back to the previously selected grid setting, this would obviously require the script to remember the previous grid setting though. I could then make a custom action for deactivate>quantize to grid>reactivate.

Lastly, if neither of these is possible then a way to fully decouple the arrange part of the script from the midi part, even when "Timebase: Sync to arrange view" is on, would be really helpful. If the other parts are do-able then this is far less important though.

I'm SO hoping this is possible as I love this script, and if you manage it there will be definitely be a donation coming your way from me.

If not then no worries of course, and thanks anyway for your hard work.
Joe90 is offline   Reply With Quote
Old 02-16-2022, 11:38 AM   #31
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by Joe90 View Post
It would be really amazing if there were away to decouple this script from the actual grid settings, so it only affects grid visibility and snap, NOT the actual grid setting. I know this is possible in Reaper because it's what I'm already doing, but what you've created is SO much better.
Hmmm, not sure how that could work. I can make the script change between different "minimum grid line spacing" settings, e.g. 11px for narrow and 50px for wide (which is probably not what you want). But aside from that I can't think of any setting that influences grid spacing except changing the grid itself.

Quote:
Originally Posted by Joe90 View Post
If this isn't possible via scripting or it's too much work, then another workaround could be a script to 'deactivate' the adaptive grid and go back to the previously selected grid setting, this would obviously require the script to remember the previous grid setting though. I could then make a custom action for deactivate>quantize to grid>reactivate.
That is definitely possible. I can add an action to "Restore last known fixed grid division" or something like that.

You got me curious though, do I understand correctly that you are quantizing MIDI to the grid, without actually seeing the grid lines you're quantizing to?
FeedTheCat is online now   Reply With Quote
Old 02-16-2022, 06:10 PM   #32
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 845
Default

Quote:
Originally Posted by FeedTheCat View Post
I can make the script change between different "minimum grid line spacing" settings, e.g. 11px for narrow and 50px for wide (which is probably not what you want). But aside from that I can't think of any setting that influences grid spacing except changing the grid itself.
The main problem with my current method is that it doesn't keep dividing when you zoom out beyond a certain point, so actually I do think this would work. Just testing now, and something like 20 when zoomed in, 35 for medium zoom, and 70 when zoomed out to a full song, would actually work quite nicely. EDIT - just been playing around with and I can basically get this behaviour by just setting the pixels to the higher number... D'oh. I'd still love a way to only have this script run in the midi editor though. I suppose an 'enable/disable' script would be a workaround for that, I could attach it to the toggle action I use to open/close the midi editor.

Quote:
Originally Posted by FeedTheCat View Post
You got me curious though, do I understand correctly that you are quantizing MIDI to the grid, without actually seeing the grid lines you're quantizing to?
Yes.



It was my workflow in Cubase for years, and it was a massive PITA to get it working smoothly two years ago when I switched to Reaper. There were about a million scripts for quantizing notes in midi items from the arrange page to the current grid settings, but almost none of them followed swing or triplets correctly, or they had other issues. The only one that worked as it should was a me2beats script, which I put into a custom action with a script that lowered the minimum line spacing to 1, quantized using the me2beats script, and then raised it back up to my desired amount.

Luckily a new API was released and Stevie updated his quantize scripts so they work correctly with swing and they follow the actual grid, not visible grid, so I don't need to go through any of that rigmarole any more (thanks Stevie!).

My problem is I'm used to Cubase which has a separate grid setting and quantize setting, so I basically use the Reaper grid setting as my global quantize setting, easily alterable with mousewheel modifiers, and then I force the grid to look less cluttered by using the minimum line spacing and 'grid snap settings follow grid visibility'. I should point out, I LIKE that the item snapping changes as you scroll out, that's good, it's only the quantizing that should stay unaffected.

The more I write about it, the more I realise it's really just a consequence of my very specific workflow, and you probably shouldn't devote too much time listening to my ramblings!

Last edited by Joe90; 02-16-2022 at 09:44 PM.
Joe90 is offline   Reply With Quote
Old 02-17-2022, 06:29 AM   #33
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by Joe90 View Post
I'd still love a way to only have this script run in the midi editor though.
That's no issue at all, just don't use an adaptive mode in the arrange view. The MIDI editor part can function on its own, it has it's own menu and everything. (If you want the MIDI editor to remember whether it was adaptive or not after restarting reaper, you have to use the "Run service on startup" option which is only accessible through the main section menu, I should fix that...)



Edit: If you change your mind and want that action after all, let me know. It's no trouble to add.
FeedTheCat is online now   Reply With Quote
Old 02-17-2022, 09:17 PM   #34
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 845
Default

Quote:
Originally Posted by FeedTheCat View Post
Edit: If you change your mind and want that action after all, let me know. It's no trouble to add.
I've been playing with this some more, and a script that turns off adaptive grid and returns to the last used grid setting would be super helpful. It would need to be accessible from the 'midi editor' action menu, so I can use it in a custom action in front of my 'quantize notes to grid 'action so that it ignores the adaptive grid and uses the last selected grid settings.

It would also be helpful to make a version available in the main menu and to make it a toggle, as then I can attach it to the action I use to toggle the midi editor open and closed. Currently when I close the midi editor the adaptive grid has altered my grid size to something massive, and I have to manually switch it back to 1/16 or whatever I'm using for quantizing every time I close it. A way of toggling the script on and off and returning to previous grid settings would fix this.

It would also be great to have a way to turn on the midi editor adaptive grid from the 'main' action menu, so I can put it in my startup actions. Not a big deal if not though, it would only need to be done once per project anyway.

Yes, I am a PITA I know.
Joe90 is offline   Reply With Quote
Old 02-18-2022, 06:01 AM   #35
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Let me address the easy parts first:

Quote:
Originally Posted by Joe90 View Post
It would also be great to have a way to turn on the midi editor adaptive grid from the 'main' action menu, so I can put it in my startup actions. Not a big deal if not though, it would only need to be done once per project anyway.
Use the menu (main) > options > Run service on startup. The service will check if adaptive grid was previously active, else exit quietly. You don't have to enable it for every project, because adaptive grid is global (if it's enabled, it does is its thing on every open project until it's disabled).

Quote:
Originally Posted by Joe90 View Post
Currently when I close the midi editor the adaptive grid has altered my grid size to something massive, and I have to manually switch it back to 1/16 or whatever I'm using for quantizing every time I close it. A way of toggling the script on and off and returning to previous grid settings would fix this.
Sounds like you have the option "Use same grid division in MIDI editor and arrange view" enabled. Have you considered disabling it?
FeedTheCat is online now   Reply With Quote
Old 02-19-2022, 09:03 AM   #36
Ilia Tilev
Human being with feelings
 
Ilia Tilev's Avatar
 
Join Date: Sep 2021
Location: Earth
Posts: 9
Default

WOW This is phenomenal i've just downloaded it and wanna see how it works. Been searching for this kind of feature for months. Always loved the way Ableton adapts the zoom level to the grid and i was missing that feature in Reaper..
Ilia Tilev is offline   Reply With Quote
Old 02-19-2022, 04:16 PM   #37
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 4,527
Default

Hey Joe90, thanks for the nice feedback regarding the quantize script ! 😊

Unfortunately, I have stopped using “adaptive grid” for the exact same reason: my quantize script.
I haven’t found a way to make these 2 scripts work nicely together. But I think, it is as you mentioned, caused by the workflow itself.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is online now   Reply With Quote
Old 02-19-2022, 08:32 PM   #38
Fergler
Human being with feelings
 
Fergler's Avatar
 
Join Date: Jan 2014
Posts: 4,762
Default

Firstly, I had no idea scripts could just generate menus at the cursor position like that. Very useful.

Secondly, what theme are you using? Really love the yellow toolbar icons.
__________________
Check out my hip-hop, funk-rock band Theatre Crisp
Fergler is offline   Reply With Quote
Old 02-20-2022, 04:12 AM   #39
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by Fergler View Post
Firstly, I had no idea scripts could just generate menus at the cursor position like that. Very useful.

Secondly, what theme are you using? Really love the yellow toolbar icons.
Echolot
FeedTheCat is online now   Reply With Quote
Old 02-20-2022, 04:49 PM   #40
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 845
Default

Quote:
Originally Posted by FeedTheCat View Post
Let me address the easy parts first:

Use the menu (main) > options > Run service on startup. The service will check if adaptive grid was previously active, else exit quietly. You don't have to enable it for every project, because adaptive grid is global (if it's enabled, it does is its thing on every open project until it's disabled).
Unfortunately I already have this option enabled and pointing to a custom action called 'startup' that contains a handful of scripts, I can only add in scripts from the 'main' menu, not the 'midi editor' menu, and I only want adaptive grid running in the midi editor. Not a big deal at all though, I've just set up a toggle button for adaptive grid in the midi editor.

Quote:
Originally Posted by FeedTheCat View Post
Sounds like you have the option "Use same grid division in MIDI editor and arrange view" enabled. Have you considered disabling it?
I do, and unticking it fixes this, thanks. I would prefer to keep that option ticked though as it suits my workflow, and a toggle action for 'enable/disable adaptive grid (remember previous grid size) could potentially solve that, and this -

Quote:
Originally Posted by _Stevie_ View Post
Unfortunately, I have stopped using “adaptive grid” for the exact same reason: my quantize script.
I haven’t found a way to make these 2 scripts work nicely together. But I think, it is as you mentioned, caused by the workflow itself.
Again, not a biggie - it is a specific workflow thing, so absolutely no worries if it's a PITA.

FWIW Stevie - you probably know this, but if (like me) you only want the adaptive grid to work on the visual grid lines and item snapping but without the actual grid size changing, then setting the minimum pixel size to the 45-55 range and enabling 'grid size follows grid visibility' effectively achieves this. Doesn't work in the midi editor though, obviously.
Joe90 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 01:47 PM.


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