Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 05-21-2021, 06:02 PM   #1
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default New Script: Pro Tools style Paste To Fill - Razor Edits - Updated to v1.1

I know there have been a few solutions to this in Reaper, but I really wanted something that was more closely aligned with the way Pro Tools handles this. So I present to you my paste-to-fill script. This works for items and envelope lanes.


v1.1 - Pasting to multiple Razor Edits for envelopes: Note that creating the Razor Edit areas in the envelope lanes for the selected items is not part of this script.


v1.1 - Pasting to multiple Razor Edits for items:


v1.1 - Pasting within items:



--------------------------Original Post-----------------------------


Here's the script in action working with items:

Easier to see if you go to the link:
https://postimg.cc/jwYd23hT

Here's the script in action working with envelope lanes:

Easier to see if you go to the link:
https://postimg.cc/1n0Rq0Wq

Here are a few examples of current limitations. Note, in its current state, this script will only work on one track at a time.

Easier to see if you go to the link:
https://postimg.cc/jDWsXYgK

It works essentially like Pro Tools. It will fill the razor area by looping whatever is in the buffer/clipboard. There are various options in the script to handle crossfades. You can choose to not create crossfades at all, or define a custom crossfade length, or have the crossfade length be determined by your Reaper preferences. Crossfades leading into and out of the 'razor area' can be a different length than the crossfades IN the area. If fades exist on boundary items (I.E., the item just to the left and right of your selection) you can choose to retain those fades or wipe them out to create crossfades. Pasted items can have their takes randomly slipped left/right by a user-definable value. This is good fun when creating ambiences

v1.1 posted
- NEW - Support for pasting to multiple Razor Edit areas
- NEW - Option to retain original Razor Edit areas

- BUGFIX - Fixed bug when pasting within an item (I.E., when not pasting in 100% empty space)

Code:
--USER OPTIONS--
local leaveCursorLocation = 0       -- 0 = Initial Position
                                    -- 1 = Selection Start
                                    -- 2 = Selectin End
                                          
local fadeLength = 0.1              -- This is the default value to use for crossfade length. This will be overridden if 'useDefaultFadeLength' is set to true.
local useDefaultFadeLength = false  -- If set to true, fade length will be set to the value set in preferences:
                                    -- Preferences --> Project --> Media Item Defaults --> Create automatic fade-in/fade-out for new items, length

local adjustFillFadeBy = 0          -- Adjust fades in the fill area. 
                                    -- Positive numbers will lengthen the fade, negative numbers will shorten the fade.
                                    -- This is helpful when you want the fades LEADING INTO THE AREA to have a different length than the fades IN THE AREA. 
                                    
                                    -- Note that the crossfade shape/curve will always be what ever is set in preferences:
                                    -- Preferences --> Proejct --> Media Item Defaults --> Default Crossfade Shape
                                    
local preserveFades = false         -- If set to true, then fades on existing items at the boundries of the razor edit area will be preserved.

local addFadeToAreaBoundry = true   -- If set to true then fade in/out will be created on the fist/last item in the razor area if there are no area boundry items.
                                    -- Will also add fade in/out when 'preserveFades' is set to true.
                                    
local randomSlipAmount = 0          -- If set to a number higher than zero, this will slip/nudge the 'content' in each media item randomly by the amount set. 
                                    -- Tha value set here is the max value the item content will be slipped/nudged.
                                    -- Slip/Nudge will randomly choose whether the content is slipped to the left or right.
                                    
local preventSmallItems = true      -- If set to true, this will prevent items smaller than the fadeLength * 2. 
                                    -- This is helpful to prevent small items with overlapping fade boundries.

local restoreRazorEdits = true      -- If set to true, this will restore the original Razor Edits. 
                                    -- If set to false, then all Razor Edits will be cleared.
Attached Files
File Type: lua MRX_PasteItemToFill_Items_and_EnvelopeLanes.lua (46.4 KB, 205 views)

Last edited by benmrx; 05-24-2021 at 09:31 AM.
benmrx is offline   Reply With Quote
Old 05-22-2021, 03:17 AM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

