Old 08-28-2017, 02:47 AM   #1
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default amagalma_Smart Crossfade



- If items are adjacent then it creates a crossfade (length is user defined inside the script) on the left side of the items' touch point
- If items overlap then it creates a crossfade at the overlapping area
- If there is a time selection covering part of both items, then it crossfades at the time selection area
- Can be used with as many items in different tracks as you like
- Smart undo point creation (only if there has been at least one change)
- default crossfade shape: equal power
- you can set in the script if you want to keep the time selection or remove it
- you can set in the script if you want to keep selected the previously selected items or not

available in ReaPack

Last edited by amagalma; 09-04-2017 at 06:56 AM.
amagalma is offline   Reply With Quote
Old 08-28-2017, 03:12 AM   #2
Mottemania
Human being with feelings
 
Join Date: Apr 2016
Posts: 86
Default

Well, thank you!
Mottemania is offline   Reply With Quote
Old 08-28-2017, 04:12 AM   #3
Gianfini
Human being with feelings
 
Join Date: Jan 2015
Posts: 634
Default little bug

Great!! it puts together "crossfade any overlapping item" and "SWS: Fade in/out/crossfade selected area of selected items"

But one little bug exist: when crossfading a selection (only when a selection exists) of two overlapping items the snap offset (if set different than the beginning of the item) get moved.
In the SWS action it doesn't.

see example below



g
Gianfini is offline   Reply With Quote
Old 08-28-2017, 05:18 AM   #4
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

Thanks for the bug report, Gianfini!

I'll fix it on Sunday when I am back from vacations
amagalma is offline   Reply With Quote
Old 09-03-2017, 02:03 PM   #5
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

* v1.2 (2017-09-03)
+ fixed bugs
+ no need for SWS extensions
+ you can set in the script if you want to keep the time selection or remove it
+ you can set in the script if you want to keep selected the previously selected items or not


* v1.21 (2017-09-04)
+ default crossfade shape: equal power

Last edited by amagalma; 09-03-2017 at 04:04 PM.
amagalma is offline   Reply With Quote
Old 09-04-2017, 03:31 AM   #6
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

* v1.24 (2017-09-04)
+ better behavior when creating undo points
+ default crossfade time can be set inside the script

* v1.25 (2017-09-04)
+ better behavior when existing crossfades do not conform to wanted crossfade type/shape/time

* v1.26 (2017-09-04)
+ undo point creation includes time selection if it was requested to be removed after crossfading

I think it should be final now

Last edited by amagalma; 09-19-2017 at 12:50 AM.
amagalma is offline   Reply With Quote
Old 09-19-2017, 12:51 AM   #7
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

* v1.30 (2017-09-19)
+ fixed bug when "Trim behind items" was enabled
+ fixed loosing item selection, in case no change to any items had happened
+ now items can be crossfaded when there is a time selection touching both items, even if the two items do not touch each other
amagalma is offline   Reply With Quote
Old 09-19-2017, 11:25 AM   #8
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: brighton, uk
Posts: 12,753
Default

Awesome thanks!

I'm sure it will come in handy!
__________________
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 09-23-2017, 01:25 PM   #9
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

* v1.31 (2017-09-23)
+ fixed misbehavior when there were "autofades" in items

I think this is the final one..

@musicbynumbers: cheers mate!
amagalma is offline   Reply With Quote
Old 09-24-2017, 12:24 AM   #10
Gianfini
Human being with feelings
 
Join Date: Jan 2015
Posts: 634
Default

thanks very good! It replaced all my cross fade actions

g
Gianfini is offline   Reply With Quote
Old 09-25-2017, 12:49 PM   #11
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

* v1.32 (2017-09-25)
+ fixed occasional problem with adjacent items not crossfading (I think I have found a bug in Reaper)
amagalma is offline   Reply With Quote
Old 09-25-2017, 01:00 PM   #12
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

and here is the Reaper bug:



and the test code:
Code:
item = reaper.GetSelectedMediaItem(0,1)
previousitem = reaper.GetSelectedMediaItem(0,0)
secondstart = reaper.GetMediaItemInfo_Value(item, "D_POSITION")
firstend = reaper.GetMediaItemInfo_Value(previousitem, "D_POSITION") + reaper.GetMediaItemInfo_Value(previousitem, "D_LENGTH")
reaper.ShowConsoleMsg("end of first item is "..firstend.."\n")
reaper.ShowConsoleMsg("start of second item is "..secondstart.."\n")
if firstend == secondstart then
  reaper.ShowConsoleMsg("They are equal")
