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

Adaptive equalizer toward a balanced loudness shape. More...

#include <TonalBalance.h>

Public Types

enum class  Reference { FlatLoudness , EvenPower }
 What a balanced programme is (setReference()). FlatLoudness, the default: the same loudness in every band of the ear's scale. EvenPower: the loudness, band by band, of a programme with the same power in every band at this programme's level, read through the same model; it already falls where the ear's threshold climbs and follows the level (a quiet programme is not asked for the low end only a loud one can show). More...
 
enum class  Response { ByBand , Common }
 How the analysis follows the programme in time (setResponse()). ByBand, the default: two smoothings with the same time per band, longer in the low end (200 ms at 1 kHz, 400 ms at 100 Hz). Common: a short integration per band (a few periods of its centre, 8 to 100 ms) and then one response time for every band (setResponseTime()), so the whole curve moves together. More...
 
enum class  Quality { Realtime , Render }
 How often the two readings run (setQuality(); it applies at the next prepare()). Realtime, the default: the model every sixteenth of its transform, the long windows of the detail in turns. Render: the model twice as often and every window at every hop. The latency is the same in both. More...
 

Public Member Functions

void prepare (const AudioSpec &spec)
 Allocates for a rate and a layout (an invalid spec is ignored).
 
void reset () noexcept
 Clears the analysis, the corrections and the filter.
 
void setBalance (T amount) noexcept
 How far the trend moves toward the reference shape, 0 to 1 (default 0.5).
 
void setFillDips (T amount) noexcept
 How much dips (a detail under both of its sides, a sixth of an octave or wider) are raised, 0 to 1 (default 0.3).
 
void setTrimPeaks (T amount) noexcept
 How much peaks (a detail over both of its sides) are lowered, 0 to 1 (default 0.5).
 
void setTilt (T dbPerOctave) noexcept
 Tilt of the reference shape in dB per octave around 1 kHz, -6 to +6 (default 0: flat loudness per Bark); it acts through setBalance().
 
void setRange (T db) noexcept
 Largest correction of a band, 0 to 24 dB (default 6).
 
void setKnee (T db) noexcept
 Knee of the balance, 0.1 to 12 dB (default 3); the dips and peaks have setContrastKnee().
 
void setBalanceAsymmetry (T amount) noexcept
 How differently the balance lifts what is lacking and lowers what is in excess, -1 to 1 (default 0: alike). Toward 1 the bands under the reference are lifted by up to twice the share setBalance() gives and those over it lowered by less, down to nothing; toward -1 the other way. The loudness is kept as always, so what changes is the shape: with a positive asymmetry a hole in the balance is filled more than a hump is cut. State key "balanceAsymmetry".
 