This is definitely deserve to be on reapack!
X-Raym is offline   Reply With Quote
Old 05-22-2021, 09:36 AM   #3
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 463
Default

I was just looking for this function in reaper, and now I don’t have to build it myself! Awesome!
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!
sonictim is offline   Reply With Quote
Old 05-22-2021, 11:09 AM   #4
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by X-Raym View Post
This is definitely deserve to be on reapack!
Thank you!! I'm planning on looking into getting set up with Reapack next week. I still need to get a GitHub account and go through the whole process. Sonictim posted some great info on getting set up with Reapack in a different thread. Hopefully, I can figure it out. lol.

Quote:
Originally Posted by sonictim View Post
I was just looking for this function in reaper, and now I don’t have to build it myself! Awesome!
I hope it works out for you! Let me know if you run into any issues
benmrx is offline   Reply With Quote
Old 05-22-2021, 08:46 PM   #5
_iU
Human being with feelings
 
Join Date: Nov 2008
Posts: 24
Default

Nice, how do you razor select empty space between items?
_iU is offline   Reply With Quote
Old 05-22-2021, 10:20 PM   #6
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by _iU View Post
Nice, how do you razor select empty space between items?
That's another script

I have it set on the mouse modifier 'track ---> double click'. I'm gonna clean it up real quick and fix a bug I know exists and then I'll post it.

EDIT
I posted the script here for enclosing empty areas in Razor Edits: https://forum.cockos.com/showthread.php?t=253894

Last edited by benmrx; 05-23-2021 at 12:04 AM.
benmrx is offline   Reply With Quote
Old 05-23-2021, 07:41 AM   #7
_iU
Human being with feelings
 
Join Date: Nov 2008
Posts: 24
Default

Thanks a lot!
_iU is offline   Reply With Quote
Old 05-24-2021, 09:02 AM   #8
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Script updated to v1.1 in original post

-NEW: Can now paste to multiple Razor Edit ares
-NEW: option to retain original Razor Edit areas
-BUGFIX: when pasting within an item


Pasting to multiple Razor Edits for envelopes: Note that creating the Razor Edit areas in the envelope lanes for the selected items is not part of this script.


Pasting to multiple Razor Edits for items:


Pasting within items:



I'm SUPER stoked on this. You can now paste to multiple Razor Edit areas. This is true for pasting items as well as envelopes. Note that in its current state, the script only supports a single envelope. So, you can paste from Volume to volume, or pan to pan, or even volume to pan, but not volume AND pan at the same time.

Also, now by default, the script will retain your original Razor Edit areas. This is fantastic when pasting to envelopes!!!!

Also made a bug fix when pasting within an item. I.E., when not pasting in 100% empty space.

Last edited by benmrx; 05-25-2021 at 12:15 PM.
benmrx is offline   Reply With Quote
Old 05-25-2021, 11:28 AM   #9
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

This is next gen editing, not sure the world is ready haha :P
X-Raym is offline   Reply With Quote
Old 05-25-2021, 11:50 AM   #10
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by X-Raym View Post
This is next gen editing, not sure the world is ready haha :P
Thank you!! I learned so much from peeking into your scripts.. so thank you for that as well! I'm still getting my head wrapped around 'lua'. It feels like 'anarchy' compared to C#. But I'm sure C# feels like anarchy when compared to C++.

I SOOOO wish I had this when I was doing more 'long form' post-production work (like films, episodics, etc.)

