Trim to keep only the first 5 seconds of multiple OGG files with different lengths at once

I’m looking for a way to automate trimming multiple (150+) OGG audio files all with different lengths to keep only the first five seconds of them and in the final step, to merge them all to a single audio file. Now, I came across a thread asking about a similar issue, which lead me to this page. The problem with that solution is that my audio files don’t have all the same lenghts and are of different lengths, so I can’t just tell the Trim Extend plugin to remove the last n minutes of the files.
I’d appreciate your help.

You could make a Macro with the following steps

  1. Select - set the parameters as Start Time = 0, End Time =5, Relative to project start
  2. Trim Audio
  3. Export

This will give a load of 5 second files in the “cleaned” folder. You can import them into Audacity.
They will end up as separate tracks all starting at T=0
But then you can use Tracks > Align Tracks > Align End to End
And then Export the resuly (which will render the multiple tracks)

Not sure if this last bit can be automated by using Macros - but it’s easy enough to do by hand.


Thank you. I looked for Macros and couldn’t find them in Audacity 2.2.1. Is that the same as Chain?

“Macros” is a much enhanced update of “Chains”. You need Audacity 2.3.1 for Macros:

Thank you so much for the help. It worked well. :slight_smile:
But how do you cancel the whole process if you find you’ve entered some wrong commands in the Macros? I found 3 seconds works the best, but I couldn’t terminate the running Macro.

You don’t. You test your Macro on a small batch of files first, and don’t set it off on a large batch until you are sure that it does what you want.
In an emergency, you could force close Audacity (kill it from the Task Manager), but that is not recommended.

But yes I could see the advantage of an Abort button to stop an ongoing Macro cleanly.

I would not see it being a “cancel” and winding back the files already processed - It’s easy enough to delete the “cleaned” folder and its contents.