@audio/ loudness-lra
Status calibrated
npm1.3.0licenseMIT
Loudness range (LRA) — EBU Tech 3342 short-term distribution, P95−P10 after gating
import lra from '@audio/loudness-lra'
Loudness range per EBU Tech 3342: K-weighted (via @audio/weighting-k) channel-summed short-term loudness on a 3 s window at 100 ms hop → absolute gate at −70 LUFS → relative gate at −20 LU below the abs-gated mean → LRA = P95 − P10 of the remaining distribution, in LU.
let range = lra(channels, { fs: 48000 }) // channels: Float32Array (mono) or Float32Array[] (multichannel)
| Param | Default | |
|---|---|---|
fs |
48000 |
Sample rate, Hz |
weights |
BS.1770-4 Table 3 | Per-channel gain array. Defaults by channel count assuming SMPTE/WAV/Web Audio order: 1/2ch all 1.0, 4ch [1,1,1.41,1.41], 5ch [1,1,1,1.41,1.41], 6ch [1,1,1,0,1.41,1.41] (LFE excluded), 8ch [1,1,1,0,1,1,1.41,1.41] (7.1, Table 4). Other counts default to 1.0 per channel — pass explicitly for layouts in a different order |
Returns a number (LRA in LU), 0 if fewer than 2 blocks survive gating, or null for silence / input shorter than the 3 s short-term window.
Use when: measuring program dynamics for broadcast delivery specs (EBU R128 / ATSC A/85) that cap LRA alongside integrated loudness.
Per ITU-R BS.1770-4 (K-weighting, gating) and EBU Tech 3342 (short-term window, percentile range); differential-tested against libebur128 / ffmpeg ebur128.
Part of @audio/loudness — the loudness family umbrella. Documented from the reference implementation.
MIT © audiojs