Technical Documentation
Audio Silence Detection & Timeline Export Methodology
TrimGap executes every editing operation locally inside your browser using open web media APIs and published broadcast interchange formats. This document explains each signal-processing step, subtitle retiming rule, and timeline serialization convention so editors can inspect and verify how rough cuts are generated.
1. Windowed RMS Loudness & Silence Segmentation
When you drop a media file, the audio stream is decoded locally into 32-bit floating-point PCM channels and mixed down to mono. The signal is partitioned into fixed 10-millisecond windows. For each window containing N samples, root-mean-square (RMS) energy is converted to decibels relative to full scale (dBFS):
RMS = sqrt((1 / N) * sum(x_i^2)) dBFS = max(-96, 20 * log10(RMS))
Contiguous windows below the selected Silence Threshold (-50 dB to -15 dB, default -32 dB) are flagged as candidate dead air only when their unbroken duration meets or exceeds Min Silence Duration (default 0.45s). Every speech region outside qualifying silences is then expanded on both ends by Speech Padding (default 0.12s) to protect soft initial consonants and trailing decays. Adjacent padded regions separated by less than 40ms are automatically merged to eliminate abrupt micro-cuts.
2. Caption Timing Alignment & Jump-Cut Retiming
Word-level captions are either generated on-device inside an isolated Web Worker using quantized speech recognition models (accelerated via WebGPU when available, with WebAssembly fallback) or parsed from SubRip (.srt) and WebVTT (.vtt) files. When importing phrase-level cues, individual word boundaries are distributed proportionally by character length so animated word highlights match natural reading cadence.
Whenever silence segments are removed, each caption word is mapped onto the contiguous output timeline: words wholly inside cut regions are omitted, words overlapping a kept boundary are clamped to the kept region, and start/end times are shifted by the cumulative duration of preceding cuts. Both burned-in video captions and exported .srt/.vtt files use this exact retimed coordinate space.
3. 0-Second NLE Interchange & Local Video Rendering
For lossless round-tripping with desktop editors, TrimGap converts kept segment boundaries into sequence-accurate frame integers and writes three open interchange formats directly in memory:
- FCP7 XMEML v4 (.xml): Linked video and audio clipitems referencing the original local media file for Premiere Pro and DaVinci Resolve.
- FCPXML v1.10 (.fcpxml): Rational time spine asset-clips (e.g., 1001/30000s for 29.97 fps) for Final Cut Pro and DaVinci Resolve.
- CMX 3600 EDL (.edl): Standard non-drop-frame SMPTE timecode edit lists (HH:MM:SS:FF) for broad NLE and DAW compatibility.
For direct browser video exports, kept audio regions are stitched with 5-millisecond linear boundary crossfades to avoid clicks, while cropped video frames and animated caption overlays are composited on a 2D canvas and encoded via W3C WebCodecs to MP4 (with automatic MediaRecorder WebM fallback when WebCodecs encoders are unavailable).
4. Public Technical Standards Referenced
Our audio analysis, caption formatting, and timeline serialization adhere to the following public specifications:
- W3C Web Audio API Specification
Defines in-browser PCM decoding (AudioContext.decodeAudioData) and sample-level offline resampling used for RMS loudness envelopes and audio stitching.
- W3C WebCodecs Specification
Provides hardware-accelerated VideoEncoder and AudioEncoder interfaces used to render watermark-free local MP4 exports directly in the browser.
- W3C WebVTT: The Web Video Text Tracks Format
Specifies the cue timing syntax and formatting rules implemented by TrimGap when importing, retiming, and exporting .vtt subtitle tracks.
- Apple Final Cut Pro XML (FCPXML) Reference
Defines rational frame-time representation and spine asset-clip structures used in TrimGap's 0-second .fcpxml exports.
- ITU-R BS.1770 Audio Programme Loudness Measurement
Establishes digital full-scale (dBFS) root-mean-square energy measurement principles that inform TrimGap's decibel silence thresholding.