57 lines
3.0 KiB
Markdown
57 lines
3.0 KiB
Markdown
# @suaveplan/audio-analysis-loudness - Universal ITU-R BS.1770-4 loudness analyser: K-weighting, gated integrated LUFS, momentary and short-term loudness, EBU R128 loudness range, 4x oversampled true-peak detection, RMS, sample peak, and per-channel DC offset. Streaming and block-level metering for broadcast compliance, mastering, and auto-normalisation pipelines.
|
||
|
||
Universal ITU-R BS.1770-4 loudness analyser. Drop-in `AnalysisOp` plugin for
|
||
the `@suaveplan/audio-*` family.
|
||
|
||
<!-- begin:auto-docs -->
|
||
## Documentation tree
|
||
|
||
- [loudness-range](./src/algorithms/loudness-range.md) — `loudness-range` computes the EBU Tech 3342 loudness range (LRA, in LU) — a statistical measure of dynamic spread. It t…
|
||
- [lufs](./src/algorithms/lufs.md) — `lufs` contains the kernel of BS.1770-4 loudness measurement: the per-block mean-square energy calculation, the BS.1770…
|
||
- [true-peak](./src/algorithms/true-peak.md) — `true-peak` implements true-peak (dBTP) detection via 4× polyphase oversampling, per ITU-R BS.1770-4 Annex 2. Sample pe…
|
||
- [error-codes](./src/error-codes/error-codes.md) — This module owns the stable, machine-readable error-code registry for `@suaveplan/audio-analysis-loudness`. Every fault…
|
||
- [error-codes](./src/error-codes/error-codes.md) — This module owns the stable, machine-readable error-code registry for `@suaveplan/audio-analysis-loudness`. Every fault…
|
||
- [filters](./src/filters/k-weighting.md) — `k-weighting` implements the ITU-R BS.1770 K-weighting filter — a two-stage IIR biquad cascade applied per channel befo…
|
||
- [k-weighting](./src/filters/k-weighting.md) — `k-weighting` implements the ITU-R BS.1770 K-weighting filter — a two-stage IIR biquad cascade applied per channel befo…
|
||
- [meter](./src/meter/loudness-meter.md) — `LoudnessMeter` is the orchestration layer of `@suaveplan/audio-analysis-loudness`. It wires the K-weighting filter, th…
|
||
- [loudness-meter](./src/meter/loudness-meter.md) — `LoudnessMeter` is the orchestration layer of `@suaveplan/audio-analysis-loudness`. It wires the K-weighting filter, th…
|
||
<!-- end:auto-docs -->
|
||
|
||
## Features
|
||
|
||
- Integrated LUFS via two-gate algorithm (absolute −70, relative −10 LU).
|
||
- Momentary (400 ms) and short-term (3 s) loudness.
|
||
- EBU Tech 3342 loudness range (LRA in LU).
|
||
- 4× oversampled true-peak detection (dBTP, per BS.1770-4 Annex 2).
|
||
- Sample peak (dB), RMS (dB), per-channel DC offset.
|
||
- Streaming `analyzeStream` whose final yield equals batch `analyze`.
|
||
- Real-time `analyzeBlock` for live meters.
|
||
- Finite silence floors — no `-Infinity` ever leaks to consumers.
|
||
- OTel span `audio.analysis.loudness`, counter, histograms.
|
||
- Pure universal: no `window`, no `document`, no `node:fs`.
|
||
|
||
## Install
|
||
|
||
```bash
|
||
bun add @suaveplan/audio-analysis-loudness
|
||
```
|
||
|
||
## Quick start
|
||
|
||
```ts
|
||
import { LoudnessMeter } from "@suaveplan/audio-analysis-loudness";
|
||
|
||
const meter = new LoudnessMeter();
|
||
const result = await meter.analyze(doc);
|
||
console.log({
|
||
integrated: result.lufs,
|
||
range: result.loudnessRange,
|
||
truePeak: result.truePeak,
|
||
});
|
||
```
|
||
|
||
## License
|
||
|
||
MIT
|
||
|