else
  reaper.ShowConsoleMsg("They are not equal")
end
So, I had to do this in my script in order to overcome the bug:
Code:
if firstend < secondstart - 0.00001 then
amagalma is offline   Reply With Quote
Old 09-26-2017, 01:46 AM   #13
Gianfini
Human being with feelings
 
Join Date: Jan 2015
Posts: 634
Default

Wow you should post on Bug Reports

Maybe the values differ after the 8th decimal(!) Because of sample level snapping?

Anyway in the meantime to overcome the issue you could round up till say the 5th decimal before comparing...

G

Last edited by Gianfini; 09-26-2017 at 05:38 AM.
Gianfini is offline   Reply With Quote
Old 09-27-2017, 09:35 AM   #14
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

* v1.33 (2017-09-27)
+ if there is a gap smaller or equal to the xfade time (default:10ms) between two items, then they are considered as adjacent


P.S. I posted about the "bug" but it is not a bug.. in a few words, one should not trust floating point numbers and should define him/herself the amount of error that is accepted. Now I know
amagalma is offline   Reply With Quote
Old 10-11-2017, 03:29 PM   #15
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

* v1.35 (2017-10-12)
+ hopefully, all problems caused by floating point maths should have been fixed now
amagalma is offline   Reply With Quote
Old 11-21-2017, 07:37 AM   #16
StuhRAH
Human being with feelings
 
StuhRAH's Avatar
 
Join Date: Apr 2014
Posts: 209
Default

This script is really cool! Could:

Quote:
If items are adjacent then it creates a crossfade (length is user defined inside the script) on the left side of the items' touch point
Be defined as between the two points if we desired?

Here's how studio one handles it:

Clip A: More audio after end of item
Clip B: More audio before start of item


Clip A: More audio after end of item
Clip B: No audio before start of item


Clip A: No audio after end of item
Clip B: More audio before start of item


Clip A: No audio after end of item
Clip B: No audio before start of item


I'd love it if it could be modified to work exactly like these four scenarios?
StuhRAH is offline   Reply With Quote
Old 11-25-2017, 09:30 AM   #17
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

I think there are already actions (native and sws) that work in these ways. Creating a crossfade on the left side of the split is something it didn't exist, and it is my preferred way of working (for example, when splitting at the start of a transient)
amagalma is offline   Reply With Quote
Old 11-26-2017, 07:58 AM   #18
StuhRAH
Human being with feelings
 
StuhRAH's Avatar
 
Join Date: Apr 2014
Posts: 209
Default

Quote:
Originally Posted by amagalma View Post
I think there are already actions (native and sws) that work in these ways. Creating a crossfade on the left side of the split is something it didn't exist, and it is my preferred way of working (for example, when splitting at the start of a transient)
I agree, actually I hadn't considered how useful it is to preserve transients whilst eliminating zero-crossing clicks before using this script. I was just curious if it was possible to customise it easily.
StuhRAH is offline   Reply With Quote
Old 03-23-2018, 08:53 PM   #19
Itsmusicinmyears
Human being with feelings
 
Join Date: Jun 2014
Posts: 4
Default bug report

hey!
this is an awesome script, thank you for your work.
i have a problem with it though:

i have a custom action for doing 4point editing in classical music.
after copying a specific area in the "source" file, i switch to the "destination" file.
then:
- time selection adaptive delete
- paste
then i select the pasted item + the items on the left and on the right and finally run your script. but here is what happens (gif via cloud link):

https://drive.google.com/open?id=1B1...03jGX34mwfta-s

so it appears to make the crossfade only on the right side of the item.
BUT as soon as you move the conjunction points of the items, the action works. which is acually also quite weird.

i would be really glad if you could help me out on this...
thanks!
Lukas
Itsmusicinmyears is offline   Reply With Quote
Old 03-25-2018, 01:17 PM   #20
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

Could you attach a sample project (without the audio) here? And throw a couple of markers to show me where the script does not work. Thanks
amagalma is offline   Reply With Quote
Old 03-26-2018, 09:21 PM   #21
Itsmusicinmyears
Human being with feelings
 
Join Date: Jun 2014
Posts: 4
Default

