Macro selection help for crossfading multiple audio clips
Forum rules
This forum is for Audacity on macOS 10.4 and later.
Please state which version of macOS you are using,
and the exact three-section version number of Audacity from "Audacity menu > About Audacity".
Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Please state which version of macOS you are using,
and the exact three-section version number of Audacity from "Audacity menu > About Audacity".
Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Macro selection help for crossfading multiple audio clips
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.
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.
- Attachments
-
- Screen Shot 2020-01-17 at 5.21.38 PM.jpg (86.29 KiB) Viewed 404 times
Re: Macro selection help for crossfading multiple audio clips
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.
Unfortunately we don't yet have the facility to import/export macros, but you can do it manually. See here for details: https://manual.audacityteam.org/man/man ... html#store
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.
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>"
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>"
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: Macro selection help for crossfading multiple audio clips
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:
1) I went to the folder where the Audacity macros are stored and opened one of the txt files, renamed it to MultipleCrossFade.txt
2) pasted in all your code, closed it
3) closed Audacity & restarted Audacity
4) made a test.aup having 5 clips in one track
5) 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
Here are the details of what I did:
1) I went to the folder where the Audacity macros are stored and opened one of the txt files, renamed it to MultipleCrossFade.txt
2) pasted in all your code, closed it
3) closed Audacity & restarted Audacity
4) made a test.aup having 5 clips in one track
5) 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
- Attachments
-
- Screen Shot 2020-01-17 at 6.53.03 PM.jpg (91.44 KiB) Viewed 393 times
Re: Macro selection help for crossfading multiple audio clips
Which version of Audacity are you using? (look in "Audacity menu > About Audacity")
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: Macro selection help for crossfading multiple audio clips
I'm using Audacity 2.3.2 on Catalina(Mac)
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 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!
Re: Macro selection help for crossfading multiple audio clips
Are you sure that you included the first two lines:
They should remove all of the gaps.
Code: Select all
SelectAll:
TruncateSilence:Action="Truncate Detected Silence" Compress="50" Independent="0" Minimum="0.001" Threshold="-60" Truncate="0"9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: Macro selection help for crossfading multiple audio clips
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.
But as you can see in the 4th screenshot, when I try the original macro it is now giving another error.
Re: Macro selection help for crossfading multiple audio clips
and when I remove the first gap in front of the clips, I get the original error again:
Re: Macro selection help for crossfading multiple audio clips
You will need to do some troubleshooting - it works for me, and I've even tried on the old Audacity 2.3.2
In the Macro Editor, build the script up one line at a time, and test.
First test:
Expected result = Selects all, and removes the gaps.
Second test:
Expected result = All gaps removed, and second clip is selected.
Third test:
Expected result = All gaps removed, selected region is 0.4 seconds long, spanning the "split" between the first and second clips.
Fourth test:
Expected result = All gaps removed, and first split crossfaded.
and so on.
At what point does the script break down?
In the Macro Editor, build the script up one line at a time, and test.
First test:
Code: Select all
SelectAll:
TruncateSilence:Action="Truncate Detected Silence" Compress="50" Independent="0" Minimum="0.001" Threshold="-60" Truncate="0"Second test:
Code: Select all
SelectAll:
TruncateSilence:Action="Truncate Detected Silence" Compress="50" Independent="0" Minimum="0.001" Threshold="-60" Truncate="0"
SelNextClip:
Third test:
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"
Fourth test:
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>"
and so on.
At what point does the script break down?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: Macro selection help for crossfading multiple audio clips
I can’t work on this right now but I will follow your instructions and get back to you when I can