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

Stereo-linked, CPU-optimized dynamic-EQ de-esser. More...

#include <DeEsser.h>

Public Types

enum class  DetectionMode { Bandpass , Derivative }
 
enum class  Structure { DirectForm , Ladder }
 How the cut bell is realised (see setStructure()). More...
 

Public Member Functions

void prepare (const AudioSpec &spec)
 Prepares the de-esser state and filters.
 
void processBlock (AudioBufferView< T > buffer) noexcept
 Processes audio in-place. Stereo-linked to preserve imaging.
 
void setRemovalListen (bool on) noexcept
 Removal listen: the output is what the de-esser takes out. A monitoring control, not in the state.
 
bool isRemovalListen () const noexcept
 
void setStructure (Structure structure) noexcept
 Chooses how the cut bell is realised.
 
Structure getStructure () const noexcept
 
void setMixedBell (bool on) noexcept
 Runs the cut as one fixed filter mixed by the reduction.
 
bool isMixedBell () const noexcept
 
void reset () noexcept
 Resets internal DSP state.
 
void setAttack (T ms) noexcept
 Sets the detector attack, clamped to [0.1, 20] ms. Non-finite values are ignored.
 
void setRelease (T ms) noexcept
 Sets the detector release, clamped to [1, 500] ms. Non-finite values are ignored.
 
void setFrequency (T hz) noexcept
 Sets the sibilance centre frequency in Hz.
 
void setBandwidth (T octaves) noexcept
 Sets the detection/cut bandwidth in octaves (floored at 0.1). Non-finite values are ignored.
 
void setThreshold (T db) noexcept
 Sets the detection threshold in dBFS. Non-finite values are ignored.
 
void setAutoThreshold (bool on) noexcept
 Counts the threshold from the level of the whole input.
 
bool isAutoThreshold () const noexcept
 Whether the threshold counts from the level of the input (see setAutoThreshold()).
 
void setReduction (T db) noexcept
 Sets the maximum gain reduction in dB (sign is ignored). Non-finite values are ignored.
 
void setDetectionMode (DetectionMode mode) noexcept
 Sets the detection mode. Out-of-range values are clamped so the getter stays honest.
 
T getGainReductionDb () const noexcept
 
T getFrequency () const noexcept
 
T getThreshold () const noexcept
 
DetectionMode getDetectionMode () const noexcept
 
T getAttack () const noexcept
 
T getRelease () const noexcept
 
T getBandwidth () const noexcept
 
T getReduction () const noexcept
 
std::vector< uint8_t > getState () const
 Serializes the parameter state (setup/UI threads; allocates).
 
bool setState (const uint8_t *data, size_t size)
 Restores parameters from a blob (tolerant; rejects foreign ids).
 

Detailed Description

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

Stereo-linked, CPU-optimized dynamic-EQ de-esser.

Detection is stereo-linked (one shared envelope) to preserve imaging. Channels beyond the first two are left untouched (pass-through), as is the whole buffer before prepare().

Template Parameters
TSample type (float or double).

Definition at line 75 of file DeEsser.h.

Member Enumeration Documentation

◆ DetectionMode

template<FloatType T>
enum class dspark::DeEsser::DetectionMode
strong
Enumerator
Bandpass 

Standard bandpass filter detection.

Derivative 

Sum of absolute derivatives. Sensitive to sustained high frequencies.

Definition at line 78 of file DeEsser.h.

◆ Structure

template<FloatType T>
enum class dspark::DeEsser::Structure
strong

How the cut bell is realised (see setStructure()).

Enumerator
DirectForm 

Direct form (the default).

Ladder 

Normalized ladder: passive while the reduction moves the bell.

Definition at line 154 of file DeEsser.h.

Member Function Documentation

◆ getAttack()

template<FloatType T>
T dspark::DeEsser< T >::getAttack ( ) const
inlinenoexcept

Definition at line 394 of file DeEsser.h.

◆ getBandwidth()

template<FloatType T>
T dspark::DeEsser< T >::getBandwidth ( ) const
inlinenoexcept
Returns
The detection/cut bandwidth in octaves (inverse of the stored Q).

