## DC blocking

Expand Messages
• Hello, Some folks have asked me how to block a DC offset in a signal using JSyn. A DC offset is a very low frequency, or constant value, added to a signal that
Message 1 of 1 , Jan 12, 2001
• 0 Attachment
Hello,

Some folks have asked me how to block a DC offset in a signal using
JSyn. A DC offset is a very low frequency, or constant value, added to a
signal that makes the average signal non-zero. This is not audible but
can cause clipping by pushing the audible signal towards the minimum or
maximum value. A DC offset can come from an oscillator with zero
frequency or other sources. You may be able to eliminate the DC offset
by setting an oscillators amplitude to zero whenever its frequency is
held at zero. But if the signal is coming from a file, or external
source, then you may want to remove the DC offset using a filter.

A filter that was proposed by Koen Vos on the music-dsp list is:

output(t) = 0.999 * output(t-1) + input(t) - input(t-1)

This can be implemented using the Filter_1o1p1z unit generator in JSyn.
The equation for that unit generator is:

y(n) = A0*x(n) + A1*x(n-1) - B1*y(n-1)

So if we:

Filter_101p1z myFilter = new Filter_101p1z();
myFilter.A0.set( 1.0 );
myFilter.A1.set( -1.0 );
myFilter.B1.set( -0.999 );

then we can use use the Filter_1o1p1z to block a DC offset in a signal.
Just connect your signal to the filter's input and use the output.

--
Phil Burk
http://www.softsynth.com
Your message has been successfully submitted and would be delivered to recipients shortly.