Build with this node

Start with a prompt in Studio, or copy it into your own coding agent.

Ask Studio

@maruaudio/dsp/analysis/loudness-meter is a rolling stereo power meter. Each channel passes @maru/analysis-k-weighting (metric 0) or nothing (metric 1), and L² + R² accumulates into 10 ms buckets held in a fixed 300-bucket ring, three seconds of capacity at any rate. The window sum is updated in constant time as buckets enter and leave, and every 1/30 s the reading is published as −0.691 + 10 log10(power) for K or 10 log10(power) for unweighted stereo power, floored at −120 dB. Power is the summed stereo energy per frame; it is not divided by two.

Parameters

PathSetterRange as codedDefaultUnit
metricconfigureLoudnessMeter(state, metric, windowSeconds)Rounded, 0 (K) or 1 (unweighted); non-finite → 00index
windowsame call0.1 to 3 s, rounded to whole 10 ms buckets; non-finite → 0.4 s0.4 s (40 buckets)s

A configuration change resets the history; repeating the same values does not.

Lifecycle

initLoudnessMeter(sampleRate) (rate 8 to 384 kHz, 48 kHz if non-finite) allocates both filters and the rings → configureLoudnessMeter → loudnessMeterTick(state, left, right) on every actual stereo frame, silence included → read db, ready and revision → resetLoudnessMeter. A Processor built at the maximum rate calls prepareLoudnessMeterSampleRate from prepare, then resetLoudnessMeter.

When to use it

A live momentary-style or custom-window level display at any tap of a signal chain, independent of any gain control. Loudmatch meters dry, unmatched, matched and audition outputs with it (loudness matching).

Limits

  • Stereo sample tick. A windowed power meter, not gated integrated LUFS and not a true-peak detector; see @maru/analysis-programme-meter for those.
  • ready needs a full window with no invalid bucket. A NaN, infinite or over-10⁶ sample makes its bucket invalid (stored as 0 energy) until it leaves the window.
  • At rates not divisible by 100 Hz the bucket is rounded to whole frames, so the window is a custom estimator rather than an exact standard timing.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

Dependents

No other node imports this one.

Used by