@maruaudio/dsp/analysis/programme-meter is a continuous stereo BS.1770 programme meter. Both channels pass @maru/analysis-k-weighting and @maru/analysis-true-peak; K-weighted L² + R² accumulates into exact 100 ms sample buckets, from which momentary (400 ms) and short-term (3 s) loudness advance. Integrated loudness gates overlapping 400 ms blocks at −70 LUFS absolute and −10 LU relative; loudness range uses 3 s observations each second with −70 and −20 gates and the 10th and 95th percentiles. Gates and percentiles use fixed 0.01 LU histograms (20001 bins) with Fenwick-tree queries, while energy sums stay unquantized. It also reports sample and true peak, RMS, crest factor, PLR, correlation, balance and width.
Parameters
| Path | Setter | Range as coded | Default | Unit |
|---|---|---|---|---|
running | setProgrammeMeterRunning | ≥ 0.5 runs, else stops | 0 (stopped) | flag |
targetLufs | state field written by the owner | none; affects exceedance reporting only | −14 | LUFS |
truePeakCeiling | state field written by the owner | none; affects exceedance reporting only | −1 | dBTP |
Lifecycle
initProgrammeMeter(sampleRate) (48 kHz unless 0 < rate < 10⁶) allocates the filters, histograms, 30 buckets and a 128-row, 13-column telemetry history → setProgrammeMeterRunning(state, 1) → programmeMeterTick(state, l, r) per frame. Stopping flushes the true-peak tail with twelve zeros that are not counted as programme, and keeps results; resuming after measured audio starts an incomplete new segment. interruptProgrammeMeter begins a new epoch without merging the gap; resetProgrammeMeter starts a complete new run and keeps running state and targets. programmeMeterStatus returns 0 collecting, 1 ready, 2 interrupted (sticky until reset) or 3 unavailable.
When to use it
A mastering or broadcast-style loudness and peak monitor that runs for the length of a programme. The Metergram module uses it (loudness matching).
Limits
- Stereo sample tick; the meter only observes and never changes audio.
- Supported rates are 22.05 to 192 kHz in whole 10 Hz steps; others report status 3 and ignore ticks.
- Readiness is sample-counted. Silence is valid but never integrated; LRA is not ready before sixty measured seconds.
- A NaN or over-10⁶ sample is invalid and starts a separate epoch. History keeps the newest 128 rows (one per 100 ms bucket) and counts truncation.