dcblock

dcblock — A DC blocking filter.

Description

Implements the DC blocking filter


Y[i] = X[i] - X[i-1] + (igain * Y[i-1])
      

Based on work by Perry Cook.

Syntax

ares dcblock ain [, igain]

Initialization

igain -- the gain of the filter, which defaults to 0.99

Performance

ain -- audio signal input

Examples

Here is an example of the dcblock opcode. It uses the files dcblock.orc, dcblock.sco, and beats.wav.

Example 93. Example of the dcblock opcode.

/* dcblock.orc */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Instrument #1 -- normal audio signal.
instr 1
  asig soundin "beats.wav"
  out asig
endin

; Instrument #2 -- dcblock-ed audio signal.
instr 2
  asig soundin "beats.wav"

  igain = 0.75
  a1 dcblock asig, igain

  out a1
endin
/* dcblock.orc */

        
/* dcblock.sco */
; Play Instrument #1 for 2 seconds.
i 1 0 2
; Play Instrument #2 for 2 seconds.
i 2 2 2
e
/* dcblock.sco */

        

Credits

Author: John ffitch
University of Bath, Codemist Ltd.
Bath, UK

Example written by Kevin Conder.

New in Csound version 3.49

February 2003: Thanks to a note from Anders Andersson, corrected the formula.