Old 08-28-2014, 06:49 AM   #1
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default EEL: Quantize tool (for item positions)

Quantize tool
  • 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

Updates
  • 6-Sep-2015
    • Now it uses BR_GetClosestGridDivision to get the closest grid
    • removed unnecessary code


Download:
https://stash.reaper.fm/21649/Quantiz...%20percent.eel



Last edited by spk77; 09-06-2015 at 09:17 AM.
spk77 is offline   Reply With Quote
Old 08-28-2014, 07:00 AM   #2
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,318
Default

Cool
Stretch-markers?
__________________
Reaper x64, win 11
Composer, text-writer, producer
Bandcamp
G-Sun is offline   Reply With Quote
Old 08-28-2014, 07:04 AM   #3
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by G-Sun View Post
Cool
Stretch-markers?
Thanks Hmm.. what do you mean by "stretch-markers"?

Edit: Is that "Quantize stretch markers by X percent towards grid"?

Last edited by spk77; 08-28-2014 at 07:14 AM.
spk77 is offline   Reply With Quote
Old 08-28-2014, 07:06 AM   #4
sinkmusic
Human being with feelings
 
sinkmusic's Avatar
 
Join Date: Feb 2006
Location: decepticon mothership in a hidden place inside a mountain
Posts: 3,754
Default

Very nice !
sinkmusic is online now   Reply With Quote
Old 08-28-2014, 10:02 AM   #5
beingmf
Human being with feelings
 
beingmf's Avatar
 
Join Date: Jul 2007
Location: Jazz City
Posts: 5,065
Default

unbelieveable!!!
__________________
Windows 10x64 | AMD Ryzen 3700X | ATI FirePro 2100 | Marian Seraph AD2, 4.3.8 | Yamaha Steinberg MR816x
"If I can hear well, then everything I do is right" (Allen Sides)
beingmf is offline   Reply With Quote
Old 08-28-2014, 10:15 AM   #6
sinkmusic
Human being with feelings
 
sinkmusic's Avatar
 
Join Date: Feb 2006
Location: decepticon mothership in a hidden place inside a mountain
Posts: 3,754
Default

What is the .EEL extension ?
Where do you put it ?
How do you use it ? (where do you find it in the Reaper menu) ?
Thank you
sinkmusic is online now   Reply With Quote
Old 08-28-2014, 10:36 AM   #7
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Thanks everyone

Quote:
Originally Posted by sinkmusic View Post
What is the .EEL extension ?
Where do you put it ?
How do you use it ? (where do you find it in the Reaper menu) ?
Thank you
Save the ".eel" file to your computer (my EEL scripts are in C:\EEL scripts) -> Load from the action list:

spk77 is offline   Reply With Quote
Old 08-28-2014, 01:33 PM   #8
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by spk77 View Post
[*]"Snap to grid" has to be on
You could use something like this:
Code:
function SnapToGridAlt (position) local (gridLine, setSnap, setGridVis)
(
	setSnap    = GetToggleCommandState(1157)  ? (0) : (Main_OnCommand(1157,  0); 1);  // Options: Toggle snapping
	setGridVis = GetToggleCommandState(40145) ? (0) : (Main_OnCommand(40145, 0); 1);  // Options: Toggle grid lines

	gridLine = SnapToGrid(0, position);
	setSnap    ? Main_OnCommand(1157,  0);
	setGridVis ? Main_OnCommand(40145, 0);
	gridLine;
);
We use the same thing in SWS, but we're modifying the settings directly. However, that doesn't seem possible in EEL so toolbar buttons will blink...heh
Breeder is offline   Reply With Quote
Old 08-28-2014, 02:23 PM   #9
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Updated the file:
  • Snap to grid and (Show) grid lines can be on or off (Thanks Breeder!)


Quote:
Originally Posted by Breeder View Post
We use the same thing in SWS, but we're modifying the settings directly. However, that doesn't seem possible in EEL so toolbar buttons will blink...heh
Hmm...it blinks only when both "Snap to grid" and "(Show) grid lines" are off.
spk77 is offline   Reply With Quote
Old 08-28-2014, 06:14 PM   #10
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,924
Default

Nice one spk!!

-another one for my cache of useful tools by spk77



>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is offline   Reply With Quote
Old 08-29-2014, 12:13 AM   #11
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

"Unquantize" doesn't do anything if item(s) are exactly on the grid. Maybe there should be a button which would offset items from the closest gridline by +X seconds or -X seconds. Then a slider for setting the range for "X". "X" would be a random value between 0 and the "slider value".

It could be used for "humanizing".


Quote:
Originally Posted by planetnine View Post
Nice one spk!!

-another one for my cache of useful tools by spk77



