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



# Crossfades 2 items per track inside a Razor Edit area OR selected items

- If there is a Razor Edit area then the script works on the RE like my "amagalma_Crossfade items in Razor Edit area.lua" script, else works on the selected items
- If any two items are adjacent then it creates a crossfade on the left side of the items' touch point
- If any two items are almost adjacent and their gap is less or equal to the default crossfade time then a crossfade is created
- 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 (items do not have to touch - closes the gap)
- 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)
- You can set inside the script if you want to keep the time selection or remove it (default: remove)
- You can set inside the script if you want to keep selected the previously selected items or not (default: keep selected)
- Default crossfade length and type are gotten automatically from Reaper Preferences ("Overlap and crossfade items when splitting, length" and "Default crossfade shape")
- Fade shape can be specified inside the script (overrides the one set in the Preferences)

available in ReaPack
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 03-31-2021 at 03:32 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: 103
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: 794
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
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Thanks for the bug report, Gianfini!

I'll fix it on Sunday when I am back from vacations
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 09-03-2017, 02:03 PM   #5
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
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
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

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
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
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
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

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
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
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
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
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: South, UK
Posts: 14,214
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
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

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

I think this is the final one..

@musicbynumbers: cheers mate!
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 09-24-2017, 12:24 AM   #10
Gianfini
Human being with feelings
 
Join Date: Jan 2015
Posts: 794
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
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

* v1.32 (2017-09-25)
+ fixed occasional problem with adjacent items not crossfading (I think I have found a bug in Reaper)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 09-25-2017, 01:00 PM   #12
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
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
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 09-26-2017, 01:46 AM   #13
Gianfini
Human being with feelings
 
Join Date: Jan 2015
Posts: 794
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
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
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
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 10-11-2017, 03:29 PM   #15
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

* v1.35 (2017-10-12)
+ hopefully, all problems caused by floating point maths should have been fixed now
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 11-21-2017, 07:37 AM   #16
StuhRAH
Human being with feelings
 
Join Date: Apr 2014
Posts: 234
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
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
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)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 11-26-2017, 07:58 AM   #18
StuhRAH
Human being with feelings
 
Join Date: Apr 2014
Posts: 234
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
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
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
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
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, 318 views)
Itsmusicinmyears is offline   Reply With Quote
Old 03-31-2018, 12:52 AM   #22
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Thanks! I am currently away. When I return I 'll check what is wrong
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 04-01-2018, 03:04 PM   #23
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
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
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
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: 1,180
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
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 08-19-2018, 02:34 PM   #25
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
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
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
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: 1,180
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
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   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: 612
Default

loved this script,
works like a charm to me,
easy to use.
where can I donate you for expressing my appreciation ?
todoublez is offline   Reply With Quote
Old 09-29-2019, 12:13 PM   #28
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
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.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
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: 533
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 offline   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: 612
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 offline   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
Old 12-18-2019, 03:36 PM   #32
Eraz
Human being with feelings
 
Join Date: Nov 2019
Posts: 225
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 good idea!

I have a question to the script: In Cubase the max gap is set to 500ms fixed. Would it be possible to set also the max gap between the items in this script (as an addition to the crossfade time)?
Eraz is offline   Reply With Quote
Old 12-22-2019, 05:08 AM   #33
Eraz
Human being with feelings
 
Join Date: Nov 2019
Posts: 225
Default

@amagalma

I took some time and tweaked your script so now we can set the max gap time between items.

Also I added a crossfade on the left/middle/right option

https://forum.cockos.com/showthread....66#post2221366
Eraz is offline   Reply With Quote
Old 12-17-2020, 04:17 AM   #34
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

v1.50 changelog:
- fixed one bug, improved code in many places
- from now on the setting for the crossfade length and shape is gotten automatically from Reaper Preferences ("Overlap and crossfade items when splitting, length" and "Default crossfade shape")
- updated ReaPack info


- If any two items are adjacent then it creates a crossfade on the left side of the items' touch point
- If any two items are almost adjacent and their gap is less or equal to the default crossfade time then a crossfade is created
- 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 (items do not have to touch - closes the gap)
- 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)
- You can set inside the script if you want to keep the time selection or remove it (default: remove)
- You can set inside the script if you want to keep selected the previously selected items or not (default: keep selected)
- Default crossfade length and type are gotten automatically from Reaper Preferences ("Overlap and crossfade items when splitting, length" and "Default crossfade shape")
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 02-11-2021, 09:08 PM   #35
Tone Ranger
Human being with feelings
 
Tone Ranger's Avatar
 
Join Date: Jan 2019
Location: Toronto, Canada
Posts: 533
Default

Still loving this script! As of a few weeks ago, when I run the script the Console window appears (and stays) on screen. Previously this never happened - is there a preference to get it to close automatically?

I'm on Mac 10.14.6 and Reaper 6.23 here currently. Thanks!!
Tone Ranger is offline   Reply With Quote
Old 02-12-2021, 02:21 AM   #36
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

Amagalma will reply but I think the new version update has debug enabled. You can turn it off in the first few lines of the script.
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 02-12-2021, 04:21 AM   #37
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Shit! I had indeed forgotten it on! Sorry guys! v1.51 is up
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 02-12-2021, 01:55 PM   #38
Tone Ranger
Human being with feelings
 
Tone Ranger's Avatar
 
Join Date: Jan 2019
Location: Toronto, Canada
Posts: 533
Default

That's it!! Thanks so much! 🍻
Tone Ranger is offline   Reply With Quote
Old 03-29-2021, 08:33 PM   #39
Tone Ranger
Human being with feelings
 
Tone Ranger's Avatar
 
Join Date: Jan 2019
Location: Toronto, Canada
Posts: 533
Default

Amagalma - just curious if you have any plans to include razor edit selected areas into this script? Thanks again for a great tool!!
Tone Ranger is offline   Reply With Quote
Old 03-31-2021, 02:15 AM   #40
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Yes I am planning to merge it with my amagalma_Crossfade items in Razor Edit area.lua script, but haven't had the time yet..
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma 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:34 AM.


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