DSPark 1.8.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::LoudnessNormalizer< T > Class Template Referencefinal

Offline waveform-preserving LUFS normalizer with a hard true-peak ceiling. More...

#include <LoudnessNormalizer.h>

Classes

struct  Result
 Measurements and the constant-gain decision for one run. More...
 

Public Types

enum class  Status : std::uint8_t {
  Success , NoMeasurableLoudness , EmptyInput , InvalidSampleRate ,
  NonFiniteInput , NumericalFailure
}
 Completion or conservative no-mutation outcome. More...
 

Public Member Functions

void setTargetLUFS (T target) noexcept
 Sets the target integrated loudness (default -23 LUFS).
 
T getTargetLUFS () const noexcept
 
void setTruePeakCeilingDb (T ceilingDb) noexcept
 Sets the true-peak ceiling (default -1 dBTP).
 
T getTruePeakCeilingDb () const noexcept
 
template<int MaxChannels>
Result normalize (AudioBuffer< T, MaxChannels > &audio, double sampleRate)
 Normalizes audio in place with one validated constant gain.
 

Detailed Description

template<FloatType T>
class dspark::LoudnessNormalizer< T >

Offline waveform-preserving LUFS normalizer with a hard true-peak ceiling.

Threading: offline and single-threaded. The caller owns the buffer exclusively for the duration of normalize(). The two parameter controls are lock-free atomic words and may be changed between runs; changing either while a run is in progress is not supported.

Template Parameters
TSample type (float or double).

Definition at line 70 of file LoudnessNormalizer.h.

Member Enumeration Documentation

◆ Status

template<FloatType T>
enum class dspark::LoudnessNormalizer::Status : std::uint8_t
strong

Completion or conservative no-mutation outcome.

Enumerator
Success 
NoMeasurableLoudness 
EmptyInput 
InvalidSampleRate 
NonFiniteInput 
NumericalFailure 

Definition at line 74 of file LoudnessNormalizer.h.

Member Function Documentation

◆ getTargetLUFS()

template<FloatType T>
T dspark::LoudnessNormalizer< T >::getTargetLUFS ( ) const
inlinenoexcept
Returns
The configured target integrated loudness.

Definition at line 107 of file LoudnessNormalizer.h.

◆ getTruePeakCeilingDb()

template<FloatType T>
T dspark::LoudnessNormalizer< T >::getTruePeakCeilingDb ( ) const
inlinenoexcept
Returns
The configured true-peak ceiling.

Definition at line 126 of file LoudnessNormalizer.h.

◆ normalize()

template<FloatType T>
template<int MaxChannels>
Result dspark::LoudnessNormalizer< T >::normalize ( AudioBuffer< T, MaxChannels > &  audio,
double  sampleRate 
)
inline

Normalizes audio in place with one validated constant gain.

Parameters
audioComplete owning buffer; every runtime channel is bound.
sampleRateFinite positive sample rate in Hz.
Returns
Explicit status, input/output measurements and gain decision.

Loudness uses channel 0 for mono and channels 0/1 for wider buffers. True peak and gain application cover every runtime channel up to the buffer's compile-time MaxChannels. Every failure status is decided before the first write and leaves audio bitwise unchanged.

Definition at line 145 of file LoudnessNormalizer.h.

◆ setTargetLUFS()

template<FloatType T>
void dspark::LoudnessNormalizer< T >::setTargetLUFS ( T  target)
inlinenoexcept

Sets the target integrated loudness (default -23 LUFS).

Definition at line 100 of file LoudnessNormalizer.h.

◆ setTruePeakCeilingDb()

template<FloatType T>
void dspark::LoudnessNormalizer< T >::setTruePeakCeilingDb ( T  ceilingDb)
inlinenoexcept

Sets the true-peak ceiling (default -1 dBTP).

Finite values are clamped to [-40, 0] dBTP. Non-finite requests leave the current control value unchanged.

Definition at line 118 of file LoudnessNormalizer.h.


The documentation for this class was generated from the following file: