|
|
|
05-02-2014, 02:12 PM
|
#1
|
Human being with feelings
Join Date: Oct 2010
Posts: 272
|
Snap or quantize markers to grid (not stretch markers)
Is there any way to do this automatically? I couldn't find an action. I key markers in in real time sometimes and place them at the play cursor. Being able to quantize them to the grid would help.
|
|
|
05-04-2014, 07:20 AM
|
#2
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Here's an EEL script - Move project markers to the closest grid.
- Markers are moved to the closest grid -> set the grid division from the "Snap/Grid settings"
- "Snap to grid" can be enabled or disabled
Code:
// Move project markers to the closest grid (EEL script 4.5.2014 by spk77)
// Markers are moved to the closest grid -> set the grid division from "Snap/Grid settings"
// ("Snap to grid" can be enabled or disabled)
function move_markers_to_grid() local(snap, index, isrgn, pos, rgnend, markrgnindexnumber)
(
index = 0;
Undo_BeginBlock();
GetToggleCommandState(1157) ? (
snap = 1;
) : (
snap = 0;
Main_OnCommand(1157, 0);
);
while(EnumProjectMarkers(index, isrgn, pos, rgnend, #nameOut, markrgnindexnumber)) (
isrgn == 0 ? SetProjectMarker(markrgnindexnumber, isrgn, SnapToGrid(0, pos), rgnend, #nameOut);
index += 1;
);
snap == 0 ? Main_OnCommand(1157, 0);
Undo_EndBlock("Move markers to grid", -1);
);
move_markers_to_grid();
|
|
|
05-07-2014, 03:02 PM
|
#3
|
Human being with feelings
Join Date: Oct 2010
Posts: 272
|
Great, this works a treat. Thanks a million!
|
|
|
04-19-2015, 10:54 AM
|
#4
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,068
|
@spk77
As always, many thanks.
Is there a way to get this to work for frames?
I mainly work with CD frames (75)
When I have the project settings set to frames (75), and grid set to: hours:mins:secs:frames, the script works but the pixel or zoom settings messes it up, unless I'm zoomed all the way in.
Is there a possible work around for this?
Thanks,
Wyatt
|
|
|
04-19-2015, 12:47 PM
|
#5
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by WyattRice
@spk77
As always, many thanks.
Is there a way to get this to work for frames?
I mainly work with CD frames (75)
When I have the project settings set to frames (75), and grid set to: hours:mins:secs:frames, the script works but the pixel or zoom settings messes it up, unless I'm zoomed all the way in.
Is there a possible work around for this?
Thanks,
Wyatt
|
Hmm...yes, it seems "Grid settings->minimum pixels" -setting breaks this script.
Breeder might have a solution :
Quote:
Originally Posted by Breeder
I actually have this solved in the SWS, I can export something like SnapToGridDivision(position) for the next SWS pre, so spk77 can reuse it in his script.
|
(But it will not work in REAPER 4)
EDIT: I think SnapToGrid(project, pos) snaps to visible grid line and that's why it doesn't work.
|
|
|
04-19-2015, 02:18 PM
|
#6
|
Human being with feelings
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,942
|
It's a while since I wrote it, but I'm sure my CD Track Marker tool will do what you're asking, Wyatt.
Until I fully understood what was needed to make sure markers for tracks didn't mess up gapless CDs (you were a great help to me here, do you remember? -thank you), I included a means to quantise markers to the nearest 1/75 sec frame boundary.
As they were still useful to me -a quantised marker should never be moved by a burning pass -I left them in the tool. The quantise moves to the nearest 1/75s regardless of what frame size or grid settings are being used in the project, and any marker turns green if it aligns. Mousewheel/Ctrl-MW moves the marker to and by 10-frame/1-frame quantised increments.
There is a help page, but it was quite an early script for me so it is a bit clunky -post or PM if you need any help with it. Tool allows easy time selection alignment to the CD range, shows marker positions in terms of source times, and shows the CD tracks, track lengths, etc on the last page (from memory).
I still use it if I create a CD from REAPER, I find it shows stuff clearly and speeds up my workflow (once you know what the bits are ).
>
|
|
|
04-19-2015, 03:28 PM
|
#7
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,068
|
Thanks Nathan. PM sent.
|
|
|
04-20-2015, 05:05 AM
|
#8
|
Human being with feelings
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,942
|
And replied...
I think I'm going to add a "Quantise all markers" button on the Alignment page if that helps at all, Wyatt.
>
|
|
|
04-20-2015, 10:18 AM
|
#9
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,068
|
That would be great!
Thanks, Wyatt
Edit:
Would it be possible for you to do a stand alone version with no gui, just an action (Quantize all markers)?
|
|
|
04-20-2015, 12:52 PM
|
#10
|
Human being with feelings
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,942
|
Quote:
Originally Posted by WyattRice
That would be great!
Thanks, Wyatt
Edit:
Would it be possible for you to do a stand alone version with no gui, just an action (Quantize all markers)?
|
I don't see why not, I just have to pull the right bits out of the tool.
>
|
|
|
04-22-2015, 07:19 PM
|
#11
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,068
|
Quote:
Originally Posted by planetnine
I don't see why not, I just have to pull the right bits out of the tool.
>
|
Hi Nathan,
I finally got it figured out. Man it was right there in front of me the whole time from the old "insert cd marker at cursor" code I had.
I'm still a total noob when it comes to coding, but it's fun to watch stuff work right.
Anyway this seems to work. Needs code cleanup, etc.
This was just a quick test.
Code:
// Special thanks to gofer, planetnine, spk77, and, Argitoth.
//Quantize CD markers.eel
function round(value,digits) local(y)
(
y = floor(value * pow(10, digits) + 0.5) / pow(10, digits);
y;
);
function round(number) local(a b)
(
b = abs(number);
a = ceil(b-1);
a = b - a;
a >= .5 ? b = ceil(b) : b = floor(b);
number < 0 ? number = -b : number = b;
number;
);
Undo_BeginBlock2(0);
index = 0;
framesize = 1.0 / 75.0;
while(EnumProjectMarkers(index, isrgn, pos, rgnend, #nameOut, markrgnindexnumber)) (
framediv = pos / framesize;
FrameCount = round(framediv); // finds the frame during which the marker position is
Framerem = framediv % 1; //get the remainder of the un-rounded frame position to decide whether to round up
quanpos = FrameCount * framesize;
SetProjectMarker(markrgnindexnumber, isrgn, quanpos, rgnend, #nameOut);
index += 1;
Undo_EndBlock2(0, "Quantize CD markers", -1);
);
Edit: Thanks to user Argitoth, for the round function from this thread
Thanks, Wyatt
Last edited by WyattRice; 04-22-2015 at 09:37 PM.
|
|
|
01-19-2018, 04:37 AM
|
#12
|
Human being with feelings
Join Date: Feb 2015
Posts: 1,096
|
Quote:
Originally Posted by spk77
Here's an EEL script - Move project markers to the closest grid.
- Markers are moved to the closest grid -> set the grid division from the "Snap/Grid settings"
- "Snap to grid" can be enabled or disabled
Code:
// Move project markers to the closest grid (EEL script 4.5.2014 by spk77)
// Markers are moved to the closest grid -> set the grid division from "Snap/Grid settings"
// ("Snap to grid" can be enabled or disabled)
function move_markers_to_grid() local(snap, index, isrgn, pos, rgnend, markrgnindexnumber)
(
index = 0;
Undo_BeginBlock();
GetToggleCommandState(1157) ? (
snap = 1;
) : (
snap = 0;
Main_OnCommand(1157, 0);
);
while(EnumProjectMarkers(index, isrgn, pos, rgnend, #nameOut, markrgnindexnumber)) (
isrgn == 0 ? SetProjectMarker(markrgnindexnumber, isrgn, SnapToGrid(0, pos), rgnend, #nameOut);
index += 1;
);
snap == 0 ? Main_OnCommand(1157, 0);
Undo_EndBlock("Move markers to grid", -1);
);
move_markers_to_grid();
|
Hi. Old thread, but I can't get this script to work correctly on Reaper 5.70. Whatever grid setting I choose, the project markers snap to the nearest whole note (I was trying to snap to the nearest quarter note).
Here's a link to a GIF demonstrating the problem:
https://stash.reaper.fm/32724/snap%2...d%20script.gif
Last edited by uncleswede; 01-20-2018 at 04:20 AM.
Reason: clarification
|
|
|
01-20-2018, 04:46 AM
|
#13
|
Human being with feelings
Join Date: Feb 2015
Posts: 1,096
|
Bump - any scripters able to cast an eye over this quantize project markers issue?
Script appears to be ignoring current snap to grid settings (e.g 1/4 note) and adjusts markers to the nearest whole note?
Cheers
|
|
|
01-21-2018, 03:04 AM
|
#14
|
Human being with feelings
Join Date: May 2017
Posts: 3,204
|
{Deleted]
Last edited by Philbo King; 01-21-2018 at 03:16 AM.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 12:19 PM.
|