>
Thanks planetnine
spk77 is offline   Reply With Quote
Old 08-29-2014, 01:44 PM   #12
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Argentina
Posts: 1,303
Default

Quote:
Originally Posted by spk77 View Post
It could be used for "humanizing".
Anything that could be used for humanizing would be extremely welcome, Spk!

Thanks as ever for this and all the wonderful goodies.
Soli Deo Gloria is offline   Reply With Quote
Old 08-29-2014, 02:00 PM   #13
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Argentina
Posts: 1,303
Default

Quote:
Originally Posted by G-Sun View Post
Cool
Stretch-markers?
Regarding G-Sun comment, I´m thinking about something that leads me to these questions :

- Could you device a script to "Slice selected MIDI items at notes"?

-Do you think that this randomness that you´ve been thinking about could be applied to stretch both edges of a MIDI item? For example :

- Randomly stretch left/right borders of selected MIDI items.
- This would ideally have a percentage of randomness for each border and a "bias", as in the humanize dialog of the ME, to define a positive/negative tendency.
- There must be more subtleties, but it´s just the first mental sketch...

And yes, you surely realize that I´m trying to get close to my former humanizing request... Anyway, if it´s not possible, the slicing script would be incredibly useful!

Thanks in advance!!
Soli Deo Gloria is offline   Reply With Quote
Old 08-29-2014, 03:04 PM   #14
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Soli Deo Gloria View Post
Regarding G-Sun comment, I´m thinking about something that leads me to these questions :

- Could you device a script to "Slice selected MIDI items at notes"?

-Do you think that this randomness that you´ve been thinking about could be applied to stretch both edges of a MIDI item? For example :

- Randomly stretch left/right borders of selected MIDI items.
- This would ideally have a percentage of randomness for each border and a "bias", as in the humanize dialog of the ME, to define a positive/negative tendency.
- There must be more subtleties, but it´s just the first mental sketch...

And yes, you surely realize that I´m trying to get close to my former humanizing request... Anyway, if it´s not possible, the slicing script would be incredibly useful!

Thanks in advance!!
Hi Soli Deo Gloria,

It might be even easier to move items around than moving/resizing notes in the MIDI editor. Each item has its own unique ID. MIDI notes/CCs don't have - it's very difficult to keep track of which note/cc is currently being manipulated (in a loop).

Have to do some testing - first I'm trying to make a "split at MIDI notes" script.
spk77 is offline   Reply With Quote
Old 08-29-2014, 03:28 PM   #15
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Hmmm...How should this be sliced?

spk77 is offline   Reply With Quote
Old 08-29-2014, 08:45 PM   #16
Soli Deo Gloria
Human being with feelings
 
Soli Deo Gloria's Avatar
 
Join Date: Oct 2013
Location: Argentina
Posts: 1,303
Default

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!
Soli Deo Gloria is offline   Reply With Quote
Old 10-10-2014, 02:38 PM   #17
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Wow! This is a gem! It should definitely be sticky! Thanks a lot spk77!!!

Is it possible to make a similar tool but for stretch markers?
amagalma is offline   Reply With Quote
Old 10-10-2014, 03:12 PM   #18
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by amagalma View Post
Wow! This is a gem! It should definitely be sticky! Thanks a lot spk77!!!

Is it possible to make a similar tool but for stretch markers?
Thanks! I'm sure it's possible to make a similar tool for stretch markers, but I don't know how difficult it would be - have to do some investigating/thinking
spk77 is offline   Reply With Quote
Old 10-11-2014, 05:15 AM   #19
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

If it can be done, I am sure you can do it! If you cannot do it, then it cannot be done!
amagalma is offline   Reply With Quote
Old 10-11-2014, 03:25 PM   #20
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by amagalma View Post
If it can be done, I am sure you can do it! If you cannot do it, then it cannot be done!
Yay, it seems to be doable
spk77 is offline   Reply With Quote
Old 10-11-2014, 03:54 PM   #21
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

!!! Oh man! You are amazing!!!

Looking forward to using it!
amagalma is offline   Reply With Quote
Old 10-11-2014, 03:57 PM   #22
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,924
Default

That's got to be very useful.

Now, can "groove" (as in fingers groove tool) be applied to stretch markers in varying percentages? There's a project for you spk



>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is offline   Reply With Quote
Old 10-11-2014, 04:02 PM   #23
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by amagalma View Post
!!! Oh man! You are amazing!!!

Looking forward to using it!
I'm going to post it tomorrow - have to fix the obvious bugs first .

