Auto-Trim Silence — User Guide

Detects the first-to-last sounding span of a Sound, adds configurable safety padding, optionally moves the boundaries outward to quieter multichannel points, and applies short edge fades.

Author: Shai CohenVersion: 0.7 (2026)Output: <source>_trimmed
Contents:

What this does

Auto-Trim Silence removes leading and trailing material outside the detected sounding region while trying not to cut into already-detected audio. It does not remove silence from the middle of the file. The script finds the first and last sounding boundaries, expands them with leading/trailing padding, optionally searches farther outward for quieter cut points, extracts that complete span, and applies short linear fades at the two output edges.

The processor accepts exactly one Praat Sound. Mono, stereo, and wider multichannel Sounds are supported. The output keeps the extracted channels together; the quiet-point search evaluates all channels when choosing a safer boundary.

Two detection strategies are available. Speech-band uses Praat's built-in silence detector and its pitch-floor-dependent intensity analysis. Full-band RMS performs no filtering and is intended for music, drones, noise, sub-bass, and other material for which a speech-oriented detector may be inappropriate.

Quick start

  1. Select exactly one Sound object in Praat.
  2. Run Auto-Trim Silence v0.7.
  3. For general musical material, start with Full-band RMS.
  4. Keep the default threshold of 35 dB below the analysis peak as a starting point.
  5. Use leading/trailing padding to preserve the desired amount of room before and after the detected sound.
  6. Leave the quiet-point search enabled if you want the padded boundaries to move only outward toward quieter samples.
  7. Enable visualization to inspect the detected span and final cut points before using the result downstream.
Threshold direction: larger values are more permissive because the detector accepts material farther below the analysis peak. A threshold of 35 dB means “treat material down to 35 dB below the reference peak as sounding,” subject to the minimum-duration rules.

Detection modes

1. Speech-band (Praat built-in)

This mode calls Praat's To TextGrid (silences) command. The form's Pitch floor, threshold, minimum silence duration, and minimum sounding duration are passed to that detector. The script then takes the start of the first interval labeled sounding and the end of the last interval labeled sounding.

To TextGrid (silences): pitch floor = Pitch_floor_Hz time step = 0 (Praat chooses it) silence threshold = -Threshold_dB_below_peak minimum silent interval = Min_silence_duration_sec minimum sounding interval = Min_sounding_duration_sec

Pitch_floor_Hz is used only in this mode.

2. Full-band RMS (music-safe)

This mode analyzes the unfiltered Sound in overlapping windows:

window length = 20 ms hop length = 5 ms reference = maximum RMS among all analysis windows window dB = 20 log10(window RMS / maximum-window RMS) sounding = window dB >= -Threshold_dB_below_peak

The window count uses ceiling, so a final partial tail is not silently omitted. If the Sound is shorter than one full 20 ms window, one clipped analysis window is still evaluated.

After the initial classification, the script applies two duration rules in a fixed order:

  1. Remove short sounding runs first. A run of N overlapping windows has duration 20 ms + (N-1) × 5 ms. Runs shorter than Min sounding duration are changed to silence.
  2. Bridge short interior silent gaps second. Interior silent runs shorter than Min silence duration are changed to sounding. Leading and trailing silence are never bridged outward.

The first remaining sounding window supplies the detected start, and the end of the last remaining sounding window supplies the detected end.

Processing pipeline

1. Detect first/last sounding span 2. Apply leading and trailing padding 3. Clamp padding to the original Sound boundaries 4. Optional outward-only quiet-point search 5. Extract trimStart ... trimEnd 6. Apply short linear fades at the extracted edges 7. Rename result to <source>_trimmed 8. Draw visualization and/or play if requested

Padding

Leading_padding_ms moves the start earlier; Trailing_padding_ms moves the end later. Padding cannot extend beyond the original Sound.

Outward-only quiet-point search

After padding, each boundary can move farther away from the detected sounding region by at most Quiet_point_search_ms. The search never moves a cut point inward toward detected audio.

The search advances in sample-period steps. At each candidate time it samples every channel using cubic interpolation, takes the largest absolute amplitude across channels, and chooses the candidate with the smallest such value. This is a quiet-point criterion, not a zero-crossing requirement. If the padded boundary itself is already the quietest candidate, it remains unchanged.

candidate score(t) = max over channels |sample(channel, t)| chosen boundary = outward candidate with minimum score(t)

Extraction and fades

The selected span is extracted with a rectangular window and becomes <source>_trimmed. The output time domain begins at zero. A linear fade-in and fade-out are then applied locally at the two output edges.

The requested fade length is limited to at most half of the output duration. Therefore very short outputs can receive a shorter fade than requested. A requested fade of 0 ms disables the fade.

Parameters

ParameterDefaultActual role
Detection_modeFull-band RMSChooses Praat's built-in speech-band detector or the script's unfiltered RMS detector.
Pitch_floor_Hz100 HzUsed only by Speech-band mode. Positive value.
Threshold_dB_below_peak35 dBMust be ≥ 0. Speech-band uses it as the negative silence threshold; Full-band compares each window with the loudest RMS window.
Min_silence_duration_sec0.1 sMinimum silent duration. In Full-band mode, shorter interior silent runs are bridged after short sounding runs are removed.
Min_sounding_duration_sec0.02 sMinimum sounding duration. In Full-band mode, shorter sounding runs are discarded first.
Leading_padding_ms30 msExtra retained time before the detected sounding start. Must be ≥ 0.
Trailing_padding_ms100 msExtra retained time after the detected sounding end. Must be ≥ 0.
Edge_fade_ms5 msRequested linear fade at both extracted edges. Must be ≥ 0 and is capped at half the output duration.
Quiet_point_search_ms10 msMaximum outward search distance for quieter multichannel cut points. Must be ≥ 0. Set to 0 to keep the padded boundaries unchanged.
Draw_visualizationYesDraws the decision and result panels in the Picture window.
Play_resultNoPlays the selected trimmed Sound after processing.

Visualization

The Picture window uses one common amplitude range for the original and trimmed waveforms, based on the larger absolute peak of the two with 15% headroom. This makes the amplitude comparison meaningful rather than independently auto-scaling the panels.

Limits and interpretation