void setBalanceBias (T db) noexcept
 Moves the point the balance tells lacking from excess at, -6 to +6 dB (default 0: the programme's own mean). Up, more of the bands count as lacking; down, more as in excess. With an asymmetry (setBalanceAsymmetry()) it decides how much of the programme is lifted and how much lowered; with the balance alike on both sides the offset that keeps the loudness takes it back but for what the knee bends. Past the range (setRange()) the corrections only meet their limits. State key "balanceBias".
 
void setContrastKnee (T db) noexcept
 Knee of the dips and peaks, 0.1 to 12 dB (default 3): smaller and the ripple of a noisy programme is followed, larger and only what stands well out is touched.
 
void setDetail (T octaves) noexcept
 The detail: how finely the peaks and the dips (these no finer than a sixth, so that the space between partials is not raised) are read, played and drawn over the whole band, an octave to 1/24 (default 1/4). It moves while playing, at the same latency; the balance and the loudness go by the 72 bands of the ear whatever it is. The finer, the more the trim takes single partials, and what keeps the loudness then lifts the space between them with the rest.
 
void setRangeKnee (T db) noexcept
 Rounds the approach to the range, 0 to 6 dB (0, the default, is the hard limit): a correction that grows (a dip that deepens) bends into the range through a second knee and settles on it, with no corner.
 
void setFloor (T db) noexcept
 How far under its loudest band (in the model's level) a band may lie and still be given back by the balance, 10 to 120 dB (default 30). What lies further down is the floor of a recording or the end of the content: the balance leaves it where it is, and it takes no part in keeping the loudness. The last 10 dB over the floor fade in. A dip between two sides that sound is filled whatever its depth.
 
void setFrequencyRange (T loHz, T hiHz) noexcept
 Frequencies the corrections act on, with edges one Bark wide (default 40 Hz to 16 kHz: the ends of the band, where the threshold in quiet climbs, are left alone).
 
void setReference (Reference r) noexcept
 The shape the programme is compared against (see Reference; out-of-range values read as FlatLoudness).
 
void setQuality (Quality q) noexcept
 Realtime or Render (see Quality; applies at the next prepare()).
 
void setQualityFollowsRender (bool on) noexcept
 With it on, a prepare() made while the host renders offline (setOfflineRendering(true)) takes the Render quality whatever setQuality() says (off by default).
 
void setOfflineRendering (bool on) noexcept
 Tells the processor whether the host renders offline (read by the next prepare()).
 
void setResponse (Response r) noexcept
 How the analysis follows the programme in time (see Response; out-of-range values read as ByBand).
 
void setResponseTime (T ms) noexcept
 The response time of Response::Common, 10 to 2000 ms (default 60).
 
void setListeningCompensation (T db) noexcept
 Compensates a listening level this many dB lower than the one the programme is balanced at, -30 to +30 (default 0). The ear loses the two ends first as the level falls (their loudness grows faster with level), so each band is raised by the level times one minus the ratio of the mid exponent to its own: with 20 dB, 4.7 dB at 50 Hz and 3.3 dB at 12 kHz against 1.2 dB at 1 kHz, before the offset that keeps the total loudness (the volume does not change). Negative values compensate a louder listening. Limited by setRange() like every correction.
 
void setLevelCompensation (bool on) noexcept
 Loudness to decibels with each band's exponent (default off: one exponent).
 
void setLocalSlope (bool on) noexcept
 Loudness to decibels with the slope of the loudness curve at each band's own level (default off): what a band lacks or has in excess is read with that slope, and so is the offset that keeps the loudness. Well over the threshold in quiet that slope is the band's exponent; near it a band's loudness grows faster with its power (the slope is twice the exponent 10 dB over the threshold, 1.45 times 20 dB over), and a fixed exponent overstates what the band lacks: the ends of a quiet programme are asked for less.
 
void setTimeFocus (bool on) noexcept
 Reads each band through a stretch of the analysis window of its own, shorter as frequency rises (SpectralFocus; default off: the whole window at every frequency). The low end keeps its resolution in frequency and the top reads a change of the programme from a stretch of a couple of milliseconds, which shows with a short response (Response::Common at 10 ms: a turn from dark to bright is followed at 8 kHz in 20 ms in place of 28). On a steady programme the corrections are the same (within 0.03 dB).
 
void setReferenceLevel (T dbSpl) noexcept
 The SPL a full-scale sine stands for, 60 to 130 dB (default 100).
 
T getBalance () const noexcept
 
T getFillDips () const noexcept
 
T getTrimPeaks () const noexcept
 
T getTilt () const noexcept
 
T getRange () const noexcept
 
T getKnee () const noexcept
 
T getBalanceAsymmetry () const noexcept
 
T getBalanceBias () const noexcept
 
T getContrastKnee () const noexcept
 
T getDetail () const noexcept
 
T getRangeKnee () const noexcept
 
T getFloor () const noexcept
 
T getLowFrequency () const noexcept
 
T getHighFrequency () const noexcept
 
bool getLevelCompensation () const noexcept
 
bool getLocalSlope () const noexcept
 
bool getTimeFocus () const noexcept
 
Reference getReference () const noexcept
 
Response getResponse () const noexcept
 
Quality getQuality () const noexcept
 
bool getQualityFollowsRender () const noexcept
 
Quality getQualityInUse () const noexcept
 
T getResponseTime () const noexcept
 
T getListeningCompensation () const noexcept
 
T getReferenceLevel () const noexcept
 
int getLatency () const noexcept
 
double getBandCentre (int band) const noexcept
 
T getCorrection (int band) const noexcept
 
T getDisplayCorrection (int point) const noexcept
 
T getLoudnessChange () const noexcept
 
T getLoudnessRaised () const noexcept
 
T getLoudnessLowered () const noexcept
 
T getLoudness () const noexcept
 
T getCentroidShift () const noexcept
 
double getResponse (double hz) const noexcept
 
void processBlock (AudioBufferView< T > buffer) noexcept
 Analyses and equalizes the programme in place.
 
void processBlock (AudioBufferView< T > buffer, AudioBufferView< T > key) noexcept
 Equalizes the programme by the analysis of a key (same channels or one).
 
std::vector< uint8_t > getState () const
 
bool setState (const uint8_t *data, size_t size)
 Restores the settings. A blob of the first version gives the default detail, or a third, a sixth or a twelfth of an octave when it saved one of three steps.
 

Static Public Member Functions

static constexpr int getNumBands () noexcept
 
static double getDisplayFrequency (int point) noexcept
 

Static Public Attributes

static constexpr int kBands = 72
 Bands of the loudness model.
 
static constexpr int kMaxChannels = 2
 Channels analysed (the others take the same curve).
 
static constexpr int kDisplayPoints = SpectralReadout<T>::kPoints
 Points of the display curve, evenly in log frequency from 20 Hz to 20 kHz.
 

Detailed Description

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

Adaptive equalizer toward a balanced loudness shape.

Template Parameters
TSample type (float or double).

Definition at line 125 of file TonalBalance.h.

Member Enumeration Documentation

◆ Quality

template<FloatType T>
enum class dspark::TonalBalance::Quality
strong

How often the two readings run (setQuality(); it applies at the next prepare()). Realtime, the default: the model every sixteenth of its transform, the long windows of the detail in turns. Render: the model twice as often and every window at every hop. The latency is the same in both.

Enumerator
Realtime 
Render 

Definition at line 158 of file TonalBalance.h.

◆ Reference

template<FloatType T>
enum class dspark::TonalBalance::Reference
strong

What a balanced programme is (setReference()). FlatLoudness, the default: the same loudness in every band of the ear's scale. EvenPower: the loudness, band by band, of a programme with the same power in every band at this programme's level, read through the same model; it already falls where the ear's threshold climbs and follows the level (a quiet programme is not asked for the low end only a loud one can show).

Enumerator
FlatLoudness 
EvenPower 

Definition at line 139 of file TonalBalance.h.

◆ Response

template<FloatType T>
enum class dspark::TonalBalance::Response
strong

How the analysis follows the programme in time (setResponse()). ByBand, the default: two smoothings with the same time per band, longer in the low end (200 ms at 1 kHz, 400 ms at 100 Hz). Common: a short integration per band (a few periods of its centre, 8 to 100 ms) and then one response time for every band (setResponseTime()), so the whole curve moves together.

Enumerator
ByBand 
Common 

Definition at line 149 of file TonalBalance.h.

Member Function Documentation

◆ getBalance()

template<FloatType T>
T dspark::TonalBalance< T >::getBalance ( ) const
inlinenoexcept

Definition at line 381 of file TonalBalance.h.

◆ getBalanceAsymmetry()

template<FloatType T>
T dspark::TonalBalance< T >::getBalanceAsymmetry ( ) const
inlinenoexcept

Definition at line 387 of file TonalBalance.h.

◆ getBalanceBias()

template<FloatType T>
T dspark::TonalBalance< T >::getBalanceBias ( ) const
inlinenoexcept

Definition at line 388 of file TonalBalance.h.

◆ getBandCentre()

template<FloatType T>
double dspark::TonalBalance< T >::getBandCentre ( int  band) const
inlinenoexcept
Returns
The centre of a band of the model, in hertz.

Definition at line 413 of file TonalBalance.h.

◆ getCentroidShift()

template<FloatType T>
T dspark::TonalBalance< T >::getCentroidShift ( ) const
inlinenoexcept
Returns
How far the corrections move the centre of the loudness along the ear's scale, in Bark (positive: brighter).

Definition at line 447 of file TonalBalance.h.

◆ getContrastKnee()

template<FloatType T>
T dspark::TonalBalance< T >::getContrastKnee ( ) const
inlinenoexcept

Definition at line 389 of file TonalBalance.h.

◆ getCorrection()

template<FloatType T>
T dspark::TonalBalance< T >::getCorrection ( int  band) const
inlinenoexcept
Returns
The correction of a band of the model in dB, the detail in it counted by the power it moves there (a readout for any thread). getDisplayCorrection() has the curve point by point.

Definition at line 419 of file TonalBalance.h.

◆ getDetail()

template<FloatType T>
T dspark::TonalBalance< T >::getDetail ( ) const
inlinenoexcept

Definition at line 390 of file TonalBalance.h.

◆ getDisplayCorrection()

template<FloatType T>
T dspark::TonalBalance< T >::getDisplayCorrection ( int  point) const
inlinenoexcept
Returns
The correction the filter plays at a display point, in dB (any thread).

Definition at line 428 of file TonalBalance.h.

◆ getDisplayFrequency()

template<FloatType T>
static double dspark::TonalBalance< T >::getDisplayFrequency ( int  point)
inlinestaticnoexcept
Returns
The frequency of a display point, in hertz.

Definition at line 426 of file TonalBalance.h.

◆ getFillDips()

template<FloatType T>
T dspark::TonalBalance< T >::getFillDips ( ) const
inlinenoexcept

Definition at line 382 of file TonalBalance.h.

◆ getFloor()

template<FloatType T>
T dspark::TonalBalance< T >::getFloor ( ) const
inlinenoexcept

Definition at line 394 of file TonalBalance.h.

◆ getHighFrequency()

template<FloatType T>
T dspark::TonalBalance< T >::getHighFrequency ( ) const
inlinenoexcept

Definition at line 396 of file TonalBalance.h.

◆ getKnee()

template<FloatType T>
T dspark::TonalBalance< T >::getKnee ( ) const
inlinenoexcept

Definition at line 386 of file TonalBalance.h.

◆ getLatency()

template<FloatType T>
int dspark::TonalBalance< T >::getLatency ( ) const
inlinenoexcept
Returns
The latency in samples.

Definition at line 411 of file TonalBalance.h.

◆ getLevelCompensation()

template<FloatType T>
bool dspark::TonalBalance< T >::getLevelCompensation ( ) const
inlinenoexcept

Definition at line 397 of file TonalBalance.h.

◆ getListeningCompensation()

template<FloatType T>
T dspark::TonalBalance< T >::getListeningCompensation ( ) const
inlinenoexcept

Definition at line 407 of file TonalBalance.h.

◆ getLocalSlope()

template<FloatType T>
bool dspark::TonalBalance< T >::getLocalSlope ( ) const
inlinenoexcept

Definition at line 398 of file TonalBalance.h.

◆ getLoudness()

template<FloatType T>
T dspark::TonalBalance< T >::getLoudness ( ) const
inlinenoexcept
Returns
The programme's total loudness as the model reads it, in dB (10 log10 of the sum of the bands' loudness; -200 in silence).

Definition at line 445 of file TonalBalance.h.

◆ getLoudnessChange()

template<FloatType T>
T dspark::TonalBalance< T >::getLoudnessChange ( ) const
inlinenoexcept
Returns
The change of the programme's total loudness the corrections make, in dB of the loudness ratio: 0 while it is conserved, away from 0 only when the limits leave the bands in range no room to make up for it (a readout for any thread).

Definition at line 435 of file TonalBalance.h.

◆ getLoudnessLowered()

template<FloatType T>
T dspark::TonalBalance< T >::getLoudnessLowered ( ) const
inlinenoexcept
Returns
The share of the programme's loudness that the bands lowered have lost (0 or less).

Definition at line 443 of file TonalBalance.h.

◆ getLoudnessRaised()

template<FloatType T>
T dspark::TonalBalance< T >::getLoudnessRaised ( ) const
inlinenoexcept
Returns
The share of the programme's loudness that the bands raised have gained (0 or more; 0.1 is a tenth of the total). A readout for any thread, like the three below.

Definition at line 441 of file TonalBalance.h.

◆ getLowFrequency()

template<FloatType T>
T dspark::TonalBalance< T >::getLowFrequency ( ) const
inlinenoexcept

Definition at line 395 of file TonalBalance.h.

◆ getNumBands()

template<FloatType T>
static constexpr int dspark::TonalBalance< T >::getNumBands ( )
inlinestaticconstexprnoexcept
Returns
How many bands getBandCentre() and getCorrection() have: those of the model.

Definition at line 392 of file TonalBalance.h.

◆ getQuality()

template<FloatType T>
Quality dspark::TonalBalance< T >::getQuality ( ) const
inlinenoexcept

Definition at line 402 of file TonalBalance.h.

◆ getQualityFollowsRender()

template<FloatType T>
bool dspark::TonalBalance< T >::getQualityFollowsRender ( ) const
inlinenoexcept

Definition at line 403 of file TonalBalance.h.

◆ getQualityInUse()

template<FloatType T>
Quality dspark::TonalBalance< T >::getQualityInUse ( ) const
inlinenoexcept
Returns
The quality the last prepare() took.

Definition at line 405 of file TonalBalance.h.

◆ getRange()

template<FloatType T>
T dspark::TonalBalance< T >::getRange ( ) const
inlinenoexcept

Definition at line 385 of file TonalBalance.h.

◆ getRangeKnee()

template<FloatType T>
T dspark::TonalBalance< T >::getRangeKnee ( ) const
inlinenoexcept

Definition at line 393 of file TonalBalance.h.

◆ getReference()

template<FloatType T>
Reference dspark::TonalBalance< T >::getReference ( ) const
inlinenoexcept

Definition at line 400 of file TonalBalance.h.

◆ getReferenceLevel()

template<FloatType T>
T dspark::TonalBalance< T >::getReferenceLevel ( ) const
inlinenoexcept

Definition at line 408 of file TonalBalance.h.

◆ getResponse() [1/2]

template<FloatType T>
Response dspark::TonalBalance< T >::getResponse ( ) const
inlinenoexcept

Definition at line 401 of file TonalBalance.h.

◆ getResponse() [2/2]

template<FloatType T>
double dspark::TonalBalance< T >::getResponse ( double  hz) const
inlinenoexcept
Returns
The response the filter plays at a frequency in dB, as last handed to the display (any thread).

Definition at line 449 of file TonalBalance.h.

◆ getResponseTime()

template<FloatType T>
T dspark::TonalBalance< T >::getResponseTime ( ) const
inlinenoexcept

Definition at line 406 of file TonalBalance.h.

◆ getState()

template<FloatType T>
std::vector< uint8_t > dspark::TonalBalance< T >::getState ( ) const
inline

Definition at line 471 of file TonalBalance.h.

◆ getTilt()

template<FloatType T>
T dspark::TonalBalance< T >::getTilt ( ) const
inlinenoexcept

Definition at line 384 of file TonalBalance.h.

◆ getTimeFocus()

template<FloatType T>
bool dspark::TonalBalance< T >::getTimeFocus ( ) const
inlinenoexcept

Definition at line 399 of file TonalBalance.h.

◆ getTrimPeaks()

template<FloatType T>
T dspark::TonalBalance< T >::getTrimPeaks ( ) const
inlinenoexcept

Definition at line 383 of file TonalBalance.h.

◆ prepare()

template<FloatType T>
void dspark::TonalBalance< T >::prepare ( const AudioSpec &  spec)
inline

Allocates for a rate and a layout (an invalid spec is ignored).

Definition at line 162 of file TonalBalance.h.

◆ processBlock() [1/2]

template<FloatType T>
void dspark::TonalBalance< T >::processBlock ( AudioBufferView< T >  buffer)
inlinenoexcept

Analyses and equalizes the programme in place.

Definition at line 461 of file TonalBalance.h.

◆ processBlock() [2/2]

template<FloatType T>
void dspark::TonalBalance< T >::processBlock ( AudioBufferView< T >  buffer,
AudioBufferView< T >  key 
)
inlinenoexcept

Equalizes the programme by the analysis of a key (same channels or one).

Definition at line 464 of file TonalBalance.h.

◆ reset()

template<FloatType T>
void dspark::TonalBalance< T >::reset ( )
inlinenoexcept

Clears the analysis, the corrections and the filter.

Definition at line 220 of file TonalBalance.h.

◆ setBalance()

template<FloatType T>
void dspark::TonalBalance< T >::setBalance ( T  amount)
inlinenoexcept

How far the trend moves toward the reference shape, 0 to 1 (default 0.5).

Definition at line 241 of file TonalBalance.h.

◆ setBalanceAsymmetry()

template<FloatType T>
void dspark::TonalBalance< T >::setBalanceAsymmetry ( T  amount)
inlinenoexcept

How differently the balance lifts what is lacking and lowers what is in excess, -1 to 1 (default 0: alike). Toward 1 the bands under the reference are lifted by up to twice the share setBalance() gives and those over it lowered by less, down to nothing; toward -1 the other way. The loudness is kept as always, so what changes is the shape: with a positive asymmetry a hole in the balance is filled more than a hump is cut. State key "balanceAsymmetry".

Definition at line 261 of file TonalBalance.h.

◆ setBalanceBias()

template<FloatType T>
void dspark::TonalBalance< T >::setBalanceBias ( T  db)
inlinenoexcept

Moves the point the balance tells lacking from excess at, -6 to +6 dB (default 0: the programme's own mean). Up, more of the bands count as lacking; down, more as in excess. With an asymmetry (setBalanceAsymmetry()) it decides how much of the programme is lifted and how much lowered; with the balance alike on both sides the offset that keeps the loudness takes it back but for what the knee bends. Past the range (setRange()) the corrections only meet their limits. State key "balanceBias".

Definition at line 272 of file TonalBalance.h.

◆ setContrastKnee()

template<FloatType T>
void dspark::TonalBalance< T >::setContrastKnee ( T  db)
inlinenoexcept

Knee of the dips and peaks, 0.1 to 12 dB (default 3): smaller and the ripple of a noisy programme is followed, larger and only what stands well out is touched.

Definition at line 278 of file TonalBalance.h.

◆ setDetail()

template<FloatType T>
void dspark::TonalBalance< T >::setDetail ( T  octaves)
inlinenoexcept

The detail: how finely the peaks and the dips (these no finer than a sixth, so that the space between partials is not raised) are read, played and drawn over the whole band, an octave to 1/24 (default 1/4). It moves while playing, at the same latency; the balance and the loudness go by the 72 bands of the ear whatever it is. The finer, the more the trim takes single partials, and what keeps the loudness then lifts the space between them with the rest.

Definition at line 289 of file TonalBalance.h.

◆ setFillDips()

template<FloatType T>
void dspark::TonalBalance< T >::setFillDips ( T  amount)
inlinenoexcept

How much dips (a detail under both of its sides, a sixth of an octave or wider) are raised, 0 to 1 (default 0.3).

Definition at line 243 of file TonalBalance.h.

◆ setFloor()

template<FloatType T>
void dspark::TonalBalance< T >::setFloor ( T  db)
inlinenoexcept

How far under its loudest band (in the model's level) a band may lie and still be given back by the balance, 10 to 120 dB (default 30). What lies further down is the floor of a recording or the end of the content: the balance leaves it where it is, and it takes no part in keeping the loudness. The last 10 dB over the floor fade in. A dip between two sides that sound is filled whatever its depth.

Definition at line 309 of file TonalBalance.h.

◆ setFrequencyRange()

template<FloatType T>
void dspark::TonalBalance< T >::setFrequencyRange ( T  loHz,
T  hiHz 
)
inlinenoexcept

Frequencies the corrections act on, with edges one Bark wide (default 40 Hz to 16 kHz: the ends of the band, where the threshold in quiet climbs, are left alone).

Definition at line 311 of file TonalBalance.h.

◆ setKnee()

template<FloatType T>
void dspark::TonalBalance< T >::setKnee ( T  db)
inlinenoexcept

Knee of the balance, 0.1 to 12 dB (default 3); the dips and peaks have setContrastKnee().

Definition at line 251 of file TonalBalance.h.

◆ setLevelCompensation()

template<FloatType T>
void dspark::TonalBalance< T >::setLevelCompensation ( bool  on)
inlinenoexcept

Loudness to decibels with each band's exponent (default off: one exponent).

Definition at line 353 of file TonalBalance.h.

◆ setListeningCompensation()

template<FloatType T>
void dspark::TonalBalance< T >::setListeningCompensation ( T  db)
inlinenoexcept

Compensates a listening level this many dB lower than the one the programme is balanced at, -30 to +30 (default 0). The ear loses the two ends first as the level falls (their loudness grows faster with level), so each band is raised by the level times one minus the ratio of the mid exponent to its own: with 20 dB, 4.7 dB at 50 Hz and 3.3 dB at 12 kHz against 1.2 dB at 1 kHz, before the offset that keeps the total loudness (the volume does not change). Negative values compensate a louder listening. Limited by setRange() like every correction.

Definition at line 351 of file TonalBalance.h.

◆ setLocalSlope()

template<FloatType T>
void dspark::TonalBalance< T >::setLocalSlope ( bool  on)
inlinenoexcept

Loudness to decibels with the slope of the loudness curve at each band's own level (default off): what a band lacks or has in excess is read with that slope, and so is the offset that keeps the loudness. Well over the threshold in quiet that slope is the band's exponent; near it a band's loudness grows faster with its power (the slope is twice the exponent 10 dB over the threshold, 1.45 times 20 dB over), and a fixed exponent overstates what the band lacks: the ends of a quiet programme are asked for less.

Definition at line 365 of file TonalBalance.h.

◆ setOfflineRendering()

template<FloatType T>
void dspark::TonalBalance< T >::setOfflineRendering ( bool  on)
inlinenoexcept

Tells the processor whether the host renders offline (read by the next prepare()).

Definition at line 332 of file TonalBalance.h.

◆ setQuality()

template<FloatType T>
void dspark::TonalBalance< T >::setQuality ( Quality  q)
inlinenoexcept

Realtime or Render (see Quality; applies at the next prepare()).

Definition at line 324 of file TonalBalance.h.

◆ setQualityFollowsRender()

template<FloatType T>
void dspark::TonalBalance< T >::setQualityFollowsRender ( bool  on)
inlinenoexcept

With it on, a prepare() made while the host renders offline (setOfflineRendering(true)) takes the Render quality whatever setQuality() says (off by default).

Definition at line 330 of file TonalBalance.h.

◆ setRange()

template<FloatType T>
void dspark::TonalBalance< T >::setRange ( T  db)
inlinenoexcept

Largest correction of a band, 0 to 24 dB (default 6).

Definition at line 249 of file TonalBalance.h.

◆ setRangeKnee()

template<FloatType T>
void dspark::TonalBalance< T >::setRangeKnee ( T  db)
inlinenoexcept

Rounds the approach to the range, 0 to 6 dB (0, the default, is the hard limit): a correction that grows (a dip that deepens) bends into the range through a second knee and settles on it, with no corner.

Definition at line 299 of file TonalBalance.h.

◆ setReference()

template<FloatType T>
void dspark::TonalBalance< T >::setReference ( Reference  r)
inlinenoexcept

The shape the programme is compared against (see Reference; out-of-range values read as FlatLoudness).

Definition at line 319 of file TonalBalance.h.

◆ setReferenceLevel()

template<FloatType T>
void dspark::TonalBalance< T >::setReferenceLevel ( T  dbSpl)
inlinenoexcept

The SPL a full-scale sine stands for, 60 to 130 dB (default 100).

Definition at line 379 of file TonalBalance.h.

◆ setResponse()

template<FloatType T>
void dspark::TonalBalance< T >::setResponse ( Response  r)
inlinenoexcept

How the analysis follows the programme in time (see Response; out-of-range values read as ByBand).

Definition at line 334 of file TonalBalance.h.

◆ setResponseTime()

template<FloatType T>
void dspark::TonalBalance< T >::setResponseTime ( T  ms)
inlinenoexcept

The response time of Response::Common, 10 to 2000 ms (default 60).

Definition at line 339 of file TonalBalance.h.

◆ setState()

template<FloatType T>
bool dspark::TonalBalance< T >::setState ( const uint8_t *  data,
size_t  size 
)
inline

Restores the settings. A blob of the first version gives the default detail, or a third, a sixth or a twelfth of an octave when it saved one of three steps.

Definition at line 506 of file TonalBalance.h.

◆ setTilt()

template<FloatType T>
void dspark::TonalBalance< T >::setTilt ( T  dbPerOctave)
inlinenoexcept

Tilt of the reference shape in dB per octave around 1 kHz, -6 to +6 (default 0: flat loudness per Bark); it acts through setBalance().

Definition at line 247 of file TonalBalance.h.

◆ setTimeFocus()

template<FloatType T>
void dspark::TonalBalance< T >::setTimeFocus ( bool  on)
inlinenoexcept

Reads each band through a stretch of the analysis window of its own, shorter as frequency rises (SpectralFocus; default off: the whole window at every frequency). The low end keeps its resolution in frequency and the top reads a change of the programme from a stretch of a couple of milliseconds, which shows with a short response (Response::Common at 10 ms: a turn from dark to bright is followed at 8 kHz in 20 ms in place of 28). On a steady programme the corrections are the same (within 0.03 dB).

Definition at line 377 of file TonalBalance.h.

◆ setTrimPeaks()

template<FloatType T>
void dspark::TonalBalance< T >::setTrimPeaks ( T  amount)
inlinenoexcept

How much peaks (a detail over both of its sides) are lowered, 0 to 1 (default 0.5).

Definition at line 245 of file TonalBalance.h.

Member Data Documentation

◆ kBands

template<FloatType T>
constexpr int dspark::TonalBalance< T >::kBands = 72
staticconstexpr

Bands of the loudness model.

Definition at line 128 of file TonalBalance.h.

◆ kDisplayPoints

template<FloatType T>
constexpr int dspark::TonalBalance< T >::kDisplayPoints = SpectralReadout<T>::kPoints
staticconstexpr

Points of the display curve, evenly in log frequency from 20 Hz to 20 kHz.

Definition at line 424 of file TonalBalance.h.

◆ kMaxChannels

template<FloatType T>
constexpr int dspark::TonalBalance< T >::kMaxChannels = 2
staticconstexpr

Channels analysed (the others take the same curve).

Definition at line 159 of file TonalBalance.h.


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