# [chuck-users] filter

Perry R Cook prc at CS.Princeton.EDU
Sat Jul 1 15:35:48 EDT 2006

```oK, here's a 10 sentence description of the
BiQuad, which should cover TwoPole and TwoZero
as well.  Add to documentation if you like.

of a TwoPole and a TwoZero filter.  Poles are
resonances, and zeroes are anti-resonances.  The
coefficients of the TwoPole filter are defined as
a1=-2*r*cos(2*pi*freq/srate) and a2=r*r, where
r is the radius, between 0.0 and 1.0, and freq
is the center frequency of the resonance.  The r
value controls the resonance of the filter, so r=
0.0 makes the filter disappear, and an r value
of 1.0 makes the filter oscillate at the resonance
frequency.  Values greater than 1.0 make the filter
unstable and the universe is eventually destroyed.
The b coefficients of the TwoZero filter are set
exactly the same way, but an r value of 1.0 creates
a zero at the resonance frequency, meaning that
no information at that frequency can get through
the filter.  It's OK to have r values greater
than 1.0 in a TwoZero filter.  The .eqzs (Equal Gain
Zeroes) flag puts a zero at DC (0 frequency) and
1/2 sample rate, and serves to keep the gain of
the filter somewhat automatically in check when
moving the poles around.  This simple example
chuck code shows how the coefficients relate to
the frequency and resonance parameters.  Note
that this filter doesn't do anything, because the
zeroes exactly cancel out the poles (resonances);

noise n => BiQuad f => dac;

1000.0 => f.pfreq;
1000.0 => f.zfreq;

<<< f.a0(), f.a1(), f.a2(), f.b0(), f.b1(), f.b2() >>>;

// END Filter Code Example

On Sat, 1 Jul 2006, Adam Tindale wrote:

>
> On 1-Jul-06, at 5:00 AM, eduard aylon wrote:
>>
>> Try having a look at http://ccrma.stanford.edu/~jos/filters/
>
> I was going to suggest the same thing. If you aren't familiar with
> the basis of this material you can start with this one:
>
> http://ccrma.stanford.edu/~jos/mdft/
>
> You can also look at this:
>
> http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
>
> You can use these equations and dump the output into the biquad object.
>
> On 1-Jul-06, at 2:38 AM, Atte André Jensen wrote:
>>
>> Well as I said I know how to use those. The two pages (24 + 25) of
>> "Modifying Basic Patches" is not really that deep. Maybe I wasn't
>> being
>> clear, but I was more hoping for a few classic subtractive
>> examples. You
>> know like a pad, a moog style bass and a brass sound. With such a few
>> examples I imagine most users familiar with subtractive synthesis
>> would
>> be able to more or less take it from there...
>
> It isn't meant to be too deep. When writing this stuff I try to show
> the basics and let the programmer go. If I get time I will take a
> stab at something like this. If you get a cool patch send it along or
> you could write a tutorial and I could put it into the manual.
>
> Thanks to Perry for making your books cheap!
>
> --art
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
```