|
|
|
10-15-2018, 01:29 PM
|
#1
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Script: Smart fill gaps by stretching item tails
How's that for a mouthful?
From the wild and wacky brain of Robert Randolph, this one is for editing drum tracks and that sort of thing. Split some items, snap them to the grid, and then let this script try to intelligently fill in any gaps you've left.
It uses a combination of RMS and a couple of max/min lengths to split and stretch the "tails" of your items while leaving the transient alone.
Available now at a ReaPack near you.
Last edited by Lokasenna; 10-16-2018 at 05:41 AM.
|
|
|
10-15-2018, 07:59 PM
|
#2
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Holy Moles! That kicks ass!!! That's great for splitting -> quantizing -> filling the gaps, thanks Loka!
|
|
|
10-15-2018, 08:25 PM
|
#3
|
Human being with feelings
Join Date: Aug 2011
Location: Near a big lake
Posts: 3,943
|
Looking forward to trying this next time I record!
I found a bit of a bug after running the script the first time. I set a toolbar button to run the script (at the top of the window), and it seems the script opens the windows where the mouse cursor was...cutting off the top of the window and making me unable to click the toolbar buttons (or any of the menu) beneath the window.
Last edited by JamesPeters; 10-18-2018 at 01:07 PM.
|
|
|
10-15-2018, 11:14 PM
|
#4
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
Awesome!
|
|
|
10-16-2018, 05:15 AM
|
#5
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by JamesPeters
Looking forward to trying this next time I record!
I found a bit of a bug after running the script the first time. I set a toolbar button to run the script (at the top of the window), and it seems the script opens the windows where the mouse cursor was...cutting off the top of the window and making me unable to click the toolbar buttons (or any of the menu) beneath the window.
|
Cheers, fixing.
|
|
|
10-16-2018, 05:27 AM
|
#6
|
Human being with feelings
Join Date: Apr 2017
Location: St. Petersburg, FL
Posts: 880
|
I like how the OP conveniently forgets that I came up with this idea :P
(Script is also awesome btw)
|
|
|
10-16-2018, 05:40 AM
|
#7
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by Robert Randolph
I like how the OP conveniently forgets that I came up with this idea :P
(Script is also awesome btw)
|
I actually had that typed out in an edit but it apparently didn't get saved. :/
|
|
|
10-16-2018, 05:45 AM
|
#9
|
Human being with feelings
Join Date: Jun 2008
Location: Whales, UK
Posts: 6,009
|
Long ago I had a macro for doing similar thing v basically for healing clicks glitches pops etc
- will check this out as can be pretty seamless technique.
Edit: ah man 2010!
Not bad for a macro bodger, can't script for toffey, kudos to those that do.
https://forum.cockos.com/showpost.ph...9&postcount=39
Last edited by BenK-msx; 10-16-2018 at 05:55 AM.
|
|
|
10-16-2018, 05:46 AM
|
#10
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
For testing purposes, I imported a drum loop into Reaper. The original tempo is 100 BPM.
I split it on the transients, afterwards, I set the timebase to beat positions only.
Then I change the BPM to 120 and the "desired" gaps appear.
Now, when I run the script, nothing happens. Are the gaps too big?
|
|
|
10-16-2018, 05:50 AM
|
#11
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by Sexan
|
brb, find/replacing all instances of the word "menu" in that script with "Sexan".
|
|
|
10-16-2018, 05:53 AM
|
#12
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by _Stevie_
For testing purposes, I imported a drum loop into Reaper. The original tempo is 100 BPM.
I split it on the transients, afterwards, I set the timebase to beat positions only.
Then I change the BPM to 120 and the "desired" gaps appear.
Now, when I run the script, nothing happens. Are the gaps too big?
|
Nothing happens at all?
- If you enable "Place markers when no split point is found" it should drop a bunch of them telling you why it didn't do anything for each item.
- It is possible for a gap to be too big, depending on your settings - if the final stretched rate of the split item would be less than "min. stretch rate" it will skip it rather than dragging your audio out that far.
|
|
|
10-16-2018, 06:16 AM
|
#13
|
Human being with feelings
Join Date: Apr 2017
Location: St. Petersburg, FL
Posts: 880
|
Quote:
Originally Posted by Sexan
|
Yes! I think we can all agree that Sexan > Lokasenna
|
|
|
10-16-2018, 06:19 AM
|
#14
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
brb, PMing a mod to change my name to LokaSexan.
|
|
|
10-16-2018, 06:22 AM
|
#15
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
|
it was just a joke (not sure since internet is a very special place,if its get that way): I cant even use reaper without that majestic script
|
|
|
10-16-2018, 06:33 AM
|
#16
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
@Loka
Here's the workflow:
|
|
|
10-16-2018, 06:50 AM
|
#17
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I forgot, there's a maximum gap of 0.1s to avoid stretching items across intentional empty spaces. It's hardcoded at the moment - line 41, "local next_item_distance = 0.1" if you want to try adjusting it.
Will look at making it an adjustable setting.
If that doesn't end up being the problem, would you mind sending me that project to look at?
|
|
|
10-16-2018, 07:23 AM
|
#18
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Sure, no problem at all. I will send you the link via PM!
It's basically just a drum loop I dropped into Reaper.
|
|
|
10-16-2018, 09:02 AM
|
#19
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Hm, strange, I set the value up to 1 (also tried 0.2, 0.3, etc...) and the same thing happens. Only a red marker gets placed at the end of the items.
But maybe I'm doing something substantially wrong...?
Last edited by _Stevie_; 10-16-2018 at 09:07 AM.
|
|
|
10-16-2018, 09:24 AM
|
#20
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Sorry, I was a little cocky. Looks like it's giving up on those items for some reason that I didn't catch with the red markers. Working on it.
|
|
|
10-16-2018, 09:26 AM
|
#21
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
All good man, I really thought the error is in front of the screen (me)
|
|
|
10-16-2018, 11:03 AM
|
#22
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Updating. I believe it's fixed.
|
|
|
10-16-2018, 12:16 PM
|
#23
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Awesome, seems to work! Only the debug output is still enabled
|
|
|
10-16-2018, 12:21 PM
|
#24
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Yeah, I saw that. Fixed. :P
|
|
|
10-16-2018, 12:35 PM
|
#25
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Thanks!
There's one thing I wonder in your GIF. There, the transients are kept intact and the tail is stretched. However, that doesn't happen here. Here, the item remains the same, but instead little snippets are inserted into the gaps.
|
|
|
10-16-2018, 02:22 PM
|
#26
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
If you're still using the project you sent me, the items all have bits of the next transient at the end so it's finding a "correct" point to split there.
|
|
|
10-16-2018, 04:26 PM
|
#27
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Hmm, thought the same, but then I removed the trailing transients and the result is the same:
|
|
|
10-16-2018, 06:45 PM
|
#28
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I'm pretty sure the script doesn't (currently) take item volume into account, so is it possible that the original item actually does have content at -47dB there?
|
|
|
10-16-2018, 06:48 PM
|
#29
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Err, sorry, forgot to reset the threshold. However, it's still the same when set to the default value. If you still have the project:
1. shorten the trailing transients as seen in my GIF
2. apply the script
It should give you the same result.
|
|
|
10-16-2018, 06:52 PM
|
#30
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Hmm... looks like my fix for the previous issue broke something else. Which sucks, because I still don't know what was causing the previous issue.
|
|
|
10-16-2018, 06:53 PM
|
#31
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Awww, I'm sorry, I should just have kept my mouth :O
|
|
|
10-16-2018, 08:21 PM
|
#32
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Updated.
It was an issue with finding split points for multichannel audio - all of my original testing was in mono so I didn't catch it. It appears to work fine now.
|
|
|
10-17-2018, 05:12 AM
|
#33
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
The stretching works now! But not for all items.
I also had to lower the threshold a lot.
Last edited by _Stevie_; 10-17-2018 at 06:57 AM.
|
|
|
10-17-2018, 08:49 AM
|
#34
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
- Your items are pretty quiet, so with a higher threshold it's probably not finding a place to split before it hits the "protect left" value and gives up. I can make the slider go lower if that would help.
- I'm seeing a couple of items in your test project that it doesn't like, for some reason. If I select everything, it skips them, but selecting those items specifically seems to work fine... I have no idea why.
- If you turn on both of the marker options, is every item at least ending up with a marker now? The previous version was failing and not even doing that much.
|
|
|
10-17-2018, 01:58 PM
|
#35
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Found the issue...
I had to change to "frames" and set RMS window to 0. Now all items are caught.
Is frames more precise than ms?
|
|
|
10-17-2018, 02:03 PM
|
#36
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
It shouldn't be, especially if the RMS is 0 because that's going to just end up being peak detection. Good to know though, maybe my RMS code is broken.
|
|
|
10-17-2018, 02:12 PM
|
#37
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Just FYI, there's also some ReaScript RMS functions:
https://www.extremraym.com/cloud/rea...ItemAverageRMS
RMS window can't be set via ReaScript currently though, so probably not that helpful for your use case anyway.
|
|
|
10-17-2018, 06:48 PM
|
#38
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
The problem is that I actually have to look through the item for the last position where the RMS is higher than __ dB. I have it looking through each channel, sample by sample, and then keeping a rolling average of the last 200ms or whatever worth of samples to calculate an RMS with.
I think it must be messing up splitting the samples for each channel, but I'm not sure how or why. I might just have it sum the channels or average them instead...
|
|
|
10-20-2018, 08:00 AM
|
#39
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Alrighty, I rewrote a bunch of the audio code and it appears to be playing nicely with everything now. Here's a version for testing if anybody has a few minutes. It should work on both mono and stereo items:
https://dl.dropboxusercontent.com/s/...em%20tails.lua
|
|
|
10-20-2018, 08:08 AM
|
#40
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Wooop!!! Just tested with my drum loop project. Worked perfectly on the first try,
congrats!
So you changed the RMS code or even more audio stuff?
Edit: the transient area seems much bigger now? This results in a way more natural sound.
Only the tail is stretched.
Last edited by _Stevie_; 10-20-2018 at 08:18 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 04:03 PM.
|