Csound Csound-dev Csound-tekno Search About

IIR

Date1999-10-29 17:19
Fromluis jure
SubjectIIR
well, i seem to be back in the list again. here's a message i tried to send
twice before, unsuccessfully:


just for learning purposes i've been trying to implement the most basic
types of filters with instruments using just delay lines. everything went
fine with non-recursive filters, but with IIRs i don't get the expected
results.

below is an instrument that i think should produce the following:

y(n) = a*x(n) + b*y(n-1)

; orc =======================================
sr      =       44100
kr      =       44100
ksmps   =       1

instr   1

aout    init    0       ; y(n)
a0      rand    20000   ; x(n)
a1      =       a0 * .5 ; a * x(n)
a2      delay1  aout    ; y(n-1)
a3      =       a2 * .5 ; b * y(n-1)
aout    =       a1 + a3 ; y(n)
out     aout

endin

; sco =======================================

i1      0       3
e

it looks to me as if the instrument were right; the problem is that i don't 
get a low-pass filter as i should according to the textbook, but rather a
band-reject filter with center freq at sr/4 and a very wide bw. conversely,
with aout = a1 - a3 i get a band-pass filter of similar characteristics
instead of a high-pass. could somebody please point me what i am doing
wrong? 

thank you

Date1999-10-30 02:30
FromMichael Gogins
SubjectRE: IIR
IIRs will have to have ksmps = 1, presumably you are already doing that?

-----Original Message-----
From: lj@courier01.adinet.com.uy [mailto:lj@courier01.adinet.com.uy]On
Behalf Of luis jure
Sent: Friday, October 29, 1999 12:19 PM
To: csound list
Subject: IIR


well, i seem to be back in the list again. here's a message i tried to send
twice before, unsuccessfully:


just for learning purposes i've been trying to implement the most basic
types of filters with instruments using just delay lines. everything went
fine with non-recursive filters, but with IIRs i don't get the expected
results.

below is an instrument that i think should produce the following:

y(n) = a*x(n) + b*y(n-1)

; orc =======================================
sr      =       44100
kr      =       44100
ksmps   =       1

instr   1

aout    init    0       ; y(n)
a0      rand    20000   ; x(n)
a1      =       a0 * .5 ; a * x(n)
a2      delay1  aout    ; y(n-1)
a3      =       a2 * .5 ; b * y(n-1)
aout    =       a1 + a3 ; y(n)
out     aout

endin

; sco =======================================

i1      0       3
e

it looks to me as if the instrument were right; the problem is that i don't
get a low-pass filter as i should according to the textbook, but rather a
band-reject filter with center freq at sr/4 and a very wide bw. conversely,
with aout = a1 - a3 i get a band-pass filter of similar characteristics
instead of a high-pass. could somebody please point me what i am doing
wrong?

thank you