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

[Note] Note

The new dcblock2 opcode is an improved method of removing DC from an audio signal.

Examples

The result can be viewed in a graphical audio editor program like audacity. audacity is available for Linux, Windows, and the MacOS and may be downloaded from http://audacity.sourceforge.net.

Here is an example of the dcblock opcode. It uses the file dcblock.csd, and beats.wav.

Example 163. Example of the dcblock opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac     ;;;RT audio out
;-iadc    ;;;uncomment -iadc if RT audio input is needed too
; For Non-realtime ouput leave only the line below:
;-o dcblock.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2

instr 1	;add DC to "beats.wav"

asig soundin "beats.wav"
asig = asig+5000	;adds DC of 5000
     outs asig, asig
endin

instr 2	;dcblock audio

asig soundin "beats.wav"
asig = asig+5000	;adds DC
adc  dcblock asig	;remove DC again
     outs adc, adc

endin

</CsInstruments>
<CsScore>

i 1 0 2
i 2 2 2
e

</CsScore>
</CsoundSynthesizer>


See also

dcblock2

Credits

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

New in Csound version 3.49

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