Page 2 of 2

Re: Macro selection help for crossfading multiple audio clips

Posted: Sat Jan 18, 2020 1:32 pm
by tlm
I did the suggested troubleshooting. The error seems to come after a 2nd crossfade command. This means it is happening when the macro is trying to crossfade the clip that has previously been crossfaded.

I found that the error does not occur when an extra SelNextClip: statement is inserted so that the macro is never trying to crossfade the clip that has previously been crossfaded. But this means that we're skipping a clip.

So that you can reproduce exactly, I'm attaching a compressed version of a test project (Archive.zip -- it's just something very small I found) and the text for the macros I used. I used 3 macros:

1) OneCrossFade.txt (works)

Code: Select all

SelectAll:
TruncateSilence:Action="Truncate Detected Silence" Compress="50" Independent="0" Minimum="0.001" Threshold="-60" Truncate="0"
SelNextClip:
SelectTime:End="0.2" RelativeTo="SelectionStart" Start="-0.2"
CrossfadeClips:Use_Preset="<Factory Defaults>"
2) TwoCrossFades.txt (errors at 2nd crossfade step)

Code: Select all

SelectAll:
TruncateSilence:Action="Truncate Detected Silence" Compress="50" Independent="0" Minimum="0.001" Threshold="-60" Truncate="0"
SelNextClip:
SelectTime:End="0.2" RelativeTo="SelectionStart" Start="-0.2"
CrossfadeClips:Use_Preset="<Factory Defaults>"
SelNextClip:
SelectTime:End="0.2" RelativeTo="SelectionStart" Start="-0.2"
CrossfadeClips:Use_Preset="<Factory Defaults>"
3) TwoCrossFadesExtraSelect.txt (works, but skips a clip)

Code: Select all

SelectAll:
TruncateSilence:Action="Truncate Detected Silence" Compress="50" Independent="0" Minimum="0.001" Threshold="-60" Truncate="0"
SelNextClip:
SelectTime:End="0.2" RelativeTo="SelectionStart" Start="-0.2"
CrossfadeClips:Use_Preset="<Factory Defaults>"
SelNextClip:
SelNextClip:
SelectTime:End="0.2" RelativeTo="SelectionStart" Start="-0.2"
CrossfadeClips:Use_Preset="<Factory Defaults>"
Here are screenshots showing:
(A) before running any macro
before.jpg
before.jpg (234.08 KiB) Viewed 232 times
(B) after running TwoCrossFades.txt (which gives the error)
TwoCrossFades.jpg
TwoCrossFades.jpg (228.04 KiB) Viewed 232 times
(C) after running TwoCrossFadesExtraSelect.txt (which works, but skips a clip)
TwoCrossFadesExtraSelect.jpg
TwoCrossFadesExtraSelect.jpg (240.3 KiB) Viewed 232 times

Re: Macro selection help for crossfading multiple audio clips

Posted: Sat Jan 18, 2020 4:11 pm
by steve
tlm wrote:
Sat Jan 18, 2020 1:32 pm
So that you can reproduce exactly, I'm attaching a compressed version of a test project
Good idea, but unfortunately "Compressed copy" does not retain gaps in tracks.
I can use "Detach at Silences" to separate the clips, but there is a tiny, one sample length clip at time = 8.749 seconds.
The Macro will fail if any clip is less than 0.2 seconds (the length of the fade).
Check your project carefully and ensure there are no tiny clips hiding in the track.

Re: Macro selection help for crossfading multiple audio clips

Posted: Sat Jan 18, 2020 5:31 pm
by tlm
The exact version of the test file I used above makes a 2.2MB archive -- slightly above the limit for this forum's attachments. So I removed the last 3 clips and that made it small enough; it's called archive.zip again. I also unarchived it myself and ran all 3 macros mentioned above with the same results.

Before I did that I looked carefully for tiny clips yet saw none. But since you mentioned a very short clip "at time = 8.749", I selected 8.748 - 8.750 and hit delete. But when I ran the macros, I got the same results -- the same error.

So now you should have the exact setup to reproduce what I'm experiencing.

Edit: I can run the Windows version of Audacity 2.3.3 on my Mac via VirtualBox. I just tried it using the archive.zip in this message and got the exact same results as I do running in Mac OSX

Thanks

Re: Macro selection help for crossfading multiple audio clips

Posted: Sat Jan 18, 2020 6:39 pm
by steve
Congratulations, you've uncovered a bug in Audacity.
You can work around it by changing the second line of the Macro to:

Code: Select all

TruncateSilence:Action="Truncate Detected Silence" Compress="50" Independent="0" Minimum="0.001" Threshold="-60" Truncate="0.001"
Meanwhile, I'll try to work out why the bug is happening ;)

Workaround Works!

Posted: Sat Jan 18, 2020 9:10 pm
by tlm
I've confirmed that the workaround you offered works. That is, I ran your code with the workaround added on the sample file I provided in my latest Archive.zip. Here is that code if anyone wants to try it in the future:

Code: Select all

SelectAll:
TruncateSilence:Action="Truncate Detected Silence" Compress="50" Independent="0" Minimum="0.001" Threshold="-60" Truncate="0.001"
SelNextClip:
SelectTime:End="0.2" RelativeTo="SelectionStart" Start="-0.2"
CrossfadeClips:Use_Preset="<Factory Defaults>"
SelNextClip:
SelectTime:End="0.2" RelativeTo="SelectionStart" Start="-0.2"
CrossfadeClips:Use_Preset="<Factory Defaults>"
SelNextClip:
SelectTime:End="0.2" RelativeTo="SelectionStart" Start="-0.2"
CrossfadeClips:Use_Preset="<Factory Defaults>"
SelNextClip:
SelectTime:End="0.2" RelativeTo="SelectionStart" Start="-0.2"
CrossfadeClips:Use_Preset="<Factory Defaults>"
SelNextClip:
SelectTime:End="0.2" RelativeTo="SelectionStart" Start="-0.2"
CrossfadeClips:Use_Preset="<Factory Defaults>"
SelNextClip:
SelectTime:End="0.2" RelativeTo="SelectionStart" Start="-0.2"
CrossfadeClips:Use_Preset="<Factory Defaults>"
Also, I did 2 more tests, one with 77 clips and one with 200 clips. Here's the image for the 200 clips in Audacity:
200 clips.jpg
200 clips.jpg (243.55 KiB) Viewed 211 times
I always made sure there was no blank space before the first clip or after the last clip. Each took less than 15 seconds on my MacBook Pro (late 2015, 2.7GHz with 16MB).

How do you quickly make the 200 clip macro? There might be a better way, but this is what I did:
1) Put the first 2 lines of code into Excel cell A1
2) Put the next 3 lines of code (which will be repeated over and over) into cell A2
3) Drag cell A2 down to A200, which means 199 crossfades which is what you need for 200 clips
4) Copy A1 to A200 and paste to Word
5) Copy all within that Word file and paste into a .txt file in the Audacity Macro folder
which is located here: https://manual.audacityteam.org/man/man ... html#store
6) close and restart Audacity

Thanks again to steve!!! This was the macro tutorial I needed.

Re: Macro selection help for crossfading multiple audio clips

Posted: Sun Jan 19, 2020 11:54 am
by steve
tlm wrote:
Sat Jan 18, 2020 9:10 pm
Thanks again to steve!!! This was the macro tutorial I needed.
You're welcome. It would have been a lot easier if we hadn't encountered that bug, but at least the bug is now logged on the bug tracker.