I have a lot of files which look something like:
and I want to remove the silence at the end (the short silence at the beginning too)–note the sections highlighted in dark red. It would be nice to remove the very short noise at the end (almost silent–see pink highlight) also.
I want to do this via a script (or by adding code to Audacity). Is there a (menu) command which selects leading/trailing silence so that “Delete” may be used on it? If not, would it be possible to write a simple Nyquist plug-in which accomplishes this “leading/trailing silence selection” (and does the delete too, if practical)?
“Truncate Silence” is the obvious choice, though note that if there are silences within the part that you want to keep, they may also be truncated. If this is a problem, then you will need a different solution.
That could very well be a problem as the kind of audio I am processing may well have internal, valid bits of silence which must be kept. Now that I know about this built-in effect I can plagiarize it to write my own custom editor which only do the front and back ends.
I’m also having trouble understanding the Truncate Silence directions in the Audacity 2.0.3 alpha development Manual–the relationship between “Min silence duration” and “Max silence duration”, specifically and what “Max…” means. I think we need to re-visit that page.
Are the valid silences inside the audio going to be shorter than the noise and absolute silence, as per your image? If so, set the “Min silence duration” to a tad more than the longest expected internal silence then the internal silences will not be truncated.
“Max” is the silence you want to be left with after truncation. In your case, just set Max to 1 ms - it cannot be less than that.
I’ve spoken off list to Martyn and he’s got some stuff on this that supersedes my patch. I’ve e-mailed him regarding a “current status” on this but I’ve not had a reply yet to that e-mail. I’m also keen to see an update to the the interface and manual in the near future (asap). I’ll give Martyn another nudge.
I think making “trim only the leading and trailing silence” (or some such wording) a checkbox within the current “Truncate Silence” effect could be very helpful.
My use case is starting Audacity recording then starting the recorded device playing (often 1 or more mics thru a mixer–don’t want computer fan noise in the mics)…record a bit…stop the recorded device playing…stop Audacity recording. The computer is in one room, the “device” is in another–about 30’ between them. At the end of a session I have lots of raw takes with long leaders and tailers.
Another use case is SoundLeach–it adds 10+ seconds on the end of a leach. Often the stuff being leached has a long video (with no audio) intro.
+1 . The only change that it would need in the GUI would be one or two check boxes:
Only from start [X] and/or only from end [X] of selection. (default off)
or
Only from ends of selection [X]
Will do.
There are also the closely related “Trim Track” and “Trim Extend” plug-ins: TrimTrack plug-in
and already on the wiki: “Extract Audio” and “Time Shifter”Missing features - Audacity Support
Can we rationalize these into one or two plug-ins?
Unfortunately not quite perfect.
There is a minor bug in which silence could be detected incorrectly in some stereo tracks.
I’ve posted a new version here: Trim Silence - #4 by steve
I would recommend updating to the new version.
Please let me know if you discover any problems with it and it’ll receive my prompt attention.
It’s probably not obvious for users that are looking for a specific tool for a task, but “Time Shifter” does pretty much the same thing as the “Extend” feature of “Trim Extend” - it adds silence to the beginning of the track.
I’ve just tried “Time Shifter” and unfortunately there is a bug in it. Shift a 30 second mono track by 2 seconds and 28 seconds of silence is added to the end in addition to the 2 seconds of silence at the beginning. I’ve not had chance to look closer at the problem, but something will need to be done.
I think that “Trim Silence” should probably be left as it is. Of this group of effects it is the only one that specifically deals with “truncating silence”.
The other three do some combination of “trim off audio” and/or “pad ends with silence”, so perhaps combine these three?
I was counting “Trim Track” and “Trim Extend” as one (both the same forum topic).
Either way, we have set of related functions:
Trim silence from ends of track selection.
Trim audio from ends of track selection.
Add silence to ends of track selection.
If not too confusing all options could be combined into one plug-in.
If that is too confusing then the functions could be split into two or more plug-ins.
5 separate plug-ins is too many.
One of the historical user cases was to provide an accessible way to delete a specified duration from the start of a track, but this feature is now available through the Selection Toolbar.
I expect that now the main user case is for adjusting the amount of lead in/out silence. If that is correct, then perhaps just one plug-in?
1 slider for lead in silence duration.
1 slider for lead out silence duration.
1 slider for silence threshold for existing silence.
If the existing silence is longer than specified, it is trimmed.
If the existing silence is shorter than specified, it is padded.
So as to avoid clicks where existing “silence” is not absolute silence, a fade to absolute silence could be automatically applied over the “silence” duration.