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.
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.
Quick start
- Select exactly one Sound object in Praat.
- Run
Auto-Trim Silence v0.7. - For general musical material, start with Full-band RMS.
- Keep the default threshold of 35 dB below the analysis peak as a starting point.
- Use leading/trailing padding to preserve the desired amount of room before and after the detected sound.
- Leave the quiet-point search enabled if you want the padded boundaries to move only outward toward quieter samples.
- Enable visualization to inspect the detected span and final cut points before using the result downstream.
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.
Pitch_floor_Hz is used only in this mode.
2. Full-band RMS (music-safe)
This mode analyzes the unfiltered Sound in overlapping windows:
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:
- 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. - 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
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.
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
| Parameter | Default | Actual role |
|---|---|---|
| Detection_mode | Full-band RMS | Chooses Praat's built-in speech-band detector or the script's unfiltered RMS detector. |
| Pitch_floor_Hz | 100 Hz | Used only by Speech-band mode. Positive value. |
| Threshold_dB_below_peak | 35 dB | Must be ≥ 0. Speech-band uses it as the negative silence threshold; Full-band compares each window with the loudest RMS window. |
| Min_silence_duration_sec | 0.1 s | Minimum silent duration. In Full-band mode, shorter interior silent runs are bridged after short sounding runs are removed. |
| Min_sounding_duration_sec | 0.02 s | Minimum sounding duration. In Full-band mode, shorter sounding runs are discarded first. |
| Leading_padding_ms | 30 ms | Extra retained time before the detected sounding start. Must be ≥ 0. |
| Trailing_padding_ms | 100 ms | Extra retained time after the detected sounding end. Must be ≥ 0. |
| Edge_fade_ms | 5 ms | Requested linear fade at both extracted edges. Must be ≥ 0 and is capped at half the output duration. |
| Quiet_point_search_ms | 10 ms | Maximum outward search distance for quieter multichannel cut points. Must be ≥ 0. Set to 0 to keep the padded boundaries unchanged. |
| Draw_visualization | Yes | Draws the decision and result panels in the Picture window. |
| Play_result | No | Plays 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.
- Trim Decision: original waveform over the complete original time span.
- Red regions: material removed before the final start and after the final end.
- Blue dashed lines: first and last boundaries returned by the detector before padding/search.
- Amber solid lines: final trim points after padding and quiet-point search.
- Trimmed Result: extracted waveform, plotted from 0 to the output duration using the same amplitude scale.
- Summary strip: detected times, duration constraints, padding, quiet-point search limit, final cut points, removed durations, and output peak.
Limits and interpretation
- This is an edge trimmer, not a silence remover. It preserves everything between the first and last detected sounding regions, including internal rests.
- Full-band RMS is relative, not absolute. Its 0 dB reference is the loudest 20 ms analysis window in the file, not full scale and not the single largest sample.
- Speech-band and Full-band thresholds are analogous but not numerically identical detectors. They use different underlying level analyses.
- Quiet-point alignment is not zero-crossing alignment. It minimizes the worst instantaneous channel magnitude over the allowed outward search region.
- The search is conservative with respect to detected content. It can retain more material than padding alone, but it cannot move the boundary inward into the detected sounding span.
- Squarely silent files fail explicitly. If no sounding material survives detection, the script exits rather than creating an arbitrary output.
- No peak normalization is applied. Apart from the short edge fades, sample amplitudes inside the extracted region are not gain-scaled.