Measure integrated loudness and loudness range
the channel weights used to compute the integrated loudness.
loudness = integratedLoudness(
be a row vector with the same number of elements as the number of
[ returns the loudness
range of the audio signal using either of the previous syntaxes. The
EBU R 128 Tech 3342 standard defines the loudness range computation.
Determine Integrated Loudness
Determine the integrated loudness of an audio signal.
Create a two-second sine wave with a 0 dB amplitude, a 1 kHz frequency, and a 48 kHz sample rate.
sampleRate = 48e3; increment = sampleRate*2; amplitude = 10^(0/20); frequency = 1e3; sineGenerator = audioOscillator( ... 'SampleRate',sampleRate, ... 'SamplesPerFrame',increment, ... 'Amplitude',amplitude, ... 'Frequency',frequency); signal = sineGenerator();
Calculate the integrated loudness of the audio signal at the specified sample rate.
loudness = integratedLoudness(signal,sampleRate)
loudness = -3.0036
Specify Nondefault Channel Weights
Read in a four-channel audio signal. Specify a nondefault weighting vector with four elements.
[signal,fs] = audioread('AudioArray-16-16-4channels-20secs.wav'); weightingVector = [1,0.8,0.8,1.2];
Calculate the integrated loudness with the default channel weighting and the nondefault channel weighting vector.
standardLoudness = integratedLoudness(signal,fs,weightingVector)
standardLoudness = -11.6825
nonStandardLoudness = integratedLoudness(signal,fs)
nonStandardLoudness = -11.0121
Determine Loudness Range
Read in an audio signal. Clip 3 five-second intervals out of the signal.
[x,fs] = audioread('FunkyDrums-44p1-stereo-25secs.mp3'); x1 = x(1:fs*5,:); x2 = x(5e5:5e5+5*fs,:); x3 = x(end-5*fs:end,:);
Calculate the loudness and loudness range of the total signal and of each interval.
[L,LRA] = integratedLoudness(x,fs); [L1,LRA1] = integratedLoudness(x1,fs); [L2,LRA2] = integratedLoudness(x2,fs); [L3,LRA3] = integratedLoudness(x3,fs); fprintf(['Loudness: %0.2f\n', ... 'Loudness range: %0.2f\n\n', ... 'Beginning loudness: %0.2f\n', ... 'Beginning loudness range: %0.2f\n\n', ... 'Middle loudness: %0.2f\n', ... 'Middle loudness range: %0.2f\n\n', ... 'End loudness: %0.2f\n', ... 'End loudness range: %0.2f\n'], ... L,LRA,L1,LRA1,L2,LRA2,L3,LRA3);
Loudness: -22.93 Loudness range: 1.50 Beginning loudness: -23.29 Beginning loudness range: 1.17 Middle loudness: -22.99 Middle loudness range: 1.12 End loudness: -22.09 End loudness range: 1.82
audioIn — Input signal
Input signal, specified as a matrix. The columns of the matrix are treated as audio channels.
The maximum number of columns of the input signal depends on
If you use the default
channelWeights, the input signal has a maximum of five channels. Specify the channels in this order: [Left, Right, Center, Left surround, Right surround].
If you specify nondefault
channelWeights, the input signal must have the same number of columns as the number of elements in the
Fs — Sample rate (Hz)
Sample rate of the input signal in Hz, specified as a positive scalar.
channelWeights — Linear weighting applied to each input channel
[1.0, 1,0, 1.0, 1.41, 1.41] (default) | nonnegative row vector
Linear weighting applied to each input channel, specified as a row vector of nonnegative values. The number of elements in 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 channels of the
in this order: [Left, Right, Center, Left surround, Right surround].
It is a best practice to specify the
in order: [Left, Right, Center, Left surround, Right surround].
loudness — Integrated loudness (LUFS)
Integrated loudness in loudness units relative to full scale (LUFS), returned as a scalar.
The ITU-R BS.1770-4 and EBU R 128 standards define the integrated
loudness. The algorithm computes the loudness by breaking down the
audio signal into 0.4-second segments with 75% overlap. If the input
signal is less than 0.4 seconds,
loudnessRange — Loudness range (LU)
Loudness range in loudness units (LU), returned as a scalar.
The EBU R 128 Tech 3342 standard defines the loudness range.
The algorithm computes the loudness range by breaking down the audio
into 3-second segments with 2.9-second overlap. If the input signal
is less than three seconds,
integratedLoudness function returns
the integrated loudness and loudness range (LRA) of an audio signal.
You can specify any number of channels and nondefault channel weights
used for loudness measurements. The
is described for the general case of n channels.
Integrated Loudness and Loudness Range
The input channels, x, pass through a K-weighted
The K-weighted filter shapes the frequency spectrum to reflect perceived
The K-weighted channels, y, are divided into 0.4-second segments with 0.3-second overlap. The power (mean square) of each segment of the K-weighted channels is calculated:
mPi is the momentary power of the ith segment of a channel.
w is the segment length in samples.
The momentary loudness, mL, is computed for each segment:
Gc is the weighting for channel c.
The momentary power is gated using the momentary loudness calculation:
The relative threshold, Γ, is computed:
lc is the mean momentary power of channel c:
The momentary power subset, mPj, is gated using the relative threshold:
The momentary power segments are averaged:
The integrated loudness is computed by passing the mean momentary power subset, P, through the Compute Loudness system:
The K-weighted channels, y, are divided into 3-second segments with 2.9-second overlap. The power (mean square) of each segment of the K-weighted channels 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.
The short-term loudness is gated using an absolute threshold:
The gated short-term loudness is converted back to linear, and then the mean is taken:
The relative threshold, K, is computed:
The short-term loudness subset, sLj, is gated using the relative threshold:
The short-term loudness subset, sLk, is sorted. The loudness range is calculated as between the 10th and 95th percentiles of the distribution, and is returned in loudness units (LU).
 International Telecommunication Union; Radiocommunication Sector. Algorithms to Measure Audio Programme Loudness and True-Peak Audio Level. ITU-R BS.1770-4. 2015.
 European Broadcasting Union. Loudness Normalisation and Permitted Maximum Level of Audio Signals. EBU R 128. 2014.
 European Broadcasting Union. Loudness Metering: 'EBU Mode' Metering to Supplement EBU R 128 Loudness Normalization. EBU R 128 Tech 3341. 2014.
 European Broadcasting Union. Loudness Range: A Measure to Supplement EBU R 128 Loudness Normalization. EBU R 128 Tech 3342. 2016.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Introduced in R2016b