Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

integratedLoudness

Measure integrated loudness and loudness range

Syntax

loudness = integratedLoudness(audioIn,Fs)
loudness = integratedLoudness(audioIn,Fs,channelWeights)
[loudness,loudnessRange] = integratedLoudness(___)

Description

example

loudness = integratedLoudness(audioIn,Fs) returns the integrated loudness of an audio signal, audioIn, with sample rate Fs. The ITU-R BS.1770-4 and EBU R 128 standards define the algorithms to calculate integrated loudness.

example

loudness = integratedLoudness(audioIn,Fs,channelWeights) specifies the channel weights used to compute the integrated loudness. channelWeights must be a row vector with the same number of elements as the number of channels in audioIn.

example

[loudness,loudnessRange] = integratedLoudness(___) 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.

Examples

collapse all

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

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)
nonStandardLoudness = integratedLoudness(signal,fs)
standardLoudness =

  -11.6825


nonStandardLoudness =

  -11.0121

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

Input Arguments

collapse all

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 your channelWeights specification:

  • 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 channelWeights vector.

Data Types: single | double

Sample rate of the input signal in Hz, specified as a positive scalar.

Data Types: single | double

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 audioIn matrix in this order: [Left, Right, Center, Left surround, Right surround].

It is a best practice to specify the channelWeights vector in order: [Left, Right, Center, Left surround, Right surround].

Data Types: single | double

Output Arguments

collapse all

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, loudness is returned empty.

Data Types: single | double

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, loudnessRange is returned empty.

Data Types: single | double

Algorithms

collapse all

The 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 integratedLoudness algorithm is described for the general case of n channels.

Integrated Loudness and Loudness Range

The input channels, x, pass through a K-weighted weightingFilter. The K-weighted filter shapes the frequency spectrum to reflect perceived loudness.

Integrated Loudness

  1. 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=1wk=1wyi2[k]

    • mPi is the momentary power of the ith segment of a channel.

    • w is the segment length in samples.

  2. The momentary loudness, mL, is computed for each segment:

    mLi=0.691+10log10(c=1nGc×mP(i,c))LUFS

    • Gc is the weighting for channel c.

  3. The momentary power is gated using the momentary loudness calculation:

    mPimPj

    j={i|mLi70}

  4. The relative threshold, Γ, is computed:

    Γ=0.691+10log10(c=1nGc×lc)10

    lc is the mean momentary power of channel c:

    lc=1|j|jmP(j,c)

  5. The momentary power subset, mPj, is gated using the relative threshold:

    mPjmPk

    k={j|mPjΓ}

  6. The momentary power segments are averaged:

    P=1|k|kmPk

  7. The integrated loudness is computed by passing the mean momentary power subset, P, through the Compute Loudness system:

    IntegratedLoudness=0.691+10log10(c=1nGc×Pc)LUFS

Loudness Range

  1. 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=1wk=1wyi2[k]

    • sPi is the short-term power of the ith segment of a channel.

    • w is the segment length in samples.

  2. The short-term loudness, sL, is computed for each segment:

    sLi=0.691+10log10(c=1nGc×sP(i,c))

    • Gc is the weighting for channel c.

  3. The short-term loudness is gated using an absolute threshold:

    sLisLj

    j={i|sLi70}

  4. The gated short-term loudness is converted back to linear, and then the mean is taken:

    sPj=1|j|j10(sLj10)

    The relative threshold, K, is computed:

    K=20+10log10(sPj)

  5. The short-term loudness subset, sLj, is gated using the relative threshold:

    sLjsLk

    k={j|sLjK}

  6. 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).

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.

[4] European Broadcasting Union. Loudness Range: A Measure to Supplement EBU R 128 Loudness Normalization. EBU R 128 Tech 3342. 2016.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

See Also

System Objects

Blocks

Introduced in R2016b

Was this topic helpful?