lufs

lufs — Momentary, Integrated and Short-Term Loudness meter in LUFS

Description

The opcodes performs an analysis of input audio according to ITU-R BS.1770-4 recommendation. The outputs are Momentary, Integrated and Short-Term loudnesses.

Syntax

kmom, kint, kshort lufs kreset, ain1 [, ain2]

Performance

kreset -- reset input. It resets the value of the integrated loudness if kreset is not 0.

ain1, ain2 -- input audio signal(s). Only mono and stereo are supported (see below)

kmom -- momentary loudness in LUFS

kint -- integrated loudness in LUFS

kshort -- short-term loudness in LUFS

The Momentary Loudness is calculated over 400 ms period and Short-Term Loudness is for 3 s period. Integrated Loudness is obtained by averaging the whole programm. The calculation algorithm is based on formulae from Matlab integratedLoudness code ITU-R BS.1770-4 gives K-weigthing filters coefficients only for 48000 Hz, thus other sampling frequencies coefficients are calculated according to Brecht De Man code Only mono and stereo formats are supported due to rare usage of 5.1 format in the field of computer music. ITU-R BS.1770-4 standardizes only 1, 2 and 5.1 channels.

[Note] Warning!

ksmps should not be set to values higher than sr/10, i.e. 4410 @ sr = 44100 and higher.

Examples

Here is an example of the lufs opcode. It uses the file lufs.csd.

Example 561. Example of the lufs opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>

sr=48000
ksmps=64
0dbfs=1.0
nchnls=2

instr 1
ktrig init 0
iamp = ampdbfs(-18.0)
a1 poscil iamp,1000,1
kM,kI,kS lufs ktrig,a1,a1
printks "M: %f, I: %f, S: %f LUFS\n", 0.3, k1, k2, k3
endin

</CsInstruments>
<CsScore>
f1 0 8192 10 1
i1 0 20
</CsScore>
</CsoundSynthesizer>


See Also

rms

Credits

By: Gleb Rogozinsky, Summer 2020

New in version 6.15