|
|
|
02-07-2015, 06:07 PM
|
#41
|
Human being with feelings
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
|
Quote:
Originally Posted by Soli Deo Gloria
Well, I think they should be considered as a unit; I don´t think there is another option. That is, they would be sliced by the start of the first note and the end of the second.
Thanks for the interest!
|
how about turn on "show stacked items in lanes" (not called that exactly) and treat those notes as two items. Project could get messy with a lot of stacked notes though
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
|
|
|
02-10-2015, 12:22 PM
|
#42
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Nice script,
A fork for quantize item position based on Snap Offest value (and not item Start Position) would be nice :P
|
|
|
02-10-2015, 01:13 PM
|
#43
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by X-Raym
Nice script,
A fork for quantize item position based on Snap Offest value (and not item Start Position) would be nice :P
|
This should do it :
Change line 70
Code:
pos = GetMediaItemInfo_Value(item, "D_POSITION")
to
Code:
pos = GetMediaItemInfo_Value(item, "D_POSITION") + GetMediaItemInfo_Value(item, "D_SNAPOFFSET");
...and line 94
Code:
SetMediaItemInfo_Value(item, "D_POSITION", pos - slider_val / 100 * (pos - (SnapToGrid(0, pos))));
to
Code:
SetMediaItemInfo_Value(item, "D_POSITION", pos - slider_val / 100 * (pos - (SnapToGrid(0, pos))) - GetMediaItemInfo_Value(item, "D_SNAPOFFSET"));
I noticed that there's a bug in line 65 (will fix):
Code:
memset(sel_item_array, 0, sel_item_count);
should be
Code:
memset(sel_item_array, 0, sel_item_count*2);
|
|
|
02-10-2015, 01:44 PM
|
#44
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@spk77
AAh thanks ! Perfect
Will you post this fork on stash ?
|
|
|
02-10-2015, 01:54 PM
|
#45
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by X-Raym
@spk77
AAh thanks ! Perfect
did you post it on stash ?
|
Not yet ...hmm...maybe "quantize items to grid using item snap offset" should be the default behavior for this tool?
|
|
|
02-10-2015, 01:56 PM
|
#46
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@spk77
Clear, concise, explicit... that would be a perfect title !
|
|
|
02-10-2015, 02:03 PM
|
#47
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
"Item snap offset thing" gave me a new script idea:
"Move item snap offset to first stretch marker in selected items" or something like that (might be useful with dynamic splitting)
|
|
|
02-10-2015, 02:22 PM
|
#48
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@spk77
I wonder what over beautiful functions we can create from snap offset...
For my part, I just made a reset script on this subject few weeks ago.
Reset item snap offset. Maybe you will find it useful if you start working on this :P
|
|
|
02-11-2015, 08:55 AM
|
#49
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by X-Raym
@spk77
I wonder what over beautiful functions we can create from snap offset...
For my part, I just made a reset script on this subject few weeks ago.
Reset item snap offset. Maybe you will find it useful if you start working on this :P
|
Thanks! (The github link in your thread doesn't seem to work)
|
|
|
02-11-2015, 10:08 AM
|
#50
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@spk77
and now it works :P
|
|
|
02-17-2015, 12:01 AM
|
#51
|
Human being with feelings
Join Date: May 2011
Location: KZ ALA
Posts: 110
|
Thanks !!!
|
|
|
05-27-2015, 05:01 PM
|
#52
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Thanks spk77 for this script to quantize items to grid.
I needed to quantize the item's end too.
This is the quantize function that also quantizes the ends.
not sure if it works correctly yet...it should but....
edit: mmmmm it seems SnapToGrid does the job on the visible grid that depends on the horizontal zoom...
we may need to update this to work with the double extension_api("BR_GetClosestGridDivision", position)
edit2: updated code with BR_GetClosestGridDivision:
Code:
function quantize() local (item, pos)
(
drag_started == 0 || mouse_cap == 0 ? sel_item_array_created = 0;
drag_started == 1 && slider_val != last_slider_val ? (
sel_item_array_created == 0 ? (
memset(sel_item_array, 0, sel_item_count);
sel_item_count = 0;
i_i = 0;
loop(CountSelectedMediaItems(0),
item = GetSelectedMediaItem(0, i_i);
pos = GetMediaItemInfo_Value(item, "D_POSITION");
length = GetMediaItemInfo_Value(item, "D_LENGTH");
end = pos + length;
sel_item_array[i_i * 3] = item;
sel_item_array[i_i * 3 + 1] = pos;
sel_item_array[i_i * 3 + 2] = end;
sel_item_count += 1;
i_i += 1;
);
sel_item_array_created = 1;
);
GetToggleCommandState(1157) ? (
snap = 1;
) : (
snap = 0;
Main_OnCommand(1157, 0);
);
GetToggleCommandState(40145) ? (
grid = 1;
) : (
grid = 0;
Main_OnCommand(40145, 0);
);
i = 0;
loop(sel_item_count,
item = sel_item_array[i * 3];
pos = sel_item_array[i * 3 + 1];
end = sel_item_array[i * 3 + 2];
posq = pos - slider_val / 100 * (pos - extension_api("BR_GetClosestGridDivision", pos));
endq = end - slider_val / 100 * (end - extension_api("BR_GetClosestGridDivision", end));
lengthq=endq-posq;
SetMediaItemInfo_Value(item, "D_POSITION", posq);
SetMediaItemInfo_Value(item, "D_LENGTH", lengthq);
i += 1;
);
undo_block = 1;
snap == 0 ? Main_OnCommand(1157, 0);
grid == 0 ? Main_OnCommand(40145, 0);
);
last_slider_val = slider_val;
//UpdateArrange();
);
Last edited by heda; 05-27-2015 at 05:14 PM.
Reason: new function with BR_GetClosestGridDivision
|
|
|
05-27-2015, 05:28 PM
|
#53
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
argh... it works for normal grids, but I wanted it for Frame grid to quantize all videos to frames before exporting the EDL.
And it does not work.
It seems there is a bug in BR_GetClosestGridDivision it doesn't work with Frame and it uses the latest grid division that was not Frame.
Watch:
I found you bug... prepare to die...
Breedeeeeeeeeeeerrrrrrrrrrr.. I need you
Bug hunter
|
|
|
05-27-2015, 11:51 PM
|
#54
|
Human being with feelings
Join Date: May 2010
Location: Norway
Posts: 7,318
|
Quote:
Originally Posted by spk77
Edit: Is that "Quantize stretch markers by X percent towards grid"?
|
Sorry for the late follow up.
Yes, I'm missing "Quantize stretch markers by X percent towards grid" in Reaper.
Do you know if the stretch-markers are accessible for you?
BTW: Great work with the items and env.-points
__________________
Reaper x64, win 11
Composer, text-writer, producer
Bandcamp
|
|
|
05-28-2015, 03:25 AM
|
#55
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@g-sun
I may be wrong but I think there is a script for that out there.
@heda
Spk77 script is nice for soft quantization, but if you need to hardly quantize for ends items, there is already actions for that (if I remember well it is a SWS action).
Tell me if you don't find it !
|
|
|
05-28-2015, 03:53 AM
|
#56
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by X-Raym
@heda
Spk77 script is nice for soft quantization, but if you need to hardly quantize for ends items, there is already actions for that (if I remember well it is a SWS action).
Tell me if you don't find it !
|
Thanks X-Raym, yes, I've seen SWS:Quanzite item's to grid actions, but it doesn't work on Frame grid either... It seems a limitation in REAPER? since the Frame grid was introduced more or less recently.
|
|
|
05-28-2015, 03:59 AM
|
#57
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@heda
Quote:
but it doesn't work on Frame grid either...
|
All my life... based on a LIE !!!
There is
in the api.
I may be possible to do a quantify item start and ends using this.
It will be the perfect occasion to use the brand new Set Edges breeder function
I'm on it !
|
|
|
05-28-2015, 04:13 AM
|
#58
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
what do you mean all your life based on a lie?
ok thanks for looking into it. I'm sure you will be able to do it
|
|
|
05-28-2015, 04:19 AM
|
#59
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@heda
I really thought these nice feature was already in place
Ok, maybe not all my life depends on that. But still !
The script basics is already in place, need to find how to process the rounding to frame duration ! (is more complex that just using "floor" functions :P)
EDIT: It's done. Release soon.
Last edited by X-Raym; 05-28-2015 at 05:14 AM.
|
|
|
05-28-2015, 04:28 AM
|
#60
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by G-Sun
Sorry for the late follow up.
Yes, I'm missing "Quantize stretch markers by X percent towards grid" in Reaper.
Do you know if the stretch-markers are accessible for you?
BTW: Great work with the items and env.-points
|
Thanks!
Here's a "Quantize tool for stretch markers"
http://forum.cockos.com/showthread.p...84#post1415584
(haven't done any updates to it lately - been too busy
@heda and X-Raym,
I haven't tested BR_GetClosestGridDivision yet, but if you solve the "frame grid" -problem, please post it here
|
|
|
05-28-2015, 05:23 AM
|
#61
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
It is basically done
Currently, it snap end and pos to grid. Nice !
BUT it loop items if item was section (or if it goes to end source).
So two possibilities for quantize avoiding looping:
- expand items section boundaries
- quantize one frame less (go to the smallest length result for the item).
I think the second solution is better, as it will not include undesired audio content. (no surprise... exept a drop maybe ^^).
What do you think of that ?
EDIT: more complex would be quantize expanding section if any, and not looping if end of source. But this is more difficult. :P
---
I just release the action as: Quantize selected items start and end to closest frame inside them
It is in my script pack, in Items Editing.
we could imagine variations of that (moving content, section expansion, but this will be the most common case I guess).
Last edited by X-Raym; 05-28-2015 at 05:57 AM.
Reason: renamed
|
|
|
05-28-2015, 05:43 AM
|
#62
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
mmmm I don'0t use looped video items.. but I see the issue
I think the best would be to have both options as two scripts
|
|
|
05-28-2015, 05:48 AM
|
#63
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@heda
Yep, I guess quantize to frame is needed mainly for video items or subtitles.
So I released a first version: Quantize selected items start and end to closest frame inside them
This is optimized for video items.
Tell me if it works for you
(EDIT: Just added: Quantize selected items start and end to closest frame for text items )
Last edited by X-Raym; 05-28-2015 at 06:17 AM.
|
|
|
05-28-2015, 06:18 AM
|
#64
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
excellent excellent excellent.. it works perfectly.. Thank you
now I can export my project to a video editor
|
|
|
05-28-2015, 06:21 AM
|
#65
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@heda
Nice
Perfect for karaoke :P
note : I just updated Quantize selected items start and end to closest frame one second ago, there was a small rounding error (it was only rounding to upper value). Now it rounds to closest.
I strongly advice you to use SWS/FNG Clean selected overlapping items on same track after if you quantize on a subtitle tracks.
|
|
|
05-28-2015, 06:33 AM
|
#66
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
You're in luck because I'm subscribed to this thread
I'll look into fixing all SWS stuff (both actions and ReaScript function) regarding frames for the next build. Please report this kind of stuff on our thread or issue tracker so it doesn't get missed.
Last edited by Breeder; 05-28-2015 at 06:59 AM.
|
|
|
05-28-2015, 06:43 AM
|
#67
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
@X-raym: good, I don't know what are you doing but in my case I don't see the need to run the SWS/FNG Clean selected overlapping items. why do you recommend it?
@Breeder. Thanks. Yes I was going to report it in the SWS thread or github today but I'm multitasking and I forgot it. Lucky that you are here
|
|
|
05-28-2015, 07:05 AM
|
#68
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@heda
To be sure there is no overlapping items (undesired in case of subtitles for examples)
It was perfectly clear for me when I wrote this advice that quantize could make items overlap. While trying to gave you examples, I realize that it cannot, if the items weren't overlapping already :P
Anyway, it is a good actions for subtitles anyway, if you create subtitles from audio items/take name (as I do for project recorded in REAPER (my audios items are named with the dialog line it contains)), as audio items can overlap.
|
|
|
05-28-2015, 08:18 AM
|
#69
|
Human being with feelings
Join Date: May 2010
Location: Norway
Posts: 7,318
|
Quote:
Originally Posted by X-Raym
@g-sun
I may be wrong but I think there is a script for that out there.
|
Quote:
Originally Posted by spk77
Thanks!
Here's a "Quantize tool for stretch markers"
http://forum.cockos.com/showthread.p...84#post1415584
(haven't done any updates to it lately - been too busy
@heda and X-Raym,
I haven't tested BR_GetClosestGridDivision yet, but if you solve the "frame grid" -problem, please post it here
|
Thanks a lot!
Awesome
__________________
Reaper x64, win 11
Composer, text-writer, producer
Bandcamp
|
|
|
09-06-2015, 09:19 AM
|
#70
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Update on 6-Sep-2015 - Now it uses BR_GetClosestGridDivision to get the closest grid
- removed unnecessary code
Download from post#1
|
|
|
11-04-2017, 10:08 AM
|
#71
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Is it possible to easily alter the script to quantize MIDI notes?
What I plan to do is, having Actions for:
- Quantize Notes by 20%
- Quantize Notes by 50%
- Quantize Notes by 70%
etc...
Last edited by _Stevie_; 11-04-2017 at 12:33 PM.
|
|
|
11-04-2017, 11:16 AM
|
#72
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Okay, this is a lot fishing in the gloomy, I have to admit, since I haven't really started with scripting in EEL or LUA.
But here is what I got already:
- GUI revmoved
- the value after pos - XX / 100... defines the quantize strength
- the script is still based on Items and not MIDI Notes
Could anyone enlighten me how to modify it for MIDI?
What I did was replacing CountSelectedMediaItems with MIDI_EnumSelNotes, etc...
But I get an error, that the function expects two variables.
Code:
/**
* ReaScript Name: Quantize items to grid using item snap offset
* Description: See title.
* Instructions: Assign the script to a keyboard shortcut, and load it into MIDI actions, from the MIDI editor Action window.
* Author: spk77
* Author URI:
* Repository:
* Repository URI:
* File URI:
* Licence: GPL v3
* Forum Thread: EEL: Quantize tool (for item positions)
* Forum Thread URI: http://forum.cockos.com/showthread.php?t=145243
* REAPER: 5.0
* Extensions: SWS/S&M 2.6.3 #0
* Version: 1.0
*/
/**
* Changelog:
* v1.0 (2015-02-10)
+ Initial release
*/
//// Quantize tool - EEL script by spk77 28.8.2014
//
// - slider values from 0% to 100% -> quantizes selected items (positions) by X percent towards grid
// - slider values from 0% to -100% -> unquantizes selected items (positions) by X percent away from grid
// - ctrl + z to undo
// - esc to close
function quantize() local (item, pos)
(
sel_item_array_created == 0 ? (
memset(sel_item_array, 0, sel_item_count*2);
sel_item_count = 0;
i_i = 0;
loop(CountSelectedMediaItems(0),
item = GetSelectedMediaItem(0, i_i);
pos = GetMediaItemInfo_Value(item, "D_POSITION") + GetMediaItemInfo_Value(item, "D_SNAPOFFSET");
sel_item_array[i_i * 2] = item;
sel_item_array[i_i * 2 + 1] = pos;
sel_item_count += 1;
i_i += 1;
);
sel_item_array_created = 1;
);
GetToggleCommandState(1157) ? (
snap = 1;
) : (
snap = 0;
Main_OnCommand(1157, 0);
);
GetToggleCommandState(40145) ? (
grid = 1;
) : (
grid = 0;
Main_OnCommand(40145, 0);
);
i = 0;
loop(sel_item_count,
item = sel_item_array[i * 2];
pos = sel_item_array[i * 2 + 1];
SetMediaItemInfo_Value(item, "D_POSITION", pos - 50 / 100 * (pos - (SnapToGrid(0, pos))) - GetMediaItemInfo_Value(item, "D_SNAPOFFSET"));
i += 1;
);
undo_block = 1;
snap == 0 ? Main_OnCommand(1157, 0);
grid == 0 ? Main_OnCommand(40145, 0);
);
//UpdateArrange();
quantize();
Last edited by _Stevie_; 11-04-2017 at 12:35 PM.
|
|
|
11-12-2019, 07:52 AM
|
#73
|
Human being with feelings
Join Date: Apr 2017
Posts: 15
|
This is super helpful. Thank you!
|
|
|
04-28-2020, 10:12 AM
|
#74
|
Human being with feelings
Join Date: Sep 2009
Posts: 18
|
Script not working anymore
Hey, I was trying to use the script today (2020), but when i press the control slider, it jumps back to the original position.
Does anyone know how to fix it?
Thanks a lot
Last edited by body0017; 04-28-2020 at 10:21 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 09:45 AM.
|