Loudness Meter
Standard-compliant loudness measurements
Libraries:
Audio Toolbox /
Measurements
Description
The Loudness Meter block measures the loudness and true-peak of an audio signal based on EBU R 128 and ITU-R BS.1770-4 standards.
Examples
Compare Loudness Before and After Audio Processing
Measure momentary and short-term loudness before and after compression of a streaming audio signal in Simulink®.
Trigger Gain Control Based on Loudness Measurement
This model enables you to apply dynamic range compression to an audio signal while staying inside a preset loudness range. In this model, a Compressor block increases the loudness and decreases the dynamic range of an audio signal. A Loudness Meter block calculates the momentary loudness of the compressed audio signal. If momentary loudness crosses a -23 LUFS threshold, an enabled subsystem applies gain to lower the corresponding level of the audio signal.
Ports
Input
Port_1 — Input signal
matrix | 1-D vector
Matrix input –– Each column of the input is treated as an independent channel. If you use the default Channel weights, specify the input channels in order: [Left, Right, Center, Left surround, Right surround].
1-D vector input –– The input is treated as a single channel.
Data Types: single
| double
Output
M — Momentary loudness measurement
column vector
The block outputs a column vector with the same data type and number of rows as the input signal.
Data Types: single
| double
S — Short-term loudness measurement
column vector
The block outputs a column vector with the same data type and number of rows as the input signal.
Data Types: single
| double
TP — True-peak value
real scalar
The block outputs a real scalar with the same data type as the input signal.
Dependencies
To enable this port, select the Output true-peak value parameter.
Data Types: single
| double
Parameters
If a parameter is listed as tunable, then you can change its value during simulation.
Channel weights — Linear weighting applied to each input channel
[1, 1, 1, 1.41, 1.41]
(default) | nonnegative row vector
The number of elements of the row vector must be equal to or greater than the number of input channels. Excess values in the vector are ignored.
The default channel weights follow the ITU-R BS.1170-4 standard. To use the default channel weights, specify the input to the Loudness Meter block as a matrix whose columns correspond to channels in this order: [Left, Right, Center, Left surround, Right surround].
It is a best practice to specify the channel weights in order: [Left, Right, Center, Left surround, Right surround].
Tunable: Yes
Use relative scale for loudness measurements — Specify block to output loudness measurements relative to target level
off (default) | on
On — The loudness measurements are relative to the value specified by Target loudness level (LUFS). The output of the block is returned in loudness units (LU).
Off — The loudness measurements are absolute, and returned in loudness units full scale (LUFS).
Tunable: No
Target loudness level (LUFS) — Reference level for relative loudness measurements
–23
(default) | real scalar
For example, if the Target loudness level (LUFS) is –23, then a loudness value of –24 LUFS is reported as –1 LU.
Tunable: Yes
Dependencies
To enable this parameter, select the Use relative scale for loudness measurements parameter.
Output true-peak value — Add output port for true-peak value
off (default) | on
When you select this parameter, an additional output port, TP, is added to the block. The TP port outputs the true-peak value of the input frame.
Tunable: No
Inherit sample rate from input — Specify source of input sample rate
on (default) | off
When you select this parameter, the block inherits its sample rate from the input signal. When you clear this parameter, you specify the sample rate in Input sample rate (Hz).
Tunable: No
Input sample rate (Hz) — Sample rate of input
44100
(default) | scalar
Tunable: Yes
Dependencies
To enable this parameter, clear the Inherit sample rate from input parameter.
Simulate using — Specify type of simulation to run
Code generation
(default) | Interpreted execution
Code generation
–– Simulate model using generated C code. The first time you run a simulation, Simulink® generates C code for the block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time but the speed of the subsequent simulations is comparable toInterpreted execution
.Interpreted execution
–– Simulate model using the MATLAB® interpreter. This option shortens startup time but has a slower simulation speed thanCode generation
. In this mode, you can debug the source code of the block.
Tunable: No
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Algorithms
The Loudness Meter block calculates the momentary loudness, short-term loudness, and true-peak value of an audio signal. You can specify any number of channels and nondefault channel weights used for loudness measurements. The block algorithm is described for the general case of n channels and default channel weights.
Loudness Measurements
The input channels, x, pass through a K-weighted filter implemented using the algorithm of the Weighting Filter block. The K-weighted filter shapes the frequency spectrum to reflect perceived loudness.
The K-weighted channels, y, are divided into 0.4-second segments with 0.3-second overlap. If the required number of samples have not been collected yet, the Loudness Meter block returns the last computed value for momentary loudness. If enough samples have been collected, then the power (mean square) of each segment of the K-weighted channels is calculated:
mPi is the momentary power of the ith segment.
w is the segment length in samples.
The momentary loudness, mL, is computed for each segment:
Gc is the weighting for channel c.
mL is the momentary loudness returned by your Loudness Meter block.
The K-weighted channels, y, are divided into 3-second segments with 2.9-second overlap. If the required number of samples have not been collected yet, the Loudness Meter block returns the last computed values for short-term loudness and loudness range. If enough samples have been collected, then the power (mean square) of each K-weighted channel is calculated:
sPi is the short-term power of the ith segment of a channel.
w is the segment length in samples.
The short-term loudness, sL, is computed for each segment:
Gc is the weighting for channel c.
sL is the short-term loudness returned by your Loudness Meter block.
True-Peak
The true-peak measurement considers only the current input frame of a call to your loudness meter.
The signal is oversampled to at least 192 kHz. To optimize processing, the input sample rate determines the exact oversampling. The algorithm does not consider an input sample rate below 750 Hz.
Input Sample Rate (kHz) Upsample Factor [0.75, 1.5) 256 [1.5, 3) 128 [3, 6) 64 [6,12) 32 [12, 24) 16 [24, 48) 8 [48, 96) 4 [96,192) 2 [192, ∞) Not required The oversampled signal a passes through a lowpass filter with a half-polyphase length of 12 and stopband attenuation of 80 dB. The filter design uses
designMultirateFIR
.The filtered signal b is rectified and converted to the dB TP scale:
The true-peak is determined as the maximum of the converted signal c.
References
[1] International Telecommunication Union; Radiocommunication Sector. Algorithms to Measure Audio Programme Loudness and True-Peak Audio Level. ITU-R BS.1770-4. 2015.
[2] European Broadcasting Union. Loudness Normalisation and Permitted Maximum Level of Audio Signals. EBU R 128. 2014.
[3] European Broadcasting Union. Loudness Metering: 'EBU Mode' Metering to Supplement EBU R 128 Loudness Normalization. EBU R 128 Tech 3341. 2014.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2016b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)