(Currently it doesn't work if "item position is something else than 0" etc.)
spk77 is offline   Reply With Quote
Old 10-11-2014, 04:18 PM   #24
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by planetnine View Post
That's got to be very useful.

Now, can "groove" (as in fingers groove tool) be applied to stretch markers in varying percentages? There's a project for you spk



>
Maybe, maybe


This loop is the "setting a stretch marker position" -part:
(slider_val range is -100 to 100)
Code:
i = 0;
loop(num_sm,
  pos = sm_positions[i * 2];
  source_pos = sm_positions[i * 2 + 1];
  new_pos = pos - slider_val / 100 * (pos - SnapToGrid(0, pos));
  SetTakeStretchMarker(take, i, new_pos, source_pos);
  i += 1;
);
I have to include "item position" into that loop to make it work, I think.
spk77 is offline   Reply With Quote
Old 10-11-2014, 04:19 PM   #25
sinkmusic
Human being with feelings
 
sinkmusic's Avatar
 
Join Date: Feb 2006
Location: decepticon mothership in a hidden place inside a mountain
Posts: 3,754
Default

Very interesting, thank you so much.
sinkmusic is online now   Reply With Quote
Old 10-12-2014, 03:39 AM   #26
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Insane !
vanhaze is offline   Reply With Quote
Old 10-12-2014, 05:56 AM   #27
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Changed this:
Code:
new_pos = pos - slider_val / 100 * (pos - SnapToGrid(0, pos));
to this:
Code:
new_pos = pos - slider_val / 100 * (item_pos + pos - SnapToGrid(0, item_pos + pos));
Now it seems to work. Creating a new thread...

Edit. Here's the thread:
"EEL: Quantize tool for stretch markers" - http://forum.cockos.com/showthread.p...84#post1415584

Last edited by spk77; 10-12-2014 at 06:11 AM.
spk77 is offline   Reply With Quote
Old 01-31-2015, 07:08 PM   #28
Casperfren
Human being with feelings
 
Join Date: Apr 2013
Posts: 30
Default

This is awesome!

Can`t get it to work. Is this only for pc? I have mac
Casperfren is offline   Reply With Quote
Old 02-01-2015, 09:37 AM   #29
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Casperfren View Post
This is awesome!

Can`t get it to work. Is this only for pc? I have mac
Thanks! It should work on pc and mac (REAPER 4.76).
spk77 is offline   Reply With Quote
Old 02-06-2015, 01:24 PM   #30
Salem Beats
Human being with feelings
 
Salem Beats's Avatar
 
Join Date: Sep 2013
Location: Salem, Oregon
Posts: 61
Default

This is very impressive.

Do you think that it's possible for your code to do the same thing with envelope points?

I've been using my Launchpad to "play" Sugar Bytes' Turnado (with any given button turning an effect on/off via automation), but I've been needing to quantize my automation in order to get the final effect I'm after.

As it stands right now, the most effective method is to go through each of the points with the grid turned on and wiggle it left and right a bit while being careful not to move it up or down.

I've been looking around for any method of selecting an envelope and quantizing its points without any luck, so I understand if you're not able to come up with anything.
Salem Beats is offline   Reply With Quote
Old 02-06-2015, 02:07 PM   #31
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Salem Beats View Post
This is very impressive.

Do you think that it's possible for your code to do the same thing with envelope points?

I've been using my Launchpad to "play" Sugar Bytes' Turnado (with any given button turning an effect on/off via automation), but I've been needing to quantize my automation in order to get the final effect I'm after.

As it stands right now, the most effective method is to go through each of the points with the grid turned on and wiggle it left and right a bit while being careful not to move it up or down.

I've been looking around for any method of selecting an envelope and quantizing its points without any luck, so I understand if you're not able to come up with anything.

Thanks.

Envelope point manipulation is not currently possible, but will be in the future
spk77 is offline   Reply With Quote
Old 02-07-2015, 01:13 AM   #32
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Salem Beats View Post
This is very impressive.

Do you think that it's possible for your code to do the same thing with envelope points?

I've been using my Launchpad to "play" Sugar Bytes' Turnado (with any given button turning an effect on/off via automation), but I've been needing to quantize my automation in order to get the final effect I'm after.

As it stands right now, the most effective method is to go through each of the points with the grid turned on and wiggle it left and right a bit while being careful not to move it up or down.

I've been looking around for any method of selecting an envelope and quantizing its points without any luck, so I understand if you're not able to come up with anything.

Here's a quick test:
(This is possible with the latest pre-release)

Last edited by spk77; 02-07-2015 at 01:21 AM.
spk77 is offline   Reply With Quote
Old 02-07-2015, 02:43 AM   #33
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 14,214
Default

awesome!
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
musicbynumbers is offline   Reply With Quote
Old 02-07-2015, 11:20 AM   #34
Salem Beats
Human being with feelings
 
Salem Beats's Avatar
 
Join Date: Sep 2013
Location: Salem, Oregon
Posts: 61
Default

Quote:
Originally Posted by spk77 View Post
Here's a quick test:
(This is possible with the latest pre-release)
Wow, that's great!
I have a copy of the latest pre-release on my laptop for testing.
Any chance of getting my hands on that awesome extension?
Salem Beats is offline   Reply With Quote
Old 02-07-2015, 11:51 AM   #35
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by spk77 View Post
Envelope point manipulation is not currently possible, but will be in the future
Huh? I already have a few scripts to quantize automation envelope points, based on something Veto created which is posted somewhere else on this forum.

This approach is based on using 'chunks', though - so I was planning to redo some of that stuff using some of the new API functions. But I'd be very happy to have you ninja me on that one, spk88.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-07-2015, 02:20 PM   #36
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Salem Beats View Post
Wow, that's great!
I have a copy of the latest pre-release on my laptop for testing.
Any chance of getting my hands on that awesome extension?
I'm going to upload it very soon. (in the pre-release section)

Quote:
Originally Posted by Banned View Post
Huh? I already have a few scripts to quantize automation envelope points, based on something Veto created which is posted somewhere else on this forum.

This approach is based on using 'chunks', though - so I was planning to redo some of that stuff using some of the new API functions. But I'd be very happy to have you ninja me on that one, spk88.
I think it's not possible to make these kind of "realtime" tools by editing values in "chunks". Manipulating envelopes by using these new functions is a much faster way.

-spk99
spk77 is offline   Reply With Quote
Old 02-07-2015, 02:31 PM   #37
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by spk77 View Post
I think it's not possible to make these kind of "realtime" tools by editing values in "chunks". Manipulating envelopes by using these new functions is a much faster way.
Indeed. But reading Salem Beats's post, I think he would already be greatly helped by an *inefficient* tool that just hard-quantizes everything to the grid with a few clicks.

Looking forward to see your script.

Btw, it seems we're still short of a solution for *actual* real-time quantization of parameter automation in REAPER (so e.g. Salem Beats could just play his LaunchPad live, and never worry about having to go back and edit stuff at all). I do this all the time in Numerology, using 'sample & hold' modules which are triggered by quantized clock pulses, and really can't live without it.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-07-2015, 02:49 PM   #38
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Banned View Post
Indeed. But reading Salem Beats's post, I think he would already be greatly helped by an *inefficient* tool that just hard-quantizes everything to the grid with a few clicks.

Looking forward to see your script.

Btw, it seems we're still short of a solution for *actual* real-time quantization of parameter automation in REAPER (so e.g. Salem Beats could just play his LaunchPad live, and never worry about having to go back and edit stuff at all). I do this all the time in Numerology, using 'sample & hold' modules which are triggered by quantized clock pulses, and really can't live without it.
Here's the script:
http://forum.cockos.com/showpost.php...&postcount=171

I hope the "package handling" in the main script is working

("Quantize points 100% to grid" without a GUI would be a quite simple script.)
spk77 is offline   Reply With Quote
Old 02-07-2015, 03:09 PM   #39
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by spk77 View Post
I think it's not possible to make these kind of "realtime" tools by editing values in "chunks". Manipulating envelopes by using these new functions is a much faster way.

-spk99
All SWS envelope stuff (a lot of S&M stuff is using chunks too, Jeffos has a dedicated parser class just for that) was working with chunks up until now (new SWS build will reuse new envelope API to make stuff much faster) and in all but most extreme testing cases things felt smooth. I know it's C++ so it pretty efficient but it's still a testament that chunks don't have to be that slow. Of course, I'm all for chunk-free coding...but don't be afraid of the chunks if you need them

There is one big plus to using chunks btw - you don't have to wait for devs to implement new API for added functionality since chunks automatically "upgrade" (my guess is because those same chunks are used to save things to .rpp files)
Breeder is offline   Reply With Quote
Old 02-07-2015, 03:31 PM   #40
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Breeder View Post
All SWS envelope stuff (a lot of S&M stuff is using chunks too, Jeffos has a dedicated parser class just for that) was working with chunks up until now (new SWS build will reuse new envelope API to make stuff much faster) and in all but most extreme testing cases things felt smooth. I know it's C++ so it pretty efficient but it's still a testament that chunks don't have to be that slow. Of course, I'm all for chunk-free coding...but don't be afraid of the chunks if you need them

There is one big plus to using chunks btw - you don't have to wait for devs to implement new API for added functionality since chunks automatically "upgrade" (my guess is because those same chunks are used to save things to .rpp files)
Thanks for the information, Breeder!


Random babbling :
(The biggest bottleneck is my computer: "hp pavilion a320.fi" - I don't actually do any serious work with Reaper (or any other DAW). We have a newer computer (Win8) in our rehearsal place where we sometimes try to record our own songs.)
spk77 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:30 PM.


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