Gin
Loading...
Searching...
No Matches
DCBlocker Class Reference

Estimates the DC (very low frequency) content of a signal so it can be removed to form a DC blocker. More...

#include <gin_dcblocker.h>

Public Member Functions

 DCBlocker ()
 ~DCBlocker ()
void setSampleRate (float sampleRate_)
void setCutoff (float cutoff_)
float process (float x)
 Returns the low-pass (DC) estimate of x.
void reset ()

Detailed Description

Estimates the DC (very low frequency) content of a signal so it can be removed to form a DC blocker.

process() returns a first-order low-pass estimate of the input's DC bias. To block DC, subtract that estimate from the input: the difference is the high-passed signal. This is useful after certain DSP operations (like waveshaping or oscillators) that may introduce DC bias.

Key Features:

  • Configurable cutoff frequency (default 10 Hz)
  • First-order IIR low-pass estimator
  • Very low CPU usage
  • Reset for clearing filter state

Usage:

DCBlocker blocker;
blocker.setSampleRate(44100.0f);
blocker.setCutoff(10.0f); // Treat content below 10 Hz as DC
// Per-sample processing: subtract the DC estimate to block DC
float output = input - blocker.process(input);
void setSampleRate(float sampleRate_)
Definition gin_dcblocker.h:50
DCBlocker()
Definition gin_dcblocker.h:47
float process(float x)
Returns the low-pass (DC) estimate of x.
Definition gin_dcblocker.h:63
void setCutoff(float cutoff_)
Definition gin_dcblocker.h:56

Note: This is a per-sample filter. For stereo, use two instances.

See also
WTOscillator

Constructor & Destructor Documentation

◆ DCBlocker()

DCBlocker::DCBlocker ( )

◆ ~DCBlocker()

DCBlocker::~DCBlocker ( )

Member Function Documentation

◆ setSampleRate()

void DCBlocker::setSampleRate ( float sampleRate_)

◆ setCutoff()

void DCBlocker::setCutoff ( float cutoff_)

◆ process()

float DCBlocker::process ( float x)

Returns the low-pass (DC) estimate of x.

Subtract this from x to block DC.

◆ reset()

void DCBlocker::reset ( )

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