# [chuck-users] OneZero example

eduard aylon eduard.aylon at gmail.com
Fri Jul 28 11:53:58 EDT 2006

```Please correct me if I'm wrong.

A filter can be written in the form:

N(z)
H (z)= ------------
D(z)

where

N(z) = a_0 + a_1*z[-1] +...+ a_n*z[-n]   // as many a_coeff as zeros
+ a0
D(z) = b_0 + b_1*z[-1] +...+ b_m*z[-m]  // as many b_coeff as poles + b0

"a" "b" coefficients may be real or complex numbers.

In Chuck, OneZero lets you place ONE zero anywhere along the x axis,
thus "a" is forced to be real, and I guess it implicitly puts a pole
at origin (0,0) in order to have a causal filter.
You may use the OneZero::zero() or the ::b0() and ::b1() methods to
specify the location of the zero along the x-axis. ( a_coeffs are
named "b" in Chuck, and b_coeffs as "a", but that's just the name)

OneZero::zero() can be regarded as the following expression: H(z) = 1
- radius*z[-1], thus a normalised filter i.e gain=1.
OneZero::b0(), OneZero::b1() can be regarded as H(z) = b0 + b1*z[-1],
equivlaent to H(z) = b0*(1 + b1/b0*z[-1] ), thus a filter with gain 1/b0

Something like this:

/\ Im
|
|
|
|
-----------------x-----------o---> Re
| <--------->
|
|

hope this helps,

eduard

On Jul 28, 2006, at 4:43 PM, Atte André Jensen wrote:

> Hi
>
> Ok, I'm interested in getting some basic filtering going, first maybe
> just a simple low pass filter. So I received my copy of "Real Sound
> Synthesis". Section 3.9 suggests a low pass filter could be realized
> with a one-zero filter with "a" set between 0 and 1. Looking at
> http://chuck.cs.princeton.edu/doc/program/ugen_full.html#OneZero I
> don't
> see any "a", and where in the book can I read about b0 and b1.
>
> Moreover I wasn't able to locate any example code using OneZero, so if
> someone could provide me with a (couple of) simple example(s), I'd
> really appreciate it...
>
> --
> peace, love & harmony
> Atte
>
> http://www.atte.dk      | quartet:      http://www.anagrammer.dk
> http://www.atte.dk/gps  | compositions: http://www.atte.dk/
> compositions
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

```