DC Blocker Software Implementations Next  |  Prev  |  Up  |  Top  |  Index  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

DC Blocker Software Implementations

In plain C, the difference equation for the dc blocker could be written as follows:

  y = x - xm1 + 0.995 * ym1;
  xm1 = x;
  ym1 = y;
Here, x denotes the current input sample, and y denotes the current output sample. The variables xm1 and ym1 hold once-delayed input and output samples, respectively (and are typically initialized to zero). In this implementation, the pole is fixed at $ R=0.995$, which corresponds to an adaptation time-constant of approximately $ 1/(1-R) = 200$ samples. A smaller $ R$ value allows faster tracking of ``wandering dc levels'', but at the cost of greater low-frequency attenuation.

A complete C++ class implementing a dc blocking filter is included in the free, open-source Synthesis Tool Kit (STK) [15]. (See the DCBlock STK class.)

For a discussion of issues and solutions related to fixed-point implementations, see [7].


Next  |  Prev  |  Up  |  Top  |  Index  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

[How to cite this work] [Order a printed hardcopy]

``Introduction to Digital Filters with Audio Applications'', by Julius O. Smith III, (August 2006 Edition).
Copyright © 2007-02-02 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA  [Automatic-links disclaimer]