Removing silence from beginning and end of samples

Hello all!

This forum has been a wealth of information and assistance to so many people (including myself) for a long time.
I am looking for a simple single-macro solution for an issue I’m facing.

My main focus is cutting unnecessary blank audio from the beginning and end of my WAV files.

Some of my files include a very short burst of audio, followed by a period of silence. I would like to remove this entire section.

The audio following the above selection remains constant (normally a single solid tone with decay.)

Once the audio has hit a certain threshold, I would like to cut the remaining silent audio from the end of the file.

I have been using the trial-and-error method creating multiple macros to do this task…
What is the best way to accomplish this in a macro?

I’ve attached an example image of a waveform I’m working with. Some contain a tiny burst of sound at the very beginning.

Thanks for any and all assistance!
Example.png

Truncate silence ?

Yes, thanks, I’ve written a few macros with Truncate Silence but cannot get a single macro to accomplish the task.

Is there an IF/THEN statement that could help me with this :

  1. Check to see if there’s a silence at XXX location
  2. If no silence, stop the macro?

Macros are just lists of commands. There is no conditional logic.


You need to work out a specification which will suit all of the files. Perhaps something like:

  1. Remove first 0.5 seconds (to remove “short burst” if present)
  2. Remove final 0.5 seconds
  3. Trim Silence (See: Missing features - Audacity Support)