SonicFrame v1.3.2

Skip silences

Long pauses in a voice note or a lecture, skipped while it plays forward. It lands just before each pause ends, so the next word is never clipped.

Adding it

import { silencesFromPeaks, skipSilences } from 'sonicframe';

frame.use(
    skipSilences({
        silences: silencesFromPeaks(peaks, duration, { minDuration: 1 }),
        dim: true,
    }),
);

The shaded stretches are skipped. Seeking into one by hand still works.

Finding the silences

  • silencesFromPeaks(peaks, duration, { threshold, minDuration }) works from the peaks you already have.
  • findSilences(samples, sampleRate, { thresholdDb, minDuration }) works from decoded samples, more precisely.

Both are pure, on sonicframe/analysis too, so a server can find them once and store them.

Options

Option Default What it does
silences [] The stretches to skip.
lead 0.1 Seconds before a silence's end to land; at least 0.
dim Shade the silences on the wave.
color var(--sonicframe-dim) The shade's color: any CSS color or var(--name).
pixelSnap false The shade's edges on whole device pixels: a little crisper, each moved by less than half a pixel.