Definition at line 398 of file DeEsser.h.

◆ getDetectionMode()

template<FloatType T>
DetectionMode dspark::DeEsser< T >::getDetectionMode ( ) const
inlinenoexcept

Definition at line 393 of file DeEsser.h.

◆ getFrequency()

template<FloatType T>
T dspark::DeEsser< T >::getFrequency ( ) const
inlinenoexcept

Definition at line 391 of file DeEsser.h.

◆ getGainReductionDb()

template<FloatType T>
T dspark::DeEsser< T >::getGainReductionDb ( ) const
inlinenoexcept

Definition at line 390 of file DeEsser.h.

◆ getReduction()

template<FloatType T>
T dspark::DeEsser< T >::getReduction ( ) const
inlinenoexcept
Returns
The maximum gain reduction in dB (positive).

Definition at line 405 of file DeEsser.h.

◆ getRelease()

template<FloatType T>
T dspark::DeEsser< T >::getRelease ( ) const
inlinenoexcept

Definition at line 395 of file DeEsser.h.

◆ getState()

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

Serializes the parameter state (setup/UI threads; allocates).

Definition at line 408 of file DeEsser.h.

◆ getStructure()

template<FloatType T>
Structure dspark::DeEsser< T >::getStructure ( ) const
inlinenoexcept
Returns
How the cut bell is realised.

Definition at line 177 of file DeEsser.h.

◆ getThreshold()

template<FloatType T>
T dspark::DeEsser< T >::getThreshold ( ) const
inlinenoexcept

Definition at line 392 of file DeEsser.h.

◆ isAutoThreshold()

template<FloatType T>
bool dspark::DeEsser< T >::isAutoThreshold ( ) const
inlinenoexcept

Whether the threshold counts from the level of the input (see setAutoThreshold()).

Definition at line 371 of file DeEsser.h.

◆ isMixedBell()

template<FloatType T>
bool dspark::DeEsser< T >::isMixedBell ( ) const
inlinenoexcept
Returns
Whether the cut is a fixed filter mixed by the reduction (setMixedBell()).

Definition at line 211 of file DeEsser.h.

◆ isRemovalListen()

template<FloatType T>
bool dspark::DeEsser< T >::isRemovalListen ( ) const
inlinenoexcept
Returns
Whether the output is what the de-esser takes out.

Definition at line 151 of file DeEsser.h.

◆ prepare()

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

Prepares the de-esser state and filters.

An invalid spec (non-positive or non-finite fields) is a no-op that keeps the previous state.

Parameters
specAudio environment specification.

Definition at line 92 of file DeEsser.h.

◆ processBlock()

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

Processes audio in-place. Stereo-linked to preserve imaging.

Parameters
bufferAudio data.

Definition at line 119 of file DeEsser.h.

◆ reset()

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

Resets internal DSP state.

Definition at line 291 of file DeEsser.h.

◆ setAttack()

template<FloatType T>
void dspark::DeEsser< T >::setAttack ( T  ms)
inlinenoexcept

Sets the detector attack, clamped to [0.1, 20] ms. Non-finite values are ignored.

Definition at line 311 of file DeEsser.h.

◆ setAutoThreshold()

template<FloatType T>
void dspark::DeEsser< T >::setAutoThreshold ( bool  on)
inlinenoexcept

Counts the threshold from the level of the whole input.

A reference follows the largest sample of the input, all of its band: it rises at once and falls 1 dB per second, and the threshold is added to it. The de-esser then acts on how loud the sibilance is against the voice that carries it, the same at any input level: a threshold of -20 dB reduces a band that comes within 20 dB of the voice's recent peaks. Off by default: the threshold is in dBFS.

State key "autoThreshold" (absent = off).

Definition at line 368 of file DeEsser.h.

◆ setBandwidth()

template<FloatType T>
void dspark::DeEsser< T >::setBandwidth ( T  octaves)
inlinenoexcept

Sets the detection/cut bandwidth in octaves (floored at 0.1). Non-finite values are ignored.