there you go!
i run the script after selecting the 3 items, with no time selection active.
in the second track, i just moved only the crossfades of the items a tiny bit - and then the script works.
best!
Lukas
Attached Files
File Type: rpp sample file.rpp (8.9 KB, 140 views)
Itsmusicinmyears is offline   Reply With Quote
Old 03-31-2018, 12:52 AM   #22
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

Thanks! I am currently away. When I return I 'll check what is wrong
amagalma is offline   Reply With Quote
Old 04-01-2018, 03:04 PM   #23
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

v1.37 uploaded on ReaPack

- fixes malfunction when dealing with items that overlap less than the default crossfade time

@Itsmusicinmyears: thanks for the report
amagalma is offline   Reply With Quote
Old 08-17-2018, 03:31 AM   #24
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 532
Default

Hi Amagalma
I'm wondering if a variation of this script could be made.
At the end of each record pass (in takes "normal" mode) reaper selects the items created.
I'd like to use a script to then place a cross-fade at the start and end of the recorded item if it touches other items. I could use this script as is and hack around by deselecting any time selection and adding actions to select/deselect previous and next items but a script edit would be slicker!
I currently have record start and stop mapped via a cycle action that performs other actions for possible group select after record passes. I could add this new script to the record stop part then reaper would auto create cross-fades on record punch points in takes mode.
Many thanks for your time
__________________
Brush and Beater Drums Online: www.outoftheboxdrums.co.uk
Triode is offline   Reply With Quote
Old 08-19-2018, 02:34 PM   #25
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

What you said yourself is the best solution. Just create a custom action:
- Time selection: Remove time selection
- SWS: Add item(s) to left of selected item(s) to selection
- SWS: Add item(s) to right of selected item(s) to selection
- Script: amagalma_Smart Crossfade.lua
amagalma is offline   Reply With Quote
Old 08-19-2018, 03:07 PM   #26
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 532
Default

It's the easiest and it does work thanks for sharing your smart crossfade script.

I have it in a macro, saving the current time selection before clearing it and then reinstating.
And saving the recorded item selection and reinstating that after your script also.

It's mapped as my stop/play command in a cycle action. I'll make another for my record/play one.

If anyone else is looking for auto crossfade on record punch amagalma's script looks like a large part of the answer with a bit of macro fudge
__________________
Brush and Beater Drums Online: www.outoftheboxdrums.co.uk
Triode is offline   Reply With Quote
Old 09-24-2019, 03:57 AM   #27
todoublez
Human being with feelings
 
todoublez's Avatar
 
Join Date: Aug 2019
Location: beijing
Posts: 87
Default

loved this script,
works like a charm to me,
easy to use.
where can I donate you for expressing my appreciation ?
todoublez is online now   Reply With Quote
Old 09-29-2019, 12:13 PM   #28
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,509
Default

Thanks for the kind words!

I do not have a donation link, so if you want you can donate instead to any organization helping poor kids, refugees, animals, or any other good purpose you like.
amagalma is offline   Reply With Quote
Old 09-29-2019, 12:37 PM   #29
Tone Ranger
Human being with feelings
 
Tone Ranger's Avatar
 
Join Date: Jan 2019
Location: Toronto, Canada
Posts: 162
Default

Quote:
Originally Posted by amagalma View Post
Thanks for the kind words!

I do not have a donation link, so if you want you can donate instead to any organization helping poor kids, refugees, animals, or any other good purpose you like.
Been loving this script as well, and that's about the coolest donation idea ever....CUDOS!!!
Tone Ranger is online now   Reply With Quote
Old 10-02-2019, 10:51 AM   #30
todoublez
Human being with feelings
 
todoublez's Avatar
 
Join Date: Aug 2019
Location: beijing
Posts: 87
Default

Quote:
Originally Posted by amagalma View Post
Thanks for the kind words!

I do not have a donation link, so if you want you can donate instead to any organization helping poor kids, refugees, animals, or any other good purpose you like.
What a kind soul u have !
Thank u again and wish u all the best
todoublez is online now   Reply With Quote
Old 11-07-2019, 01:23 AM   #31
Arcalaus
Human being with feelings
 
Join Date: Oct 2019
Posts: 1
Default Possible to change centerpoint of crossfae?

Hi @Amagalma. Thank you so much for your script, it's exactly what I needed. I do have one question - Is there a way I could edit the script so that rather than creating the crossfade to the left of the cursor it would actually use the cursor position as the centerpoint of the xfade?
Arcalaus 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 09:37 PM.


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