/** * Loudness and level measurement. * * ## Why LUFS rather than peak * * Peak normalisation makes files *the same height*, not the same loudness. A * dense pop master and a sparse acoustic recording can share an identical peak * and still differ by 10 dB in perceived level — which is why a naive * "normalise to 0 dBFS" playlist lurches in volume between tracks. * * ITU-R BS.1770 measures perceived loudness instead: K-weight the signal * (roughly, model the ear's frequency response), take the mean square over * overlapping 400 ms blocks, and average the blocks with a two-stage gate that * discards silence and quiet passages. EBU R128 builds broadcast practice on * top of it, and every streaming platform now normalises this way — Spotify to * about -14 LUFS, broadcast to -23. * * ## True peak * * Sample peak underreads. The continuous waveform reconstructed at playback can * overshoot the highest *sample*, so a file that measures -0.1 dBFS can still * clip a listener's DAC or a lossy encoder. True-peak measurement oversamples * before measuring, which is what BS.1770 requires and what "-1 dBTP" targets * mean. */ export interface LoudnessResult { /** Integrated (gated) loudness in LUFS. `-Infinity` for digital silence. */ integrated: number; /** Loudness range in LU — the spread between quiet and loud passages. */ range: number; /** Highest 400 ms block loudness, in LUFS. */ peakMomentary: number; } /** * Measures integrated loudness per ITU-R BS.1770-4 with EBU R128 gating. * * @param channels Planar float channels. * @param sampleRate Sample rate in Hz. */ export declare function measureLoudness(channels: readonly Float32Array[], sampleRate: number): LoudnessResult; /** Highest absolute sample value across all channels, as a linear ratio. */ export declare function measurePeak(channels: readonly Float32Array[]): number; /** * True-peak level as a linear ratio, via 4x oversampling. * * BS.1770 specifies at least 4x for rates up to 48 kHz. Inter-sample peaks * routinely sit 0.5–1.5 dB above the sample peak on loud material, which is why * mastering targets sit at -1 dBTP rather than 0. */ export declare function measureTruePeak(channels: readonly Float32Array[]): number; /** Root-mean-square level across all channels, as a linear ratio. */ export declare function measureRms(channels: readonly Float32Array[]): number; /** Linear ratio to decibels. Returns `-Infinity` for zero. */ export declare function toDb(linear: number): number; /** Decibels to linear ratio. */ export declare function fromDb(db: number): number; //# sourceMappingURL=loudness.d.ts.map