Definition at line 340 of file DeEsser.h.

◆ setDetectionMode()

template<FloatType T>
void dspark::DeEsser< T >::setDetectionMode ( DetectionMode  mode)
inlinenoexcept

Sets the detection mode. Out-of-range values are clamped so the getter stays honest.

Definition at line 381 of file DeEsser.h.

◆ setFrequency()

template<FloatType T>
void dspark::DeEsser< T >::setFrequency ( T  hz)
inlinenoexcept

Sets the sibilance centre frequency in Hz.

Clamped against the prepared sample rate when the filters rebuild (effective range [1, 0.499 * fs]). Non-finite values are ignored.

Definition at line 332 of file DeEsser.h.

◆ setMixedBell()

template<FloatType T>
void dspark::DeEsser< T >::setMixedBell ( bool  on)
inlinenoexcept

Runs the cut as one fixed filter mixed by the reduction.

The default bell is designed again every 16 samples as the reduction moves, a gain that moves in steps. Mixed, the bell is the signal and one fixed filter at the end of the range, of which only the share heard changes, sample by sample:

y = x + w * (end(x) - x), w = (1 - 10^(gr / 20)) / (1 - 10^(-range / 20))

so the centre of the band sits exactly on the reduction of the moment and nothing is designed while it moves. The end is the bell of the band's Q at half the range, carried to the whole range at its centre (the choice DynamicEQ's mixed bands make): nearer the rest the cut is wider than nominal and at the end narrower, by 10^(range / 80) in Q at most. The end filter runs as a normalized ladder and glides 20 ms to a new design when frequency, bandwidth or range move. With no reduction the output is the input, bit for bit. Safe from any thread; the switch restarts the filter memories at the next block. Off by default.

Measured at 48 kHz on a 6 kHz tone that jumps 28 dB 25 times a second under a bell of 12 dB: with a release of 1 or 5 ms the default bell leaves lines 3 kHz away at -46 to -52 dBc and the mixed one at -64 to -96 (the floor the tone's own edges set); with the default 20 ms both sit on that floor. It costs about 2.4 times the default bell (18 to 34 against 41 to 81 ns per stereo frame).

State key "mixedBell" (absent = off).

Definition at line 208 of file DeEsser.h.

◆ setReduction()

template<FloatType T>
void dspark::DeEsser< T >::setReduction ( T  db)
inlinenoexcept

Sets the maximum gain reduction in dB (sign is ignored). Non-finite values are ignored.

Definition at line 374 of file DeEsser.h.

◆ setRelease()

template<FloatType T>
void dspark::DeEsser< T >::setRelease ( T  ms)
inlinenoexcept

Sets the detector release, clamped to [1, 500] ms. Non-finite values are ignored.

Definition at line 319 of file DeEsser.h.

◆ setRemovalListen()

template<FloatType T>
void dspark::DeEsser< T >::setRemovalListen ( bool  on)
inlinenoexcept

Removal listen: the output is what the de-esser takes out. A monitoring control, not in the state.

Definition at line 149 of file DeEsser.h.

◆ setState()

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

Restores parameters from a blob (tolerant; rejects foreign ids).

Definition at line 428 of file DeEsser.h.

◆ setStructure()

template<FloatType T>
void dspark::DeEsser< T >::setStructure ( Structure  structure)
inlinenoexcept

Chooses how the cut bell is realised.

The bell is designed again every 16 samples as the reduction moves. Ladder runs it as a normalized ladder (NormalizedLadder): the same response, and a memory that cannot gain energy at the jumps, for about twice the arithmetic of the bell. Safe from any thread; the switch restarts the bell's memory at the next block.

Parameters
structureDirectForm (default) or Ladder.

Definition at line 171 of file DeEsser.h.

◆ setThreshold()

template<FloatType T>
void dspark::DeEsser< T >::setThreshold ( T  db)
inlinenoexcept

Sets the detection threshold in dBFS. Non-finite values are ignored.

Definition at line 350 of file DeEsser.h.


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