|
Gin
|
Loudness meter per ITU-R BS.1770-4 / EBU R128. More...
#include <gin_loudnessmeter.h>
Public Member Functions | |
| LoudnessMeter ()=default | |
| void | prepare (double sampleRate, int numChannels, double maxHistorySeconds=24.0 *60.0 *60.0) |
| maxHistorySeconds bounds the memory used for the integrated / range histories (about 40 kB per hour). | |
| void | reset () |
| Clears everything, including the integrated history. | |
| void | process (const juce::AudioBuffer< float > &buffer) |
| Audio thread. | |
| float | getMomentary () const |
| float | getShortTerm () const |
| float | getMaxMomentary () const |
| float | getMaxShortTerm () const |
| float | getIntegrated () const |
| Gated integrated loudness since the last reset. | |
| float | getLoudnessRange () const |
| Loudness range (EBU Tech 3342) since the last reset, in LU. | |
| double | getElapsedSeconds () const |
| Seconds of audio measured since the last reset. | |
| void | setChannelWeight (int channel, float weight) |
Static Public Member Functions | |
| static float | powerToLoudness (double power) |
| Converts a mean square power to loudness. | |
| static double | loudnessToPower (float loudness) |
Static Public Attributes | |
| static constexpr float | silence = -100.0f |
Loudness meter per ITU-R BS.1770-4 / EBU R128.
Call process() from the audio thread. The momentary (400 ms) and short-term (3 s) values are updated every 100 ms and can be read from any thread. Integrated loudness and loudness range are gated measurements over the whole history since the last reset; they are computed on demand from that history by getIntegrated() / getLoudnessRange(), which are intended to be called from the message thread as they do a little work.
Channel weighting follows the standard: 1.0 for the first three channels (L, R, C) and 1.41 for channels 4 and 5 (Ls, Rs).
Values are in LUFS (LU for the range). Below the measurable floor, or before any audio has been processed, getters return silence.
|
default |
| void LoudnessMeter::prepare | ( | double | sampleRate, |
| int | numChannels, | ||
| double | maxHistorySeconds = 24.0 *60.0 *60.0 |
||
| ) |
maxHistorySeconds bounds the memory used for the integrated / range histories (about 40 kB per hour).
Not realtime safe.
| void LoudnessMeter::reset | ( | ) |
Clears everything, including the integrated history.
Safe to call from any thread; takes effect on the next process() call.
Audio thread.
Uses up to the prepared number of channels.
| float LoudnessMeter::getMomentary | ( | ) | const |
| float LoudnessMeter::getShortTerm | ( | ) | const |
| float LoudnessMeter::getMaxMomentary | ( | ) | const |
| float LoudnessMeter::getMaxShortTerm | ( | ) | const |
| float LoudnessMeter::getIntegrated | ( | ) | const |
Gated integrated loudness since the last reset.
Message thread.
| float LoudnessMeter::getLoudnessRange | ( | ) | const |
Loudness range (EBU Tech 3342) since the last reset, in LU.
Message thread.
| double LoudnessMeter::getElapsedSeconds | ( | ) | const |
Seconds of audio measured since the last reset.
Converts a mean square power to loudness.