FWIW, I want to finish a few more scripts (mostly to do with Razor Edits..., can you tell I'm in love with Razor Edits yet.lol) and then re-visit this. It needs to support multiple envelope lanes and multiple items. Because once that is in place, you could build some crazy stuff... like an 'ambience creator'. For example, it could add wind, a river in the distance, bird/frog/cricket variations, the occasional bee whizzing by, etc.

I also want to add some kind of 'preset' system. So for example if you were adding room tone to dialogue, and you had something else in the buffer/clipboard, you wouldn't have to re-select the room tone and copy it back into the clipboard. Or if you were working on different scenes. You could have everything for the 'Living Room' scene in one preset, everything for the 'Warehouse' scene in another preset, 'Beach' in another preset, etc.
benmrx is offline   Reply With Quote
Old 05-25-2021, 02:06 PM   #11
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 463
Default

Just an idea... What you did is very protools! Awesome! I love it... It's totally what I'm used to

But... perhaps a more reaper approach would be....

Since your script requires to only have 1 item in your clipboard, why not LOOP the section of the item to the length of the razor selections?

Pitfall, your loop may not be perfect and have pops at the loop point (hence the multicrossfade protools style paste makes more sense).

Thoughts?
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!
sonictim is offline   Reply With Quote
Old 05-25-2021, 02:19 PM   #12
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by sonictim View Post
Just an idea... What you did is very protools! Awesome! I love it... It's totally what I'm used to

But... perhaps a more reaper approach would be....

Since your script requires to only have 1 item in your clipboard, why not LOOP the section of the item to the length of the razor selections?

Pitfall, your loop may not be perfect and have pops at the loop point (hence the multicrossfade protools style paste makes more sense).

Thoughts?
Thanks! Yeah, I LOVE the way Pro Tools built this feature. I HATE HATE HATE the way Nuendo built this feature. My goal was to get this to a point where it behaved like Pro Tools, and then once that's in place start adding more 'reaper'esque' options. I have a dream.... the ambience creator. And this is the first baby step towards that.

Pitfall, as you mentioned. I don't want to have to make sure that what is in the clipboard is a seamless loop. I want to 'willy nilly' grab some content and do a 'fill', and not care if it loops.

Also, the script has a 'random slip' option, so it can randomly slip each of the pasted items to create a quick background with some variation.

Say you have 3 files.
-Wind
-Birds
-Frogs

You could do a standard 'paste to fill' with the wind. Then turn on 'random slip' and do 'paste to fill' with the birds and frogs.

Once I get some more utility scripts done I want to revisit this and make it so you can have more than one item in the clipboard.
Also, I want to add an option to this script because I don't want a crossfade to be created where it trims the item PAST/BEFORE the source content. This is my biggest beef with Reaper. I.E., I don't ever want a crossfade, where part of that crossfade is influenced by digital silence. I want this script to pop up a message box asking if you want the script to adjust the fade bounds for you. If you know Pro Tools, I'm sure you know the message box I'm referring to.

FYI, the 'Reaper Blog' did a video that does a 'paste to fill' where it DOES loop the item here: https://www.youtube.com/watch?v=si4pfez0oiM

Last edited by benmrx; 05-25-2021 at 02:26 PM.
benmrx is offline   Reply With Quote
Old 05-25-2021, 02:54 PM   #13
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 463
Default

Quote:
Originally Posted by benmrx View Post
If you know Pro Tools, I'm sure you know the message box I'm referring to.
One of my happiest days was when I learned that there is an option to turn that message box OFF! I don't miss it!
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!
sonictim is offline   Reply With Quote
Old 05-25-2021, 03:10 PM   #14
plush2
Human being with feelings
 
Join Date: May 2006
Location: Saskatoon, Canada
Posts: 2,110
Default

Quote:
Originally Posted by sonictim View Post
One of my happiest days was when I learned that there is an option to turn that message box OFF! I don't miss it!
Pro Tools - "Adjust bounds? I mean I'm not going to crossfade for you without doing it anyways but I want you to know I'm doing something so please click here"

That message box?

This script looks amazing and I love your idea for an ambience creator. Has the script found its way into ReaPack yet? I didn't see mention of that above.
plush2 is online now   Reply With Quote
Old 05-25-2021, 03:39 PM   #15
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by sonictim View Post
One of my happiest days was when I learned that there is an option to turn that message box OFF! I don't miss it!
Quote:
Originally Posted by plush2 View Post
Pro Tools - "Adjust bounds? I mean I'm not going to crossfade for you without doing it anyways but I want you to know I'm doing something so please click here"

That message box?

This script looks amazing and I love your idea for an ambience creator. Has the script found its way into ReaPack yet? I didn't see mention of that above.
HAHA. I personally would rather know that my crossfades are 100% actually crossfading content rather than crossfading .... whatever happens to be at that point in the item, which could be digital silence. I'll make sure that the message box is optional. lololol.

Not on Reapack... yet. I'm a slacker. I still don't have a Github account or anything.
benmrx is offline   Reply With Quote
Old 05-26-2021, 09:07 AM   #16
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 463
Default

Quote:
Originally Posted by benmrx View Post
Pitfall, as you mentioned. I don't want to have to make sure that what is in the clipboard is a seamless loop. I want to 'willy nilly' grab some content and do a 'fill', and not care if it loops.



There is this section of Item Properties that controls the loop when you drag it.. There are options for start, length, and fade... I bet you could take your item you want to loop, add half the fade amount to the start time and subtract half the fade amount from the length and then when it loops, it would be exactly what you put into the copy buffer with a nice crossfade

I'm not exactly sure how to set it all with the reascript API, but I assume it's all there somewhere and some research will unlock everything you need...

just saying...
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!
sonictim is offline   Reply With Quote
Old 05-26-2021, 10:22 AM   #17
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by sonictim View Post


There is this section of Item Properties that controls the loop when you drag it.. There are options for start, length, and fade... I bet you could take your item you want to loop, add half the fade amount to the start time and subtract half the fade amount from the length and then when it loops, it would be exactly what you put into the copy buffer with a nice crossfade

I'm not exactly sure how to set it all with the reascript API, but I assume it's all there somewhere and some research will unlock everything you need...

just saying...
Hmmm. I'll experiment with this..., but at first glance... I don't get it. What is going to crossfade into what here? Is the loop suppose to crossfade into itself each time the item loops?? I can't get any kind of fade to happen at all. Granted, this is the first time I've ever checked the 'loop source' button on any item, and I probably just don't 'get it'. How would you adjust the 'curve' of the fade if you needed to?

EDIT... OK. I get it now. It's weird to me. There's no visual feedback, there's no option for shapes, and the fade seems to happen based on the start of the loop. I did a test, recorded myself counting 1, 2, 3, 4, 5. Looped it at 1,2. Thinking I would hear part of 3. But it doesn't work that way. I understand why..., but this feels less flexible to me. If I loop it at 2,3 then I hear part of 1 when it loops. It's like..., exactly opposite of what my brain wants it to be.

EDIT 2: The (I believe it's unchangeable) fade shape 'sounds' linear too. I.E., ambiences are dopping in volume.

Last edited by benmrx; 05-26-2021 at 11:33 AM.
benmrx is offline   Reply With Quote
Old 05-26-2021, 02:17 PM   #18
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 463
Default

Quote:
Originally Posted by benmrx View Post
Hmmm. I'll experiment with this..., but at first glance... I don't get it. What is going to crossfade into what here? Is the loop suppose to crossfade into itself each time the item loops?? I can't get any kind of fade to happen at all. Granted, this is the first time I've ever checked the 'loop source' button on any item, and I probably just don't 'get it'. How would you adjust the 'curve' of the fade if you needed to?

EDIT... OK. I get it now. It's weird to me. There's no visual feedback, there's no option for shapes, and the fade seems to happen based on the start of the loop. I did a test, recorded myself counting 1, 2, 3, 4, 5. Looped it at 1,2. Thinking I would hear part of 3. But it doesn't work that way. I understand why..., but this feels less flexible to me. If I loop it at 2,3 then I hear part of 1 when it loops. It's like..., exactly opposite of what my brain wants it to be.

EDIT 2: The (I believe it's unchangeable) fade shape 'sounds' linear too. I.E., ambiences are dopping in volume.
Interesting findings! Thanks for sharing. Yup, no visual feedback and it would be better if we could set the kind of fade! Better keep those fades short then!

Btw, Are you planning on adding multi item support at any point? Or is that part of your ambience maker? When I cut BGs in protools, I constantly use Paste to Fill to just copy and paste whole chunks of blocks...
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!
sonictim is offline   Reply With Quote
Old 05-26-2021, 10:40 PM   #19
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by sonictim View Post
Interesting findings! Thanks for sharing. Yup, no visual feedback and it would be better if we could set the kind of fade! Better keep those fades short then!

Btw, Are you planning on adding multi item support at any point? Or is that part of your ambience maker? When I cut BGs in protools, I constantly use Paste to Fill to just copy and paste whole chunks of blocks...
Yes. I want to add multi-item support. Which goes hand in hand with multi-track support. So, you copy items from four tracks, then make a razor edit area over four tracks, and 'paste to fill'. And everything goes to the correct track. Is that kind of what you're talking about when cutting BGs?

It's coming up with the 'rules', examples:

If you copy items from four tracks, but the razor area you want to paste to only spans 3 tracks. I would think, in that case..., it ONLY pastes items on the first three tracks. What was in the buffer on the fourth track just never gets pasted anywhere.

If you copy items from four tracks, and you have a razor area that spans say 5 tracks, then everything gets pasted on the first four tracks, but the 5th track stays empty. Nothing gets pasted to that track.

If you copy items from ONE track, and you have a razor area that spans say 5 tracks, then ALL 5 tracks get pasted to. This is basically the behavior the script has right now.

The whole 'ambience creator' thing is still a ways off.
benmrx is offline   Reply With Quote
Old 05-27-2021, 02:03 PM   #20
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 463
Default

Quote:
Originally Posted by benmrx View Post
It's coming up with the 'rules', examples:

If you copy items from four tracks, but the razor area you want to paste to only spans 3 tracks. I would think, in that case..., it ONLY pastes items on the first three tracks. What was in the buffer on the fourth track just never gets pasted anywhere.

If you copy items from four tracks, and you have a razor area that spans say 5 tracks, then everything gets pasted on the first four tracks, but the 5th track stays empty. Nothing gets pasted to that track.

If you copy items from ONE track, and you have a razor area that spans say 5 tracks, then ALL 5 tracks get pasted to. This is basically the behavior the script has right now.
I think your rule logic is correct so far! I wonder if you'll have to come up with an alternative way of copying/pasting rather than using Main_OnCommand() that allows you to keep track of the selected items/razor edits
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!
sonictim is offline   Reply With Quote
Old 05-28-2021, 03:56 PM   #21
vdubreeze
Human being with feelings
 
vdubreeze's Avatar
 
Join Date: Jul 2011
Location: Brooklyn
Posts: 2,613
Default

Clap! Clap Clap Clap Clap CLAP!!!
__________________
The reason rain dances work is because they don't stop dancing until it rains.
vdubreeze is offline   Reply With Quote
Old 05-29-2021, 08:19 PM   #22
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Looky looky! Working on an update for this script. It took me banging my head on the wall a few times, but I've got multiple envelopes working, and multiple tracks!! I'm sure there are some bugs to iron out, but it seems to work as intended.



FYI, it's not about 'matching the tracks' per say, but more about 'how many tracks were in the buffer/clipboard, and how many tracks have razor edits you want to fill. Quoting myself from post #19.
Quote:
If you copy items from four tracks, but the razor area you want to paste to only spans 3 tracks. I would think, in that case..., it ONLY pastes items on the first three tracks. What was in the buffer on the fourth track just never gets pasted anywhere.

If you copy items from four tracks, and you have a razor area that spans say 5 tracks, then everything gets pasted on the first four tracks, but the 5th track stays empty. Nothing gets pasted to that track.

If you copy items from ONE track, and you have a razor area that spans say 5 tracks, then ALL 5 tracks get pasted to.
Bonus, you no longer need the envelope lanes to be visible when pasting.

Last edited by benmrx; 05-29-2021 at 08:52 PM.
benmrx is offline   Reply With Quote
Old 05-30-2021, 11:55 AM   #23
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Multi-item support is almost there! Just need to make some decisions regarding crossfades and multiple items on the same track.



I'm also pondering the idea that. If you copy an item as an item..., and not a razor edit, then that would mean the 'paste to fill' would 'loop' the item. However, not sure how to handle that if multiple items were copied on the same track. What would loop? The first item... the last time... maybe 'glue' the items and then loop that??
benmrx is offline   Reply With Quote
Old 05-30-2021, 01:19 PM   #24
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 463
Default

Quote:
Originally Posted by benmrx View Post
Multi-item support is almost there! Just need to make some decisions regarding crossfades and multiple items on the same track.



I'm also pondering the idea that. If you copy an item as an item..., and not a razor edit, then that would mean the 'paste to fill' would 'loop' the item. However, not sure how to handle that if multiple items were copied on the same track. What would loop? The first item... the last time... maybe 'glue' the items and then loop that??
I think with multiple items on a track it would have to fill in the protools way, not the looped item way.
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!
sonictim is offline   Reply With Quote
Old 05-31-2021, 09:48 PM   #25
Joekkel
Human being with feelings
 
Join Date: Nov 2020
Posts: 8
Default

Great and usefull script, thank you! But what is this sorcery? How do you create those razor edits inbetween items?

Quote:
Pasting to multiple Razor Edits for items:
thx!
Joekkel is offline   Reply With Quote
Old 06-01-2021, 08:08 AM   #26
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by Joekkel View Post
Great and usefull script, thank you! But what is this sorcery? How do you create those razor edits inbetween items?
Hope you find it helpful

Creating razor edits inbetween items is the script in this post.
https://forum.cockos.com/showthread.php?t=253894

Quote:
Originally Posted by sonictim View Post
I think with multiple items on a track it would have to fill in the protools way, not the looped item way.
Thanks for the input

Now I'm wondering... if you copied multiple items on the same track, where the item edges are butted up against each other..., that crossfades would NOT be created. The idea that you're probably copying a 'curated' selection that you've already edited, and you just want to fill an area without the script changing your edit by adding crossfades. An example is the items in the bottom track in the licecap in post#23.

Last edited by benmrx; 06-01-2021 at 08:28 AM.
benmrx is offline   Reply With Quote
Old 06-01-2021, 11:10 AM   #27
Joekkel
Human being with feelings
 
Join Date: Nov 2020
Posts: 8
Default

Quote:
Originally Posted by benmrx View Post
Hope you find it helpful

Creating razor edits inbetween items is the script in this post.
https://forum.cockos.com/showthread.php?t=253894
oh yeah!! thanks a lot!
Joekkel is offline   Reply With Quote
Old 06-17-2021, 12:29 PM   #28
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Wellll... I'm about to throw in the proverbial towel in trying to get this script to support multiple items/tracks/envelopes.

There's some weird stuff going on. The script works..., it does what I want... but somehow..., someway it totally breaks the 'GetRazorEdits' function written by BirdBird in this thread:

https://forum.cockos.com/showthread.php?t=241604

...which I'm relying on. But it only breaks that function AFTER I've run my script at least once. Sometimes it takes 2,3,4 times of running my script. Even if I delete all tracks, 'clear all razor edits', quit/restart Reaper, etc.

Basically, even though this script is not doing anything with defer or get/set ext state. Once my script runs, the GetRazorEdit function breaks for any track that contains an item that was used in my script. Regardless of whether or not any razor edits actually exist in the project.

It's like there's some odd residual info that's leftover and I have no idea how to fix it.

Here's one example of the function returning a count of 2 razor edits, but only after I've moved an item. Note that the incorrect 'count' for the number of razor edits only happens if I move an item that was pasted with my script.



Again, doesn't matter if 20 minutes later I run the native action 'Clear all razor edits'... doesn't matter if I quit/restart Reaper. The problem stays with the item and sometimes stays with what ever track has had items pasted using my script. And..., this isn't the only wierdness I get. I've seen the native 'ShowConsoleMessage' break after running my script as well. Nevermind that bit about 'ShowConsoleMessage'.

My script is a little over 2,000 lines long. Not sure if that has anything to do with it.

Last edited by benmrx; 06-18-2021 at 02:56 PM.
benmrx is offline   Reply With Quote
Old 06-17-2021, 01:32 PM   #29
BirdBird
Human being with feelings
 
BirdBird's Avatar
 
Join Date: Mar 2019
Posts: 425
Default

That does look very odd. (It could be the case that the function I wrote is buggy)
What does the track chunk look like after you move one of these items to the tracks?
__________________
ReaScript Discord Server | Scripts | JSFX
BirdBird is offline   Reply With Quote
Old 06-17-2021, 02:19 PM   #30
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by BirdBird View Post
That does look very odd. (It could be the case that the function I wrote is buggy)
What does the track chunk look like after you move one of these items to the tracks?
FWIW, I've used that function you wrote a TON. In maybe 20 scripts (wild guess), and it always works perfectly. I've also used your 'SetTrackRazorEdit' quite a bit, again always works exactly as expected (Thank you for those by the way! . It's just this script.

I don't know how to read chunks, but if you want I can post a debug of the string here if that's what you mean?
Code:
reaper.GetTrackStateChunk(MediaTrack track, string str, boolean isundo)

Last edited by benmrx; 06-17-2021 at 02:38 PM.
benmrx is offline   Reply With Quote
Old 06-18-2021, 08:33 AM   #31
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by BirdBird View Post
That does look very odd. (It could be the case that the function I wrote is buggy)
What does the track chunk look like after you move one of these items to the tracks?
OK, so yeah..., looking at the track chunk, there seems to be stale AREASEL data after moving an item. I'd love to know if this gives anyone insight into what might be going on:

benmrx is offline   Reply With Quote
Old 06-18-2021, 10:22 AM   #32
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 463
Default

I believe the second area selection is the envelope. An area selection with “” as the third block is a track, and the one with all the numbers is the envelope. I believe those numbers are the envelope GUID
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!
sonictim is offline   Reply With Quote
Old 06-18-2021, 10:30 AM   #33
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by sonictim View Post
I believe the second area selection is the envelope. An area selection with “” as the third block is a track, and the one with all the numbers is the envelope. I believe those numbers are the envelope GUID
Hmmm. Interesting. That gives me a couple of ideas to try. Thank you.
benmrx is offline   Reply With Quote
Old 06-18-2021, 01:39 PM   #34
BirdBird
Human being with feelings
 
BirdBird's Avatar
 
Join Date: Mar 2019
Posts: 425
Default

Quote:
Originally Posted by benmrx View Post
OK, so yeah..., looking at the track chunk, there seems to be stale AREASEL data after moving an item. I'd love to know if this gives anyone insight into what might be going on:

That is really weird, would you mind sending a project file with one of these items that carry over this data? (My guess is some media item envelope data is getting picked up somehow, maybe?)
__________________
ReaScript Discord Server | Scripts | JSFX
BirdBird is offline   Reply With Quote
Old 06-18-2021, 02:14 PM   #35
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by BirdBird View Post
That is really weird, would you mind sending a project file with one of these items that carry over this data? (My guess is some media item envelope data is getting picked up somehow, maybe?)
Hopefully this works for you. This has 1 track with a few items. Moving any of these items to new tracks 'should' replicate the issue in question.



Thank you so much everyone for all the help!
Attached Files
File Type: zip StaleAREASEL_for_BirdBird.zip (1.02 MB, 74 views)
benmrx is offline   Reply With Quote
Old 06-18-2021, 02:48 PM   #36
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Also of interest (maybe) is that this issue happens when using my script to copy ONLY envelope data. You can see in the Licecap that everything looks correct until I 'paste to fill' with the volume envelope. And just to note, this issue I don't believe happens with the version of the script posted earlier in this thread. I had to re-write it in order to handle copy/pasting to/from multiple tracks.


Last edited by benmrx; 06-18-2021 at 03:46 PM.
benmrx is offline   Reply With Quote
Old 06-18-2021, 03:58 PM   #37
BirdBird
Human being with feelings
 
BirdBird's Avatar
 
Join Date: Mar 2019
Posts: 425
Default

Oh man this is a weird one

In the project you sent the volume envelope on the track containing the items seems to in a state where its:
* Activated
* Not visible
* Not armed

(I can't get the volume envelope into this state manually, so there is something odd going on)

In the project:
* Move envelopes points with razor edits/area selections is toggled on in the toolbar


When moving items from this track to another track the volume envelope on the other track gets activated without being visible. When drawing new areas on this track with the toolbar button toggled on REAPER puts a razor edit on the invisible envelope. (Hence there are now two razor edits on the track, one being on the invisible envelope)

I have troubleshooted this on an old REAPER version at the moment and it could be the case that it behaves differently in newer versions. But I would guess that if you resolve the envelope state on the track containing the items the issue will go away.
Attached Images
File Type: png envelope.png (1.4 KB, 733 views)
__________________
ReaScript Discord Server | Scripts | JSFX
BirdBird is offline   Reply With Quote
Old 06-18-2021, 06:46 PM   #38
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by BirdBird View Post
Oh man this is a weird one

In the project you sent the volume envelope on the track containing the items seems to in a state where its:
* Activated
* Not visible
* Not armed

(I can't get the volume envelope into this state manually, so there is something odd going on)

In the project:
* Move envelopes points with razor edits/area selections is toggled on in the toolbar


When moving items from this track to another track the volume envelope on the other track gets activated without being visible. When drawing new areas on this track with the toolbar button toggled on REAPER puts a razor edit on the invisible envelope. (Hence there are now two razor edits on the track, one being on the invisible envelope)

I have troubleshooted this on an old REAPER version at the moment and it could be the case that it behaves differently in newer versions. But I would guess that if you resolve the envelope state on the track containing the items the issue will go away.
Oooooohhhhh. That IS a weird one. Thank you for debugging this!! Huge help!

Last edited by benmrx; 06-18-2021 at 06:59 PM.
benmrx is offline   Reply With Quote
Old 06-18-2021, 09:19 PM   #39
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by BirdBird View Post
Oh man this is a weird one
Actually, this is rather interesting. Here I'm not using my script at all. The 'Count' for the number of Razor Edits is increasing whenever a track envelope is used/automated. It seems.

Maybe I just fundamentally misunderstood how Razor Edits work under the hood? FWIW, I'm on Reaper 6.29 OSX Mojave.



...that Licecap could have been shorter...

Soooooo..... I don't think my script is somehow confusing Reaper, or breaking your function or anything like that. I think I just need to work out some more kinks in my script. I only ever noticed this issue when doing a 'paste to fill' with items, when there was an item at the left and/or right edge of the razor area to be filled. The issue is that the script would run through everything too many times, and fades/crossfades would get wonky.

EDIT: Regarding an envelope being:
*Activated
*Not Visible
*Not Armed

I seem to be able to do that manually here (it's hard to see the 'x'), however, the behavior seems to work differently once you put some automation/points in an envelope. Again, I might be totally misunderstanding some Reaper terms/basics here. Also, this licecap has no script involvement. Just standard/native editing.




EDIT 2: THANK YOU AGAIN TO EVERYONE FOR ALL THE HELP!!
I just made an edit to my script. Added one... teeny, tiny 'if' statement and on first glance it seems to fix everything!

Last edited by benmrx; 06-19-2021 at 10:06 AM.
benmrx is offline   Reply With Quote
Old 06-19-2021, 10:42 AM   #40
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 463
Default

Quote:
Originally Posted by benmrx View Post
I just made an edit to my script. Added one... teeny, tiny 'if' statement and on first glance it seems to fix everything!
Definitely been there! Glad you’re getting it figured out! Looking forward to taking advantage of your efforts.
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!
sonictim 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 06:33 PM.


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