Defines an audio file's waveform, the bars the player seeks on: how many peaks it has, and how they are taken from the samples. The server makes an uploaded file's from its decoded audio (api/lib/ffmpeg.ts), and the dump form a local file's in the browser (src/utils/player/waveform.ts), both with peaksOf, so the two draw alike.

Functions

f
peaksOf(
samples: ArrayLike<number>,
n?: number
): number[]

Returns n peaks of samples, each the loudest of its slice, scaled so the loudest of all is 1 and rounded to three places: a quiet recording fills the waveform as a loud one does. samples may be signed, as audio is, or already peaks of smaller slices. Silence gives zeros.

Interfaces

I
DumpWaveform

Returned by GET /api/dumps/:dumpId/waveform for an audio file dump, to the player's waveform.

Variables

v
WAVEFORM_PEAKS: 150

How many peaks, and so bars, a waveform has.