I’m trying to crossfade a series of audio clips. I know how to do this using 2 overlapping clips on different tracks, but I want to be able to crossfade many more than 2 – in fact, about 100. I obtain the clips as isolated clips in a single track, as shown in the top of the figure. I know that I can use sound finder to label these, export them, re-drag in that ordered sequence and then align the tracks end-to-end, as at the bottom of the figure.
But to crossfade I would need to select across every adjacent track – which would be a lot of work.
So I looked into Audacity’s Macro feature. But I became really puzzled as to how to make each selection prior to the crossfade? I looked and looked for tutorials and did learn a few things. But I can’t figure it out. Any help would be appreciated.
Macros only provide a “list of commands”. There is no “control logic”, so you can’t say “repeat these steps until the end”.
This means that to do this job with a Macro, you need to know exactly how many clips are in the track, and adjust the script to suit.
This example is for 6 clips in the track (5 crossfades), and the crossfade is the last 0.2 seconds of one clip with the first 0.2 seconds of the next clip.
Thank you for your help. I made a file containing one track with 5 clips to test your code and ran into the error shown in the top portion of the figure below. I then tried to reproduce the steps of your code manually up to the point where the error occurs and from what I can tell it looks like your code worked for the first crossfade – but I’m not sure.
Here are the details of what I did:
I went to the folder where the Audacity macros are stored and opened one of the txt files, renamed it to MultipleCrossFade.txt
pasted in all your code, closed it
closed Audacity & restarted Audacity
made a test.aup having 5 clips in one track
Put my cursor in that track and ran the MultipleCrossFade macro
I did this all twice just to make sure and got the exact same error each time, and took the screenshot
I then manually moved together all 5 clips on the one track, selected 0.2 on either side of the first 2 clips, and used Effect–>Crossfade clips and took the screenshot. I’m not used to using Crossfade clips, but I assume they work the same – even though the clips version has no way to enter parameters.
Let me know if there’s something else I can try. If this works, I can handle doing what’s needed for 100+ clips
I did a little more to investigate. First, I see that you want me to use 6, not 5, clips, so I added one. Second, I removed the gap preceding the first clip and found it did 2 crossfades. So I removed all the gaps between and when I ran it, this time it seemed to work.
This is great and I think I can work with it – just remove the gaps first – but if you have more to offer, I’ll take it.
Looking forward to more Macro capability in the future!
I believe I have the first 2 lines you mention. See the first screenshot.
I decided to make another test file with 6 clips, and I made a 2nd macro called removeGaps.txt with just those 2 lines and as the 2nd and 3rd screenshots show, do indeed remove the gaps.
But as you can see in the 4th screenshot, when I try the original macro it is now giving another error.
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:
Here are screenshots showing:
(A) before running any macro
(B) after running TwoCrossFades.txt (which gives the error)
(C) after running TwoCrossFadesExtraSelect.txt (which works, but skips a clip) Archive.zip (133 KB)
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.
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
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:
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:
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:
Put the first 2 lines of code into Excel cell A1
Put the next 3 lines of code (which will be repeated over and over) into cell A2
Drag cell A2 down to A200, which means 199 crossfades which is what you need for 200 clips