How to trim using macro?

Questions, discussion and recipes for scripting and batch processing in Audacity.
See also the "Scripting" section of the Audacity manual.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
McCoyCORE
Posts: 2
Joined: Sun Apr 11, 2021 8:34 pm
Operating System: Windows 10

How to trim using macro?

Post by McCoyCORE » Sun Apr 11, 2021 8:37 pm

I need to use a macro to batch process audio files and remove the silence at the beginning and ending of the audio tracks. I don't want to remove any silence within the audio. How can I do this?

v3.0.0
Windows 10

kozikowski
Forum Staff
Posts: 69218
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: How to trim using macro?

Post by kozikowski » Mon Apr 12, 2021 12:03 am

Maybe not with a Macro. Macros can't make decisions and as far as I know, they can't address specific parts of a sound file. They're good for calling tools in order.

Run Amplify > Run Compressor > Run Tone Controls > Stop.

I think lately, you can make them open a file, run some tools and save a file, but I think that's it. Even that can cause problems because I don't think you can change the filename—but somebody will correct me.

Koz

steve
Site Admin
Posts: 81226
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: How to trim using macro?

Post by steve » Mon Apr 12, 2021 8:37 am

McCoyCORE wrote:
Sun Apr 11, 2021 8:37 pm
I need to use a macro to batch process audio files and remove the silence at the beginning and ending of the audio tracks. I don't want to remove any silence within the audio. How can I do this?
There's a Nyquist plug-in for that: https://wiki.audacityteam.org/wiki/Nyqu ... im_Silence

See here for downloading and installing Nyquist plug-ins: https://wiki.audacityteam.org/wiki/Down ... s#download
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Manjel
Posts: 11
Joined: Wed Apr 07, 2021 6:06 pm
Operating System: Windows 10

Re: How to trim using macro?

Post by Manjel » Thu Apr 22, 2021 11:36 pm

Asuming the silence at the begining and at the end is not too long, this should do it:
Select:End="0.200000" Mode="Set" Start="0"
TruncateSilence:Action="Truncate Detected Silence" Compress="50" Independent="0" Minimum="0.030000" Threshold="-40" Truncate="0.004000"
Select:End="0.400000" Mode="Set" RelativeTo="ProjectEnd" Start="0"
TruncateSilence:Action="Truncate Detected Silence" Compress="50" Independent="0" Minimum="0.030000" Threshold="-40" Truncate="0.004000"

Post Reply